Example #1
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
        }
Example #3
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);
        }