主頁(yè) > 服務(wù)與支持 > 開(kāi)發(fā)平臺(tái) > 客戶端SDK參考 > Windows Native SDK > 音視頻呼叫 音頻通話轉(zhuǎn)視頻通話
更新時(shí)間:2019-11-20
音頻通話中,通話的一方發(fā)起音頻通話切換為視頻通話。
音頻通話已建立,主被叫正在通話中。
通話中,主被叫雙方均可以發(fā)起音頻轉(zhuǎn)視頻操作。
//c code TSDK_RESULT ret; ret = tsdk_add_video(callid); if (TSDK_SUCCESS != ret) { LOG_D_CALL_ERROR("add video failed. result=%#x", ret); return -1; } return TSDK_SUCCESS; |
//c code TSDK_RESULT ret; TSDK_S_VIDEO_WND_INFO video_window_info[SERVICE_CALL_D_VIDEO_WINDOW_NUM] = { TSDK_E_VIDEO_WND_REMOTE }; video_window_info[TSDK_E_VIDEO_WND_LOCAL].render = (TSDK_UINT32)local_video_wnd; video_window_info[TSDK_E_VIDEO_WND_LOCAL].video_wnd_type = TSDK_E_VIDEO_WND_LOCAL; video_window_info[TSDK_E_VIDEO_WND_LOCAL].index = 1; video_window_info[TSDK_E_VIDEO_WND_LOCAL].display_mode = TSDK_E_VIDEO_WND_DISPLAY_FULL; video_window_info[TSDK_E_VIDEO_WND_REMOTE].render = (TSDK_UINT32)remote_video_wnd; video_window_info[TSDK_E_VIDEO_WND_REMOTE].video_wnd_type = TSDK_E_VIDEO_WND_REMOTE; video_window_info[TSDK_E_VIDEO_WND_REMOTE].index = 0; video_window_info[TSDK_E_VIDEO_WND_REMOTE].display_mode = TSDK_E_VIDEO_WND_DISPLAY_FULL; ret = tsdk_set_video_window(callid, SERVICE_CALL_D_VIDEO_WINDOW_NUM,video_window_info); if(TSDK_SUCCESS != ret) { LOG_D_CALL_ERROR("set video window info failed. result=%#x", ret); return -1; } return TSDK_SUCCESS; |
//c code unsigned int callID = (unsigned int)wParam; CDemoCallCtrlDlg* pCallDlg = CallDlgManager::GetInstance().GetCallDlgByCallID(callID); CHECK_POINTER_RETURN(pCallDlg, -1L); CDemoPromptDlg dlg; dlg.SetTextOfContent(L"The peer party request add video,do you agree?"); INT_PTR nResponse = dlg.DoModal(); pCallDlg->PostMessage(WM_CALL_ADD_VIDEO, (WPARAM)nResponse, NULL); return 0L; |
//c code TSDK_RESULT ret; ret = tsdk_reply_add_video(callid,isAccept); if (TSDK_SUCCESS != ret) { LOG_D_CALL_ERROR("reply add video failed. result=%#x", ret); return -1; } return TSDK_SUCCESS; |
只有被請(qǐng)求方用戶接受時(shí),才需要此步驟。
若用戶長(zhǎng)時(shí)間沒(méi)有響應(yīng),被請(qǐng)求端應(yīng)用程序應(yīng)該自動(dòng)拒絕轉(zhuǎn)視頻的請(qǐng)求。建議時(shí)間為45s。
//c code TSDK_RESULT ret; TSDK_S_VIDEO_WND_INFO video_window_info[SERVICE_CALL_D_VIDEO_WINDOW_NUM] = { TSDK_E_VIDEO_WND_REMOTE }; video_window_info[TSDK_E_VIDEO_WND_LOCAL].render = (TSDK_UINT32)local_video_wnd; video_window_info[TSDK_E_VIDEO_WND_LOCAL].video_wnd_type = TSDK_E_VIDEO_WND_LOCAL; video_window_info[TSDK_E_VIDEO_WND_LOCAL].index = 1; video_window_info[TSDK_E_VIDEO_WND_LOCAL].display_mode = TSDK_E_VIDEO_WND_DISPLAY_FULL; video_window_info[TSDK_E_VIDEO_WND_REMOTE].render = (TSDK_UINT32)remote_video_wnd; video_window_info[TSDK_E_VIDEO_WND_REMOTE].video_wnd_type = TSDK_E_VIDEO_WND_REMOTE; video_window_info[TSDK_E_VIDEO_WND_REMOTE].index = 0; video_window_info[TSDK_E_VIDEO_WND_REMOTE].display_mode = TSDK_E_VIDEO_WND_DISPLAY_FULL; ret = tsdk_set_video_window(callid, SERVICE_CALL_D_VIDEO_WINDOW_NUM,video_window_info); if(TSDK_SUCCESS != ret) { LOG_D_CALL_ERROR("set video window info failed. result=%#x", ret); return -1; } return TSDK_SUCCESS; |
若被請(qǐng)求方接受視頻請(qǐng)求,請(qǐng)求方向UI上報(bào)打開(kāi)視頻通知事件TSDK_E_CALL_EVT_OPEN_VIDEO_IND,UI根據(jù)事件顯示遠(yuǎn)端和近端視頻窗口;被請(qǐng)求方點(diǎn)擊接受后,UI顯示遠(yuǎn)端和近端視頻窗口。
若被請(qǐng)求方拒絕視頻請(qǐng)求,請(qǐng)求方向UI上報(bào)遠(yuǎn)端拒絕請(qǐng)求打開(kāi)視頻通知事件TSDK_E_CALL_EVT_REFUSE_OPEN_VIDEO_IND,UI銷(xiāo)毀遠(yuǎn)端和近端視頻窗口。
//c code /* 被請(qǐng)求方接受視頻請(qǐng)求 */ unsigned int callID = (unsigned int)wParam; CDemoCallCtrlDlg* pCallDlg; pCallDlg = CallDlgManager::GetInstance().GetCallDlgByCallID(callID); CHECK_POINTER_RETURN(pCallDlg, -1L); DLG_TYPE type; type = SIP_SIGNLE_VIDEO; pCallDlg->SendMessage(WM_CALL_MODIFY_VIDEO, WPARAM(type), NULL); return 0L; /* 被請(qǐng)求方拒絕視頻請(qǐng)求 */ unsigned int callID = (unsigned int)wParam; CDemoCallCtrlDlg* pCallDlg; pCallDlg = CallDlgManager::GetInstance().GetCallDlgByCallID(callID); CHECK_POINTER_RETURN(pCallDlg, -1L); DLG_TYPE type; type = SIP_SIGNLE_CALL; pCallDlg->SendMessage(WM_CALL_MODIFY_VIDEO, WPARAM(type), NULL); return 0L; |
無(wú)。