摘要:學(xué)習(xí)如何使用實(shí)時(shí)通信(RTC)API創(chuàng)建音頻與視頻會(huì)議、共享應(yīng)用程序、共享白板、簡單的點(diǎn)對(duì)點(diǎn)聊天對(duì)話以及整合音頻與視頻調(diào)節(jié)向?qū)У慕涌凇?shí)時(shí)通信API為任何基于Microsoft Windows XP的應(yīng)用程序提供了卓越的基于個(gè)人計(jì)算機(jī)的通信性能--即時(shí)消息、音頻與視頻會(huì)議、應(yīng)用程序的共享/協(xié)作。
樣例代碼說明了使用實(shí)時(shí)通信(RTC)API的優(yōu)點(diǎn),非常方便的產(chǎn)生音頻與視頻會(huì)議、共享應(yīng)用程序、共享白板、簡單的點(diǎn)對(duì)點(diǎn)聊天對(duì)話以及音頻與視頻調(diào)節(jié)向?qū)У慕涌凇?但是在本文中不會(huì)討論其他的通過實(shí)時(shí)通信RTC生效的性能,比如聲學(xué)回波消除(AEC)、向前糾錯(cuò)(FEC)、帶寬測(cè)定、動(dòng)態(tài)抖動(dòng)緩沖器治理、自動(dòng)增益控制(AGC)和質(zhì)量控制(QC)算法等。上面這些特性請(qǐng)參閱 Media Support in the Microsoft Windows Real-Time Communications Client實(shí)時(shí)通信客戶端接口
// Set the listen mode for RTC client // RTCLM_BOTH opens the standard Sip port 5060, as well as // a dynamic port. hr = m_pClient->put_ListenForIncomingSessions(RTCLM_BOTH); 在一個(gè)會(huì)話期間,音頻與視頻媒體類型可以被添加也可以被刪除,所以客戶端必須監(jiān)聽這些事件類型。請(qǐng)參閱本文"處理實(shí)時(shí)流會(huì)話事件"部分獲取關(guān)于狀態(tài)改變和事件處理的內(nèi)容。處理實(shí)時(shí)通信事件
// Based on the RTC_EVENT type, query for the // appropriate event interface and call a helper // method to handle the event switch ( wParam ) { …. …. …. case RTCE_MEDIA: { IRTCMediaEvent * pEvent = NULL;
if ((m_AVDlg) && (m_AVDlg.GetState () != RTCSS_IDLE)) { // Deliver the media state to the session window m_AVDlg.DeliverMedia(lMediaType, enType, enReason); } } 強(qiáng)度事件
if (m_AVDlg.GetState () != RTCSS_IDLE) { // Deliver the intensity state to the session window m_AVDlg.DeliverIntensity(enDevice, lLevel); } } 即時(shí)消息事件