Skip to content

Commit 06c0a79

Browse files
committed
优化SDK demo主动呼叫逻辑
Change-Id: I065466b91e6dca3f83653f20f89f6ae79e11dc96
1 parent 003e2e3 commit 06c0a79

File tree

2 files changed

+21
-5
lines changed

2 files changed

+21
-5
lines changed

sdkdemo/src/main/java/com/tencent/iot/explorer/link/core/demo/App.kt

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -108,13 +108,12 @@ class App : Application(), PayloadMessageCallback {
108108
fun enterRoom(room: RoomKey) {
109109
activity?.runOnUiThread {
110110
if (room.callType == TRTCCalling.TYPE_VIDEO_CALL) {
111-
TRTCUIManager.getInstance().isCalling = true
112-
TRTCVideoCallActivity.startCallSomeone(activity, room, data.callingDeviceId)
111+
TRTCUIManager.getInstance().joinRoom(TRTCCalling.TYPE_VIDEO_CALL, App.data.callingDeviceId, room)
112+
App.data.callingDeviceId = ""
113113
} else if (room.callType == TRTCCalling.TYPE_AUDIO_CALL) {
114-
TRTCUIManager.getInstance().isCalling = true
115-
TRTCAudioCallActivity.startCallSomeone(activity, room, data.callingDeviceId)
114+
TRTCUIManager.getInstance().joinRoom(TRTCCalling.TYPE_AUDIO_CALL, App.data.callingDeviceId, room)
115+
App.data.callingDeviceId = ""
116116
}
117-
data.callingDeviceId = ""
118117
}
119118
}
120119

sdkdemo/src/main/java/com/tencent/iot/explorer/link/core/demo/activity/ControlPanelActivity.kt

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import com.tencent.iot.explorer.link.core.auth.callback.MyCallback
1010
import com.tencent.iot.explorer.link.core.auth.entity.ControlPanel
1111
import com.tencent.iot.explorer.link.core.auth.entity.DeviceEntity
1212
import com.tencent.iot.explorer.link.core.auth.entity.RoomEntity
13+
import com.tencent.iot.explorer.link.core.auth.message.MessageConst
1314
import com.tencent.iot.explorer.link.core.auth.message.MessageConst.TRTC_AUDIO_CALL_STATUS
1415
import com.tencent.iot.explorer.link.core.auth.message.MessageConst.TRTC_VIDEO_CALL_STATUS
1516
import com.tencent.iot.explorer.link.core.auth.message.payload.Payload
@@ -29,6 +30,10 @@ import com.tencent.iot.explorer.link.core.demo.popup.EditPopupWindow
2930
import com.tencent.iot.explorer.link.core.demo.popup.EnumPopupWindow
3031
import com.tencent.iot.explorer.link.core.demo.popup.NumberPopupWindow
3132
import com.tencent.iot.explorer.link.core.demo.view.MyDivider
33+
import com.tencent.iot.explorer.trtc.model.RoomKey
34+
import com.tencent.iot.explorer.trtc.model.TRTCUIManager
35+
import com.tencent.iot.explorer.trtc.ui.audiocall.TRTCAudioCallActivity
36+
import com.tencent.iot.explorer.trtc.ui.videocall.TRTCVideoCallActivity
3237
import kotlinx.android.synthetic.main.activity_control_panel.*
3338
import kotlinx.android.synthetic.main.menu_back_layout.*
3439

@@ -320,6 +325,18 @@ class ControlPanelActivity : BaseActivity(), ControlPanelCallback, ActivePushCal
320325
* 显示枚举弹框
321326
*/
322327
fun showEnumPopup(entity: ControlPanel) {
328+
//特殊处理,当设备为trtc设备时。虽然call_status是枚举类型,但产品要求不弹弹窗,点击即拨打语音或视频通话。
329+
if (entity.id == MessageConst.TRTC_AUDIO_CALL_STATUS) {
330+
controlDevice(entity.id, "1")
331+
TRTCUIManager.getInstance().isCalling = true
332+
TRTCAudioCallActivity.startCallSomeone(this, RoomKey(), App.data.callingDeviceId)
333+
return
334+
} else if (entity.id == MessageConst.TRTC_VIDEO_CALL_STATUS) {
335+
controlDevice(entity.id, "1")
336+
TRTCUIManager.getInstance().isCalling = true
337+
TRTCVideoCallActivity.startCallSomeone(this, RoomKey(), App.data.callingDeviceId)
338+
return
339+
}
323340
if (enumPopup == null) {
324341
enumPopup = EnumPopupWindow(this)
325342
}

0 commit comments

Comments
 (0)