Method StartCapture
- Namespace
- DotNetBrowser.Media
- Assembly
- DotNetBrowser.dll
StartCapture()
Starts capturing the audio of the browser with the default options.
IAudioCaptureSession StartCapture()
Returns
- IAudioCaptureSession
The started capture session.
Exceptions
- InvalidOperationException
Another capture session of this browser is active.
- ObjectDisposedException
The IAudio has already been disposed.
- ConnectionClosedException
The connection to the Chromium engine is closed.
- See Also
StartCapture(AudioCaptureOptions)
Starts capturing the audio of the browser.
IAudioCaptureSession StartCapture(AudioCaptureOptions options)
Parameters
optionsAudioCaptureOptionsThe options of the capture session. The session keeps a copy of them.
Returns
- IAudioCaptureSession
The started capture session.
Remarks
The session captures all audio the browser plays, including silence when nothing plays.
Muting the browser with Muted does not affect the captured audio. The captured
audio is silent when Chromium runs with the --mute-audio switch.
While the session is active, Chromium treats the browser as visible, so the page is not
throttled and its document.visibilityState is visible, and it keeps the display
from going to sleep.
The buffers captured before a DataCaptured handler is added are not delivered to it. To receive the audio from its beginning, add the handlers to the returned session before the page starts playing.
A browser can have only one active capture session. Stop it before starting a new one.
If the capture fails right after it starts, before the returned session can report the failure, the returned session is already disposed. Check IsDisposed or IsActive if you need to know that the capture is running.
Exceptions
- ArgumentNullException
optionsisnull.- ArgumentException
A buffer described by
optionsis shorter than 10 or longer than 500 milliseconds, or the options are not supported.- InvalidOperationException
Another capture session of this browser is active.
- ObjectDisposedException
The IAudio has already been disposed.
- ConnectionClosedException
The connection to the Chromium engine is closed.