Exemple #1
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 bool SetAudioDeviceById(int id)
        {
            if (_useAudioDevice.ID == id)
            {
                return(true);
            }
            var audioDevice = _audioDeviceManager.GetAudioDeviceById(id);

            if (audioDevice == null)
            {
                return(false);
            }
            _useAudioDevice = audioDevice;
            return(_aacEncoder.SetAudioDataSource(_useAudioDevice));
        }
 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;
 }
Exemple #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();
        }