/// <summary>
        /// 结束设备
        /// </summary>
        /// <param name="type">设备类型</param>
        /// <returns>无返回值</returns>
        public static void EndDevice(NIMDeviceType type)
        {
#if NIMAPI_UNDER_WIN_DESKTOP_ONLY || UNITY_STANDALONE_WIN
            DeviceNativeMethods.nim_vchat_end_device(type, "");
#else
#endif
        }
 private static void GetDeviceListCallback(bool ret, NIMDeviceType type, string jsonExtension, IntPtr userData)
 {
     _deviceList = null;
     if (ret)
     {
         _deviceList = NIMDeviceInfoList.Deserialize(jsonExtension);
     }
 }
        /// <summary>
        /// 遍历设备
        /// </summary>
        /// <param name="type">设备类型</param>
        /// <returns>NIMDeviceInfoList 设备属性列表</returns>
        public static NIMDeviceInfoList GetDeviceList(NIMDeviceType type)
        {
#if NIMAPI_UNDER_WIN_DESKTOP_ONLY || UNITY_STANDALONE_WIN
            DeviceNativeMethods.nim_vchat_enum_device_devpath(type, "", GetDeviceListCb, IntPtr.Zero);
            return(_deviceList);
#else
            return(null);
#endif
        }
 private static void StartDeviceCallback(NIMDeviceType type, bool ret, string jsonExtension, IntPtr userData)
 {
     try
     {
         NimUtility.DelegateConverter.Invoke <StartDeviceResultHandler>(userData, type, ret);
     }
     catch
     {
     }
 }
示例#5
0
        /// <summary>
        /// 启动设备,同一NIMDeviceType下设备将不重复启动,不同的设备会先关闭前一个设备开启新设备
        /// </summary>
        /// <param name="type">设备类型</param>
        /// <param name="devicePath">设备路径对应</param>
        /// <param name="fps">摄像头为采样频率(一般传电源频率取50),其他NIMDeviceType无效(麦克风采样频率由底层控制,播放器采样频率也由底层控制)</param>
        /// <param name="StartDeviceInfo">启动设备json封装类</param>
        /// <param name="handler">回调</param>
        /// <returns>无返回值</returns>
        public static void StartDevice(NIMDeviceType type, string devicePath, uint fps, NIMStartDeviceJsonEX StartDeviceInfo, StartDeviceResultHandler handler)
        {
            if (StartDeviceInfo == null)
            {
                StartDeviceInfo = new NIMStartDeviceJsonEX();
            }
            string json_info = StartDeviceInfo.Serialize();
            var    ptr       = NimUtility.DelegateConverter.ConvertToIntPtr(handler);

            DeviceNativeMethods.nim_vchat_start_device(type, devicePath, fps, json_info, StartDeviceCb, ptr);
        }
        /// <summary>
        /// 启动设备,同一NIMDeviceType下设备将不重复启动,不同的设备会先关闭前一个设备开启新设备
        /// </summary>
        /// <param name="type">设备类型</param>
        /// <param name="devicePath">设备路径对应</param>
        /// <param name="fps">摄像头为采样频率(一般传电源频率取50),其他NIMDeviceType无效(麦克风采样频率由底层控制,播放器采样频率也由底层控制)</param>
        /// <param name="StartDeviceInfo">启动设备json封装类</param>
        /// <param name="handler">回调</param>
        /// <returns>无返回值</returns>
        public static void StartDevice(NIMDeviceType type, string devicePath, uint fps, NIMStartDeviceJsonEX StartDeviceInfo, StartDeviceResultHandler handler)
        {
#if NIMAPI_UNDER_WIN_DESKTOP_ONLY || UNITY_STANDALONE_WIN
            if (StartDeviceInfo == null)
            {
                StartDeviceInfo = new NIMStartDeviceJsonEX();
            }
            string json_info = StartDeviceInfo.Serialize();
            var    ptr       = NimUtility.DelegateConverter.ConvertToIntPtr(handler);
            DeviceNativeMethods.nim_vchat_start_device(type, devicePath, fps, json_info, StartDeviceCb, ptr);
#else
#endif
        }
示例#7
0
        void StartCameraDeviceResultCallback(NIMDeviceType type, bool ret)
        {
            Action action = () =>
            {
                if (ret)
                {
                }
                else
                {
                    MessageBox.Show("启动摄像头设备失败");
                }
            };

            this.Invoke(action);
        }
 internal static extern void nim_vchat_remove_device_status_cb(NIMDeviceType type);
 internal static extern void nim_vchat_enum_device_devpath(NIMDeviceType type,
                                                           [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(NimUtility.Utf8StringMarshaler))] string json_extension,
                                                           nim_vchat_enum_device_devpath_sync_cb_func cb, IntPtr user_data);
 internal static extern void nim_vchat_add_device_status_cb(NIMDeviceType type, nim_vchat_device_status_cb_func cb, IntPtr user_data);
示例#11
0
 /// <summary>
 /// 移除设备监听(摄像头和麦克风)
 /// </summary>
 /// <param name="type">设备类型</param>
 public static void RemoveDeviceStatusCb(NIMDeviceType type)
 {
     nim_vchat_remove_device_status_cb(type);
 }
 internal static extern void nim_vchat_end_device(NIMDeviceType type,
                                                  [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(NimUtility.Utf8StringMarshaler))] string json_extension);
示例#13
0
 public static extern void nim_vchat_enum_device_devpath(NIMDeviceType type, string json_extension, nim_vchat_enum_device_devpath_sync_cb_func cb, IntPtr user_data);
 private static void DeviceStatusCallback(NIMDeviceType type, uint status, string devicePath, string jsonExtension, IntPtr userData)
 {
     NimUtility.DelegateConverter.Invoke <DeviceStatusHandler>(userData, type, status, devicePath);
 }
        /// <summary>
        /// 添加设备监听(摄像头和麦克风) 注意监听设备后底层会定时检查设备情况,在不需要监听后请移除
        /// </summary>
        /// <param name="type">设备类型(kNIMDeviceTypeAudioIn和kNIMDeviceTypeVideo有效)</param>
        /// <param name="handler">回调</param>
        /// <returns>无返回值</returns>
        public static void AddDeviceStatusCb(NIMDeviceType type, DeviceStatusHandler handler)
        {
            var ptr = NimUtility.DelegateConverter.ConvertToIntPtr(handler);

            DeviceNativeMethods.nim_vchat_add_device_status_cb(type, DeviceStatusCb, ptr);
        }
 /// <summary>
 /// 移除设备监听(摄像头和麦克风)
 /// </summary>
 /// <param name="type">设备类型</param>
 /// <returns>无返回值</returns>
 public static void RemoveDeviceStatusCb(NIMDeviceType type)
 {
     DeviceNativeMethods.nim_vchat_remove_device_status_cb(type);
 }
示例#17
0
 public static extern void nim_vchat_end_device(NIMDeviceType type, string json_extension);
示例#18
0
 public static extern void nim_vchat_start_device(NIMDeviceType type, string device_path, uint fps, string json_extension, nim_vchat_start_device_cb_func cb, IntPtr user_data);
示例#19
0
 /// <summary>
 /// 结束设备
 /// </summary>
 /// <param name="type">设备类型</param>
 public static void EndDevice(NIMDeviceType type)
 {
     nim_vchat_end_device(type, "");
 }
示例#20
0
 /// <summary>
 /// 结束设备
 /// </summary>
 /// <param name="type">设备类型</param>
 public static void EndDevice(NIMDeviceType type)
 {
     DeviceNativeMethods.nim_vchat_end_device(type, "");
 }
示例#21
0
        /// <summary>
        /// 启动设备,同一NIMDeviceType下设备将不重复启动,不同的设备会先关闭前一个设备开启新设备
        /// </summary>
        /// <param name="type">设备类型</param>
        /// <param name="devicePath">设备路径对应</param>
        /// <param name="fps">摄像头为采样频率(一般传电源频率取50),其他NIMDeviceType无效(麦克风采样频率由底层控制,播放器采样频率也由底层控制)</param>
        /// <param name="handler">回调</param>
        public static void StartDevice(NIMDeviceType type, string devicePath, uint fps, StartDeviceResultHandler handler)
        {
            var ptr = NimUtility.DelegateConverter.ConvertToIntPtr(handler);

            DeviceNativeMethods.nim_vchat_start_device(type, devicePath, fps, "", StartDeviceCb, ptr);
        }
示例#22
0
 /// <summary>
 /// 遍历设备
 /// </summary>
 /// <param name="type">设备类型</param>
 /// <returns></returns>
 public static NIMDeviceInfoList GetDeviceList(NIMDeviceType type)
 {
     DeviceNativeMethods.nim_vchat_enum_device_devpath(type, "", GetDeviceListCb, IntPtr.Zero);
     return(_deviceList);
 }
示例#23
0
 /// <summary>
 /// 遍历设备
 /// </summary>
 /// <param name="type">设备类型</param>
 /// <returns></returns>
 public static NIMDeviceInfoList GetDeviceList(NIMDeviceType type)
 {
     nim_vchat_enum_device_devpath(type, "", GetDeviceListCb, IntPtr.Zero);
     return(device_list);
 }