chrome.tabCapture

This API is experimental. It is only available to Chrome users on the dev channel.

chrome.tabCapture reference

Types

TabCaptureState

MediaStreamConstraint

Properties of MediaStreamConstraint

mandatory ( object )

Methods

capture

chrome.tabCapture.capture(object options, function callback)

Captures the visible area of the currently active tab. This method can only be used on the currently active page after the extension has been invoked, similar to the way that activeTab works. Note that Chrome internal pages cannot be captured.

Parameters

options ( object )
Configures the returned media stream.
audio ( optional boolean )
video ( optional boolean )
audioConstraints ( optional MediaStreamConstraint )
videoConstraints ( optional MediaStreamConstraint )
callback ( function )
Callback with either the stream returned or null.

Callback

The callback parameter should specify a function that looks like this:

function(localmediastream stream) {...};
stream ( localmediastream )

getCapturedTabs

chrome.tabCapture.getCapturedTabs(function callback)

Returns a list of tabs that have requested capture or are being captured, i.e. status != stopped and status != error. This allows extensions to inform the user that there is an existing tab capture that would prevent a new tab capture from succeeding (or to prevent redundant requests for the same tab).

Parameters

callback ( function )

Callback

The callback parameter should specify a function that looks like this:

function(array of object result) {...};
result ( array of object )

Events

onStatusChanged

chrome.tabCapture.onStatusChanged.addListener(function(object info) {...});

Event fired when the capture status of a tab changes. This allows extension authors to keep track of the capture status of tabs to keep UI elements like page actions and infobars in sync.

Listener Parameters

info ( object )
tabId ( integer )
The id of the tab whose status changed.
status ( TabCaptureState )
The new capture status of the tab.
fullscreen ( boolean )
Whether an element in the tab being captured is in fullscreen mode.