capture method
Captures the visible area of the currently active tab. Capture can only be started on the currently active tab after the extension has been invoked, similar to the way that activeTab works. Capture is maintained across page navigations within the tab, and stops when the tab is closed, or the media stream is closed by the extension.
|options| : Configures the returned media stream.
|callback| : Callback with either the tab capture MediaStream or
null
. null
indicates an error has occurred
and the client may query runtime.lastError
to access the error
details.
Implementation
Future<JSObject> capture(CaptureOptions options) {
var $completer = Completer<JSObject>();
$js.chrome.tabCapture.capture(
options.toJS,
(JSObject stream) {
if (checkRuntimeLastError($completer)) {
$completer.complete(stream);
}
}.toJS,
);
return $completer.future;
}