主頁 > 服務(wù)與支持 > 開發(fā)平臺(tái) > 客戶端SDK參考 > iOS Native SDK > 音視頻呼叫 建立視頻通話
更新時(shí)間:2019-11-20
用戶點(diǎn)對點(diǎn)視頻通話。
主被叫客戶端均已注冊。
呼叫ID作為一路通話的唯一標(biāo)識(shí),UI應(yīng)保存并管理,以用于后繼的呼叫相關(guān)操作。
TSDK_BOOL isVideo = ((TSDK_CALL_E_CALL_TYPE)callType==CALL_VIDEO)?TSDK_TRUE:TSDK_FALSE; TSDK_UINT32 callid = 0; TSDK_RESULT ret = tsdk_start_call(&callid,(TSDK_CHAR*)[number UTF8String], isVideo);
- (BOOL)updateVideoWindowWithLocal:(id)localVideoView andRemote:(id)remoteVideoView andBFCP:(id)bfcpVideoView callId:(unsigned int)callId { TSDK_S_VIDEO_WND_INFO videoInfo[3]; memset_s(videoInfo, sizeof(TSDK_S_VIDEO_WND_INFO) * 2, 0, sizeof(TSDK_S_VIDEO_WND_INFO) * 2); videoInfo[0].video_wnd_type = TSDK_E_VIDEO_WND_LOCAL; videoInfo[0].render = (TSDK_UPTR)localVideoView; videoInfo[0].display_mode = TSDK_E_VIDEO_WND_DISPLAY_FULL; videoInfo[1].video_wnd_type = TSDK_E_VIDEO_WND_REMOTE; videoInfo[1].render = (TSDK_UPTR)remoteVideoView; videoInfo[1].display_mode = TSDK_E_VIDEO_WND_DISPLAY_CUT; videoInfo[2].video_wnd_type = TSDK_E_VIDEO_WND_AUX_DATA; videoInfo[2].render = (TSDK_UPTR)bfcpVideoView; TSDK_RESULT ret; videoInfo[2].display_mode = TSDK_E_VIDEO_WND_DISPLAY_CUT; ret = tsdk_set_video_window((TSDK_UINT32)callId, 3, videoInfo); DDLogInfo(@"Call_Log: tsdk_set_video_window = %d",ret); [self updateVideoRenderInfoWithVideoIndex:CameraIndexFront withRenderType:TSDK_E_VIDEO_WND_LOCAL andCallId:callId]; [self updateVideoRenderInfoWithVideoIndex:CameraIndexFront withRenderType:TSDK_E_VIDEO_WND_REMOTE andCallId:callId]; return (TSDK_SUCCESS == ret); }
case TSDK_E_CALL_EVT_CALL_INCOMING: { TSDK_S_CALL_INFO *callInfo = (TSDK_S_CALL_INFO *)notify.data; CallInfo *tsdkCallInfo = [CallInfo transfromFromCallInfoStract:callInfo]; [self resetUCVideoOrientAndIndexWithCallId:0]; NSString *callId = [NSString stringWithFormat:@"%d", callInfo->call_id]; [_tsdkCallInfoDic setObject:tsdkCallInfo forKey:callId]; NSDictionary *resultInfo = @{ TSDK_CALL_INFO_KEY : tsdkCallInfo }; [self respondsCallDelegateWithType:CALL_INCOMMING result:resultInfo]; }
case TSDK_E_CALL_EVT_CALL_RINGBACK: { NSDictionary *resultInfo = @{ TSDK_CALL_RINGBACK_KEY : [NSNumber numberWithBool:true] }; [self respondsCallDelegateWithType:CALL_RINGBACK result:resultInfo]; break; }
被叫若拒絕呼叫參見結(jié)束通話(或呼叫)章節(jié)描述。
- (BOOL) answerComingCallType:(TUP_CALL_TYPE)callType callId:(unsigned int)callId { TSDK_RESULT ret = tsdk_accept_call((TSDK_UINT32)callId, callType == CALL_AUDIO ? TSDK_FALSE : TSDK_TRUE); DDLogInfo(@"Call_Log:answer call type is %d,result is %d, callid: %d",callType,ret,callId); return ret == TSDK_SUCCESS ? YES : NO; }
被叫用戶若選擇音頻接聽,則被叫用戶無需此步驟。
RTP通道已建立,可以進(jìn)行一些二次撥號(hào)等操作。
case TSDK_E_CALL_EVT_CALL_CONNECTED: { DDLogInfo(@"Call_Log: recv call notify :CALL_E_EVT_CALL_CONNECTED"); TSDK_S_CALL_INFO *callInfo = (TSDK_S_CALL_INFO *)notify.data; CallInfo *tsdkCallInfo = [CallInfo transfromFromCallInfoStract:callInfo]; NSString *callId = [NSString stringWithFormat:@"%d", tsdkCallInfo.stateInfo.callId]; [_tsdkCallInfoDic setObject:tsdkCallInfo forKey:callId]; NSDictionary *resultInfo = @{ TSDK_CALL_INFO_KEY : tsdkCallInfo }; [self respondsCallDelegateWithType:CALL_CONNECT result:resultInfo]; }
無。