Beispiel #1
0
 public static void Init()
 {
     //注册视频采集数据回调
     //JObject jo = new JObject();
     //jo.Add(new JProperty("subtype", NIMVideoSubType.kNIMVideoSubTypeI420));
     //string json_extention = jo.ToString();
     NIM.NIMVChatCustomAudioJsonEx audioJsonEx = new NIMVChatCustomAudioJsonEx();
     NIM.NIMVChatCustomVideoJsonEx videoJsonEx = new NIMVChatCustomVideoJsonEx();
     videoJsonEx.VideoSubType = Convert.ToInt32(NIMVideoSubType.kNIMVideoSubTypeI420);
     NIM.DeviceAPI.SetVideoCaptureDataCb(VideoDataCaptureHandler, videoJsonEx);
     NIM.DeviceAPI.SetAudioCaptureDataCb(AudioDataCaptureHandler, audioJsonEx);
 }
        /// <summary>
        /// 监听接收的视频数据
        /// </summary>
        /// <param name="handler">回调</param>
        /// <param name="videoJsonEx">json参数封装类</param>
        /// <returns>无返回值</returns>
        public static void SetVideoReceiveDataCb(VideoDataHandler handler, NIMVChatCustomVideoJsonEx videoJsonEx)
        {
            string json_extension = "";

            if (videoJsonEx == null)
            {
                videoJsonEx = new NIMVChatCustomVideoJsonEx();
                videoJsonEx.VideoSubType = Convert.ToInt32(NIMVideoSubType.kNIMVideoSubTypeARGB);
            }
            json_extension = videoJsonEx.Serialize();
            var ptr = NimUtility.DelegateConverter.ConvertToIntPtr(handler);

            DeviceNativeMethods.nim_vchat_set_video_data_cb(false, json_extension, VideoDataCb, ptr);
        }