更新時間:2019-11-20
音頻通話中,通話的一方發(fā)起音頻通話切換為視頻通話。
音頻通話已建立,主被叫正在通話中。
通話中,主被叫雙方均可以發(fā)起音頻轉視頻操作。
//Java code TsdkVideoWndInfo localWndInfo = new TsdkVideoWndInfo(); localWndInfo.setVideoWndType(TsdkVideoWndType.TSDK_E_VIDEO_WND_LOCAL); localWndInfo.setRender(ViERenderer.getIndexOfSurface(localVideoView)); localWndInfo.setDisplayMode(TsdkVideoWndDisplayMode.TSDK_E_VIDEO_WND_DISPLAY_FULL); TsdkVideoWndInfo remoteWndInfo = new TsdkVideoWndInfo(); remoteWndInfo.setVideoWndType(TsdkVideoWndType.TSDK_E_VIDEO_WND_REMOTE); remoteWndInfo.setRender(ViERenderer.getIndexOfSurface(remoteVideoView)); remoteWndInfo.setDisplayMode(TsdkVideoWndDisplayMode.TSDK_E_VIDEO_WND_DISPLAY_CUT); List<TsdkVideoWndInfo> list = new ArrayList<>(); list.add(localWndInfo); list.add(remoteWndInfo); TsdkManager.getInstance().getCallManager().getCallByCallId(callId).setVideoWindow(list); |
//Java code public boolean addVideo() { initVideoWindow(); int result = tsdkCall.addVideo(); if (result != 0) { LogUtil.e(TAG, "addVideo return failed, result = " + result); return false; } setCallStatus(CallConstant.CallStatus.VIDEO_CALLING); return true; } |
//Java code public void onEvtOpenVideoReq(TsdkCall call, TsdkVideoOrientation orientType){ Log.i(TAG, "onCallAddVideo"); if (null == call) { Log.e(TAG, "onCallAddVideo tupCall is null"); return; } Session callSession = getCallSessionByCallID(call.getCallInfo().getCallId()); if (callSession == null) { Log.e(TAG, "call session obj is null"); return; } CallConstant.CallStatus callStatus = callSession.getCallStatus(); boolean isSupportVideo = isSupportVideo(); if ((!isSupportVideo) || (CallConstant.CallStatus.AUDIO_CALLING != callStatus)) { callSession.rejectAddVideo(); return; } mCallNotification.onCallEventNotify(CallConstant.CallEvent.RECEIVED_REMOTE_ADD_VIDEO_REQUEST, null); } |
參數(shù)“isAccept”表示是否接受:“true”為同意,“false”為拒絕。
//Java code public boolean acceptAddVideo() { initVideoWindow(); int result = tsdkCall.replyAddVideo(true); if (result != 0) { LogUtil.e(TAG, "replyAddVideo(accept) return failed, result = " + result); return false; } return true; } |
代碼示例:
//Java code public void onEvtRefuseOpenVideoInd(TsdkCall call){ VideoMgr.getInstance().clearCallVideo(); Session callSession = getCallSessionByCallID(call.getCallInfo().getCallId()); callSession.setCallStatus(CallConstant.CallStatus.AUDIO_CALLING); CallInfo callInfo = getCallInfo(call); mCallNotification.onCallEventNotify(CallConstant.CallEvent.REMOTE_REFUSE_ADD_VIDEO_SREQUEST, callInfo); } |
//Java code public void onEvtOpenVideoInd(TsdkCall call){ int isVideo = call.getCallInfo().getIsVideoCall(); // 1:video, 0: audio int callId = call.getCallInfo().getCallId(); Log.i(TAG, "isVideo: " + isVideo + "callId: " + callId); Session callSession = getCallSessionByCallID(callId); if (callSession == null) { return; } CallInfo callInfo = getCallInfo(call);//audio --> video success Log.i(TAG, "Upgrade To Video Call"); VideoMgr.getInstance().setVideoOrient(callId, CallConstant.FRONT_CAMERA); callSession.setCallStatus(CallConstant.CallStatus.VIDEO_CALLING); mCallNotification.onCallEventNotify(CallConstant.CallEvent.OPEN_VIDEO, callInfo); } |
無。