Esempio n. 1
0
        /// <summary>
        /// 应用设置
        /// </summary>
        private void ApplySetting()
        {
            int retCode   = 0;
            int streamIdx = Int32.Parse((comboBox_videoDeviceList.SelectedItem as ComboBoxItem).Value.ToString());
            //streamIdx = streamIdx + 1;

            //设置码率
            int videoBitrate = 0;

            videoBitrate = Int32.Parse((comboBox_VideoBitrate.SelectedItem as ComboBoxItem).Value.ToString());
            retCode      = AnyChatCoreSDK.SetUserStreamInfo(-1, streamIdx, AnyChatCoreSDK.BRAC_SO_LOCALVIDEO_BITRATECTRL, ref videoBitrate, sizeof(int));


            //设置分辨率
            string videoResolution = string.Empty;

            videoResolution = (comboBox_VideoResolution.SelectedItem as ComboBoxItem).Value.ToString();
            string[] resolutionArray = videoResolution.Split('x');
            int      videoWidth      = Int32.Parse(resolutionArray[0]);
            int      videoHeigth     = Int32.Parse(resolutionArray[1]);

            retCode = AnyChatCoreSDK.SetUserStreamInfo(-1, streamIdx, AnyChatCoreSDK.BRAC_SO_LOCALVIDEO_WIDTHCTRL, ref videoWidth, sizeof(int));
            retCode = AnyChatCoreSDK.SetUserStreamInfo(-1, streamIdx, AnyChatCoreSDK.BRAC_SO_LOCALVIDEO_HEIGHTCTRL, ref videoHeigth, sizeof(int));

            //设置帧率
            int videoFPS = 0;

            videoFPS = Int32.Parse((comboBox_VideoFPS.SelectedItem as ComboBoxItem).Value.ToString());
            retCode  = AnyChatCoreSDK.SetUserStreamInfo(-1, streamIdx, AnyChatCoreSDK.BRAC_SO_LOCALVIDEO_FPSCTRL, ref videoFPS, sizeof(int));


            //让视频设置参数生效
            int isApply = 1;

            retCode = AnyChatCoreSDK.SetUserStreamInfo(-1, streamIdx, AnyChatCoreSDK.BRAC_SO_LOCALVIDEO_APPLYPARAM, ref isApply, sizeof(int));

            //AnyChatCoreSDK.UserCameraControlEx(-1, false, streamIdx, 0, string.Empty);
            //Thread.Sleep(500);
            //Application.DoEvents();
            //AnyChatCoreSDK.UserCameraControlEx(-1, true, streamIdx, 0, string.Empty);
        }