Пример #1
0
        /// <summary>
        /// 关闭子音频实例
        /// </summary>
        public void Close()
        {
            ThrowIfChildServiceException();

            ChildAudioApi.Close(ChildService);

            ChildService = IntPtr.Zero;
        }
Пример #2
0
        /// <summary>
        /// 以默认值初始化子音频输入参数
        /// </summary>
        /// <param name="service">直播推流实例</param>
        /// <param name="param">子音频参数</param>
        public AudioInParam GetDefaultParam()
        {
            ApiProvider.Default.ThrowIfServiceException();

            _AudioInParam param;

            ChildAudioApi.GetDefaultParam(ApiProvider.Default.Service, out param);

            return((AudioInParam)param);
        }
Пример #3
0
        /// <summary>
        /// 用户指定音频流推流发送接口
        /// </summary>
        /// <param name="audioData">用户指定音频流数据</param>
        /// <returns></returns>
        public bool SendCustomData(byte[] audioData)
        {
            ThrowIfChildServiceException();

            if (audioData == null)
            {
                throw new ArgumentNullException("audioData");
            }

            return(ChildAudioApi.SendCustomData(ChildService, audioData, audioData.Length) == FuncResult.Ok);
        }
Пример #4
0
        /// <summary>
        /// 打开子音频实例
        /// </summary>
        /// <param name="param">子音频采集参数</param>
        /// <returns></returns>
        public bool Open(AudioInParam param)
        {
            ApiProvider.Default.ThrowIfServiceException();

            if (param == null)
            {
                throw new ArgumentNullException("param");
            }

            var p = (_AudioInParam)param;

            try
            {
                ChildService = ChildAudioApi.Open(ApiProvider.Default.Service, ref p);

                return(ChildService != IntPtr.Zero);
            }
            finally
            {
                p.Dispose();
            }
        }
Пример #5
0
        /// <summary>
        /// 打开子音频采集,当需要改变采集设备的时候需要先停止再重新打开
        /// </summary>
        /// <returns></returns>
        public bool StartCapture()
        {
            ThrowIfChildServiceException();

            return(ChildAudioApi.StartCapture(ChildService) == FuncResult.Ok);
        }
Пример #6
0
        /// <summary>
        /// 恢复子音频推流
        /// </summary>
        public void ResumeLiveStream()
        {
            ThrowIfChildServiceException();

            ChildAudioApi.ResumeLiveStream(ChildService);
        }
Пример #7
0
        /// <summary>
        /// 暂停子音频推流(不会暂停采集)
        /// </summary>
        public void PauseLiveStream()
        {
            ThrowIfChildServiceException();

            ChildAudioApi.PauseLiveStream(ChildService);
        }
Пример #8
0
        /// <summary>
        /// 设置子音频音量
        /// </summary>
        /// <param name="ratio">暂定0-100;0表示静音,100表示原始音量</param>
        public void SetVolume(int ratio)
        {
            ThrowIfChildServiceException();

            ChildAudioApi.SetVolume(ChildService, ratio);
        }
Пример #9
0
        /// <summary>
        /// 暂停/继续子音频采集
        /// </summary>
        /// <param name="pause">是否暂停子音频采集</param>
        /// <remarks>
        /// 此方法必须在StartCapture和StopCapture之间执行
        /// </remarks>
        public void SwitchCapture(bool pause)
        {
            ThrowIfChildServiceException();

            ChildAudioApi.SwitchCapture(ChildService, pause);
        }
Пример #10
0
        /// <summary>
        /// 关闭子音频采集
        /// </summary>
        public void StopCapture()
        {
            ThrowIfChildServiceException();

            ChildAudioApi.StopCapture(ChildService);
        }