chrome.tabCapture
| Description: |
Use the chrome.tabCapture API to interact with tab media
streams.
|
| Availability: |
Since Chrome 31.
|
| Permissions: |
"tabCapture"
|
Summary
| Types | |
|---|---|
| CaptureInfo | |
| MediaStreamConstraint | |
| Methods | |
capture −
chrome.tabCapture.capture(object options, function callback)
| |
getCapturedTabs −
chrome.tabCapture.getCapturedTabs(function callback)
| |
| Events | |
| onStatusChanged | |
Types
CaptureInfo
| properties | ||
|---|---|---|
| integer | tabId |
The id of the tab whose status changed. |
enum of "pending", "active", "stopped", or "error" |
status |
The new capture status of the tab. |
| boolean | fullscreen |
Whether an element in the tab being captured is in fullscreen mode. |
MediaStreamConstraint
| properties | ||
|---|---|---|
| object | mandatory | |
| object | (optional) optional |
Since Chrome 32. |
Methods
capture
chrome.tabCapture.capture(object options, function callback)
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. 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.
| Parameters | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| object | options |
Configures the returned media stream.
|
||||||||||||
| function | callback |
Callback with either the tab capture stream or The callback parameter should be a function that looks like this: function(LocalMediaStream stream) {...};
|
||||||||||||
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 | |||||
|---|---|---|---|---|---|
| function | callback |
Callback invoked with CaptureInfo[] for captured tabs. The callback parameter should be a function that looks like this: function(array of CaptureInfo result) {...};
|
|||
Events
onStatusChanged
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 in sync.
addListener
chrome.tabCapture.onStatusChanged.addListener(function callback)
| Parameters | |||||
|---|---|---|---|---|---|
| function | callback |
The callback parameter should be a function that looks like this: function( CaptureInfo info) {...};
|
|||