This API is in beta. It is only available to Chrome users on the beta channel and dev channel.

chrome.desktopCapture

Description: Desktop Capture API that can be used to capture content of screen, individual windows or tabs.
Availability: Beta and dev channels only.
Permissions: "desktopCapture"

Summary

Types
DesktopCaptureSourceType
Methods
chooseDesktopMedia integer chrome.desktopCapture.chooseDesktopMedia(array of DesktopCaptureSourceType sources, tabs.Tab targetTab, function callback)
cancelChooseDesktopMedia chrome.desktopCapture.cancelChooseDesktopMedia(integer desktopMediaRequestId)

Types

DesktopCaptureSourceType

Enum used to define set of desktop media sources used in chooseDesktopMedia().
Enum
"screen", "window", or "tab"

Methods

chooseDesktopMedia

integer chrome.desktopCapture.chooseDesktopMedia(array of DesktopCaptureSourceType sources, tabs.Tab targetTab, function callback)

Shows desktop media picker UI with the specified set of sources.

Parameters
array of DesktopCaptureSourceType sources Set of sources that should be shown to the user.
tabs.Tab (optional) targetTab Optional tab for which the stream is created. If not specified then the resulting stream can be used only by the calling extension, otherwise the stream can be used only by the specified tab. If the tab's security origin changes before this function returns, the call may fail.
function callback

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

function(string streamId) {...};
string streamId An opaque string that can be passed to getUserMedia() API to generate media stream that corresponds to the source selected by the user. If user didn't select any source (i.e. canceled the prompt) then the callback is called with an empty streamId

cancelChooseDesktopMedia

chrome.desktopCapture.cancelChooseDesktopMedia(integer desktopMediaRequestId)

Hides desktop media picker dialog shown by chooseDesktopMedia().

Parameters
integer desktopMediaRequestId Id returned by chooseDesktopMedia()