public bool SetAudioDevice(IAudioDevice audioDevice)
 {
     if (_useAudioDevice == audioDevice)
     {
         return(true);
     }
     _useAudioDevice = audioDevice;
     return(_aacEncoder.SetAudioDataSource(_useAudioDevice));
 }
Example #2
0
        public void RecordFileTestMethod()
        {
            var videoDevice = videoDeviceManager.GetVideoDeviceById(0);

            videoEncoder.SetVideoSource(videoDevice);

            var audioDevice = audioDeviceManager.GetAudioDeviceById(0);

            aacEncoder.SetAudioDataSource(audioDevice);

            Record record = new Record(videoEncoder, aacEncoder);

            Assert.IsTrue(record.StartRecord(@"test.mp4"));
            Thread.Sleep(3000);
            Assert.IsTrue(record.StopRecord());
        }
 public VideoLiveAndRecordProvider(ILoggerFacade logger, IAudioDeviceManager audioDeviceManager, int defaultMicrophoneID)
 {
     _logger             = logger;
     _aacEncoder         = new AacEncoder();
     _videoEncoder       = new H264VideoEncoder();
     _audioDeviceManager = audioDeviceManager;
     _useAudioDevice     = _audioDeviceManager.GetAudioDeviceById(defaultMicrophoneID);
     if (_useAudioDevice == null)
     {
         _useAudioDevice = _audioDeviceManager.GetAudioDevices().First();
     }
     _aacEncoder.SetAudioDataSource(_useAudioDevice);
     _videoRecord        = new Record.Record(_videoEncoder, _aacEncoder);
     _videoLiveBroadcast = new LiveBroadcast.LiveBroadcast(_videoEncoder, _aacEncoder);
     _videoLiveBroadcast.OnNetworkInterruption          += _videoLiveBroadcast_OnNetworkInterruption;
     _videoLiveBroadcast.OnNetworkReconnectionFailed    += _videoLiveBroadcast_OnNetworkReconnectionFailed;
     _videoLiveBroadcast.OnNetworkReconnectionSucceeded += _videoLiveBroadcast_OnNetworkReconnectionSucceeded;
 }
Example #4
0
        public void CollectWindowImageAndRecordTest()
        {
            IWindowEnumerator windowEnumerator = new WindowEnumerator();
            var windowList = windowEnumerator.GetWindowList();

            IDesktopWindowCollector videoDevice = new DesktopWindowCollector();

            videoDevice.SetWindowHandle(windowList.First().HWD);
            videoEncoder.SetVideoSource(videoDevice);

            var audioDevice = audioDeviceManager.GetAudioDeviceById(0);

            aacEncoder.SetAudioDataSource(audioDevice);

            Record record = new Record(videoEncoder, aacEncoder);

            record.StartRecord(@"windowcollecttest.mp4");
            Thread.Sleep(3000);
            record.StopRecord();
        }