Commit 4aae5817 authored by sheteng's avatar sheteng

语音房间 3

parent d8ca40ab
...@@ -680,6 +680,9 @@ public class CCIMClient { ...@@ -680,6 +680,9 @@ public class CCIMClient {
JanusConfImpl conf = new JanusConfImpl(); JanusConfImpl conf = new JanusConfImpl();
conf.url(audioServer); conf.url(audioServer);
conf.plugin(JanusPlugins.VIDEOROOM); conf.plugin(JanusPlugins.VIDEOROOM);
if (janusService != null) {
janusService.stop();
}
janusService = new JanusService(context, roomId, user, callback); janusService = new JanusService(context, roomId, user, callback);
janusService.start(context, conf); janusService.start(context, conf);
} }
...@@ -690,9 +693,14 @@ public class CCIMClient { ...@@ -690,9 +693,14 @@ public class CCIMClient {
public void exitAudioRoom() { public void exitAudioRoom() {
if (janusService != null) { if (janusService != null) {
janusService.stop(); janusService.stop();
janusService = null;
} }
} }
/**
* 是否禁言自己
* @param enable
*/
public void setLocalAudio(boolean enable) { public void setLocalAudio(boolean enable) {
if (janusService != null) { if (janusService != null) {
janusService.setLocalAudio(enable); janusService.setLocalAudio(enable);
......
...@@ -58,6 +58,7 @@ public class JanusService extends JanusDelegate { ...@@ -58,6 +58,7 @@ public class JanusService extends JanusDelegate {
this.callback = callback; this.callback = callback;
if (audioManager != null) { if (audioManager != null) {
audioManager.setMode(AudioManager.MODE_IN_COMMUNICATION); audioManager.setMode(AudioManager.MODE_IN_COMMUNICATION);
// audioManager.adjustStreamVolume (AudioManager.STREAM_MUSIC, AudioManager.ADJUST_RAISE, AudioManager.FLAG_SHOW_UI);
// audioManager.setSpeakerphoneOn(true); // audioManager.setSpeakerphoneOn(true);
} }
} }
...@@ -129,7 +130,9 @@ public class JanusService extends JanusDelegate { ...@@ -129,7 +130,9 @@ public class JanusService extends JanusDelegate {
@Override @Override
public void onMediaChanged(MediaBundle media) { public void onMediaChanged(MediaBundle media) {
audioTrack = media.localAudioTrack(); if ( media.localAudioTrack() != null) {
audioTrack = media.localAudioTrack();
}
} }
@Override @Override
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment