コード例 #1
0
        /// <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
        }
コード例 #2
0
 private static void GetDeviceListCallback(bool ret, NIMDeviceType type, string jsonExtension, IntPtr userData)
 {
     _deviceList = null;
     if (ret)
     {
         _deviceList = NIMDeviceInfoList.Deserialize(jsonExtension);
     }
 }
コード例 #3
0
        /// <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
        }
コード例 #4
0
 private static void StartDeviceCallback(NIMDeviceType type, bool ret, string jsonExtension, IntPtr userData)
 {
     try
     {
         NimUtility.DelegateConverter.Invoke <StartDeviceResultHandler>(userData, type, ret);
     }
     catch
     {
     }
 }
コード例 #5
0
ファイル: NIMDeviceAPI.cs プロジェクト: xw0001/NIM-CSharp-SDK
        /// <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);
        }
コード例 #6
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 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);
        }
コード例 #8
0
 internal static extern void nim_vchat_remove_device_status_cb(NIMDeviceType type);
コード例 #9
0
 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);
コード例 #10
0
 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);
 }
コード例 #12
0
 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);
コード例 #14
0
 private static void DeviceStatusCallback(NIMDeviceType type, uint status, string devicePath, string jsonExtension, IntPtr userData)
 {
     NimUtility.DelegateConverter.Invoke <DeviceStatusHandler>(userData, type, status, devicePath);
 }
コード例 #15
0
        /// <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);
        }
コード例 #16
0
 /// <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
ファイル: NIMDeviceAPI.cs プロジェクト: zanjs/Wawaji
 /// <summary>
 /// 结束设备
 /// </summary>
 /// <param name="type">设备类型</param>
 public static void EndDevice(NIMDeviceType type)
 {
     DeviceNativeMethods.nim_vchat_end_device(type, "");
 }
コード例 #21
0
ファイル: NIMDeviceAPI.cs プロジェクト: zanjs/Wawaji
        /// <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
ファイル: NIMDeviceAPI.cs プロジェクト: zanjs/Wawaji
 /// <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);
 }