|
@@ -1816,13 +1816,20 @@ class MainActivity :BaseActivity<MainActivityPresenter, MainActivityLayoutBindin
|
|
|
} else if (tcpModel.type == TcpType.BROADCAST) {
|
|
|
if (tcpModel.action == TcpAction.BroadcastAction.START) {
|
|
|
if (Constant.TCP_CONNECTED && !TextUtils.isEmpty(Constant.SIP_ID)) {
|
|
|
- if (tcpModel.data != null && !broadcastOn) {
|
|
|
+ if (SettingConfig.getSipEnabled(activity)) {
|
|
|
+ //sip广播处理
|
|
|
broadcastOn = true
|
|
|
- broadcastChannelId = tcpModel.data.toString()
|
|
|
- //如果当前有呼叫或通话则等待
|
|
|
- //if (Constant.CALL_STATE == Constant.CALL_STANDBY) {
|
|
|
- startBroadcast()
|
|
|
- //}
|
|
|
+ startSipBroadcast()
|
|
|
+ } else {
|
|
|
+ //webrtc广播处理
|
|
|
+ if (tcpModel.data != null && !broadcastOn) {
|
|
|
+ broadcastOn = true
|
|
|
+ broadcastChannelId = tcpModel.data.toString()
|
|
|
+ //如果当前有呼叫或通话则等待
|
|
|
+ //if (Constant.CALL_STATE == Constant.CALL_STANDBY) {
|
|
|
+ startBroadcast()
|
|
|
+ //}
|
|
|
+ }
|
|
|
}
|
|
|
} else {
|
|
|
showMessage("服务未连接或sipId为空")
|
|
@@ -1904,19 +1911,29 @@ class MainActivity :BaseActivity<MainActivityPresenter, MainActivityLayoutBindin
|
|
|
}
|
|
|
playing = true
|
|
|
|
|
|
- if (!SettingConfig.getSipEnabled(activity)) {
|
|
|
- //初始化 engine
|
|
|
- WebRTCEngine.getInstance().init(true, this)
|
|
|
- //初始化 janusClient
|
|
|
- janusClient = JanusClient(JanusConstant.JANUS_URL, Constant.SIP_ID.toBigInteger())
|
|
|
- //初始化 StreamingCallback
|
|
|
- val streamingCallback = StreamingCallback(janusClient, Constant.SIP_ID.toBigInteger(), broadcastChannelId.toBigInteger())
|
|
|
- janusClient?.setJanusCallback(streamingCallback)
|
|
|
- janusClient?.connect()
|
|
|
-
|
|
|
- //VoiceManagerUtil.setCallVoice(activity, 20)
|
|
|
- //WebRTCEngine.getInstance().muteAudio(true)
|
|
|
+
|
|
|
+ //初始化 engine
|
|
|
+ WebRTCEngine.getInstance().init(true, this)
|
|
|
+ //初始化 janusClient
|
|
|
+ janusClient = JanusClient(JanusConstant.JANUS_URL, Constant.SIP_ID.toBigInteger())
|
|
|
+ //初始化 StreamingCallback
|
|
|
+ val streamingCallback = StreamingCallback(janusClient, Constant.SIP_ID.toBigInteger(), broadcastChannelId.toBigInteger())
|
|
|
+ janusClient?.setJanusCallback(streamingCallback)
|
|
|
+ janusClient?.connect()
|
|
|
+
|
|
|
+ //VoiceManagerUtil.setCallVoice(activity, 20)
|
|
|
+ //WebRTCEngine.getInstance().muteAudio(true)
|
|
|
+
|
|
|
+ SerialPortHelper.openBroadcast()
|
|
|
+
|
|
|
+ runOnUiThread {
|
|
|
+ showMessage(R.string.broadcast_playing)
|
|
|
+ tv_broadcast_state.text = getString(R.string.broadcast_status) + getString(R.string.broadcast_playing)
|
|
|
}
|
|
|
+ }
|
|
|
+
|
|
|
+ private fun startSipBroadcast() {
|
|
|
+ playing = true
|
|
|
|
|
|
SerialPortHelper.openBroadcast()
|
|
|
|