Пример #1
0
        public static void onRemoteTrackAvailableNotify(string strUid, AliRtcAudioTrack audioTrack, AliRtcVideoTrack videoTrack)
        {
            if (!m_ParamInfo.bAutoSub)
            {
                //当自动订阅开关关闭时,所有用户都手动订阅
                if (audioTrack == AliRtcAudioTrack.AliRtcAudioTrackMic)
                {
                    ImportDll.configRemoteAudio(strUid, true);
                }
                else
                {
                    ImportDll.configRemoteAudio(strUid, false);
                }
                if (videoTrack == AliRtcVideoTrack.AliRtcVideoTrackCamera ||
                    videoTrack == AliRtcVideoTrack.AliRtcVideoTrackBoth)
                {
                    ImportDll.configRemoteCameraTrack(strUid, true, true);
                }
                else
                {
                    ImportDll.configRemoteCameraTrack(strUid, true, false);
                }

                if (videoTrack == AliRtcVideoTrack.AliRtcVideoTrackScreen ||
                    videoTrack == AliRtcVideoTrack.AliRtcVideoTrackBoth)
                {
                    ImportDll.configRemoteScreenTrack(strUid, true);
                }
                else
                {
                    ImportDll.configRemoteScreenTrack(strUid, false);
                }
                ImportDll.setSubscribeResultCB SubscribeResultCB;
                SubscribeResultCB = new ImportDll.setSubscribeResultCB(onSubscribeResult);
                ImportDll.setSubscribeResultCallBack(SubscribeResultCB);

                bool bRet = ImportDll.subscribe(strUid);

                if (bRet == false)
                {
                    AliRtcSample.mainFrm.listBox_Tips.Items.Add("订阅失败,是否调用onSubscribeResultCallBack回调?");
                }
            }
            else
            {
                //开启自动订阅开关时,订阅所有有流的用户
                onSubscribeResult(strUid, audioTrack, videoTrack);
            }
        }