Commit 7c1a4482 authored by sheteng's avatar sheteng

语音房间 禁言2

parent 8e5eb158
...@@ -69,7 +69,7 @@ ...@@ -69,7 +69,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="8dp" android:layout_marginTop="8dp"
android:hint="ip" android:hint="ip"
android:text="106.15.237.67" android:text="10.17.4.207"
android:imeActionLabel="@string/action_sign_in_short" android:imeActionLabel="@string/action_sign_in_short"
android:imeOptions="actionDone" android:imeOptions="actionDone"
android:selectAllOnFocus="true" android:selectAllOnFocus="true"
......
...@@ -715,6 +715,8 @@ public class CCIMClient { ...@@ -715,6 +715,8 @@ public class CCIMClient {
conf.plugin(JanusPlugins.VIDEOROOM); conf.plugin(JanusPlugins.VIDEOROOM);
if (janusService != null) { if (janusService != null) {
janusService.stop(); janusService.stop();
// callback.onJoinFailed(ErrorCode.JOIN_AUDIO_FAILED_JOINED);
// return;
} }
janusService = new JanusService(context, roomId, user, callback); janusService = new JanusService(context, roomId, user, callback);
janusService.start(context, conf); janusService.start(context, conf);
......
...@@ -48,19 +48,20 @@ public class JanusService extends JanusDelegate { ...@@ -48,19 +48,20 @@ public class JanusService extends JanusDelegate {
private Boolean isJoin = false; private Boolean isJoin = false;
private AudioRoomListener callback; private AudioRoomListener callback;
private AudioManager audioManager; // private AudioManager audioManager;
private AudioTrack audioTrack; private AudioTrack audioTrack;
private AppRTCAudioManager audioManager;
public JanusService(Context context, Integer roomId, User user, AudioRoomListener callback) { public JanusService(Context context, Integer roomId, User user, AudioRoomListener callback) {
audioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE); audioManager = AppRTCAudioManager.create(context);
// audioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);
this.user = user; this.user = user;
this.roomId = roomId; this.roomId = roomId;
this.callback = callback; this.callback = callback;
if (audioManager != null) { audioManager.start((selectedAudioDevice, availableAudioDevices) -> {
audioManager.setMode(AudioManager.MODE_IN_COMMUNICATION);
// audioManager.adjustStreamVolume (AudioManager.STREAM_MUSIC, AudioManager.ADJUST_RAISE, AudioManager.FLAG_SHOW_UI); });
// audioManager.setSpeakerphoneOn(true);
}
} }
...@@ -103,7 +104,7 @@ public class JanusService extends JanusDelegate { ...@@ -103,7 +104,7 @@ public class JanusService extends JanusDelegate {
public void onClose() { public void onClose() {
logger.info("close"); logger.info("close");
if (audioManager != null) { if (audioManager != null) {
audioManager.setMode(AudioManager.MODE_NORMAL); audioManager.stop();
} }
} }
......
...@@ -18,5 +18,6 @@ public class ErrorCode { ...@@ -18,5 +18,6 @@ public class ErrorCode {
public static final int ERROR_PERMISSION_DENIE = 912; //权限拒绝 public static final int ERROR_PERMISSION_DENIE = 912; //权限拒绝
public static final int JOIN_AUDIO_FAILED = 913; //加入语音失败 public static final int JOIN_AUDIO_FAILED = 913; //加入语音失败
public static final int JOIN_AUDIO_FAILED_NO_SUCH_ROOM = 914; //没有这个房间 public static final int JOIN_AUDIO_FAILED_NO_SUCH_ROOM = 914; //没有这个房间
public static final int JOIN_AUDIO_FAILED_JOINED = 915; //已经加入房间,不能同时加入多个房间
} }
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