跳到主要内容

双向对讲

更新时间:2025-07-02 19:55:19

双向对讲接口同【通用版-双向对讲

示例

  1. 请先构建专属版设备对象
  2. 其它同通用版-双向对讲
import com.polaris.iot.appsdk.libplayer.IoTMediaPusher;

private IoTMediaPusher mIoTMediaPusher;
private boolean mIsTalking = false;
/**
* withVideo 带屏设备通话
*/
private boolean startTalk(boolean withVideo) {
if (accessTalkPermission(withVideo) != PackageManager.PERMISSION_GRANTED) {
runOnUiThread(() -> showToast(" 请打开通话所需录制权限"));
return false;
}
IoTLogger.d(TAG, "talk start ");
//视频通话时,本地视频窗口容器,
FrameLayout flLocalWrapper = findViewById(R.id.flLocalWrapper);

if (mIoTMediaPusher == null) {

SpecialDeviceInfo deviceInfo = SpecialDeviceInfo("{iotId}","{productKey}","{deviceName}");
IoTDeviceInfo playDeviceInfo = IoTDeviceInfo.copyFrom(deviceInfo);
mIoTMediaPusher = new IoTMediaPusher(LivePlayActivity.this, playDeviceInfo, flLocalWrapper);
mIoTMediaPusher.setPushStatusListener(mIoTPushStatusListener);
}
if (withVideo) {
mIoTMediaPusher.startPush(240, 320, 10, 200);
} else {
mIoTMediaPusher.startPush();
startUpdateTalkTime(liveBtn);
}
if (mIsMuted) {
callLiveBtn(LiveBtnTypeEnum.Sound);
}
mIsTalking = true;
return true;
}