// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
[
{
"namespace": "desktopCapture",
"description": "Desktop Capture API that can be used to capture content of screen, individual windows or tabs.",
"types": [
{
"id": "DesktopCaptureSourceType",
"type": "string",
"enum": ["screen", "window", "tab", "audio"],
"description": "Enum used to define set of desktop media sources used in chooseDesktopMedia()."
}
],
"functions": [
{
"name": "chooseDesktopMedia",
"type": "function",
"description": "Shows desktop media picker UI with the specified set of sources.",
"parameters": [
{
"type": "array",
"items": { "$ref": "DesktopCaptureSourceType" },
"name": "sources",
"description": "Set of sources that should be shown to the user. The sources order in the set decides the tab order in the picker."
},
{
"$ref": "tabs.Tab",
"name": "targetTab",
"optional": true,
"description": "Optional tab for which the stream is created. If not specified then the resulting stream can be used only by the calling extension. The stream can only be used by frames in the given tab whose security origin matches tab.url
. The tab's origin must be a secure origin, e.g. HTTPS."
},
{
"type": "function",
"name": "callback",
"parameters": [
{
"name": "streamId",
"type": "string",
"description": "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
. The created streamId
can be used only once and expires after a few seconds when it is not used."
},
{
"name": "options",
"type": "object",
"description": "Contains properties that describe the stream.",
"properties": {
"canRequestAudioTrack": {
"type": "boolean",
"description": "True if \"audio\" is included in parameter sources, and the end user does not uncheck the \"Share audio\" checkbox. Otherwise false, and in this case, one should not ask for audio stream through getUserMedia call."
}
}
}
]
}
],
"returns": {
"type": "integer",
"description": "An id that can be passed to cancelChooseDesktopMedia() in case the prompt need to be canceled."
}
},
{
"name": "cancelChooseDesktopMedia",
"type": "function",
"description": "Hides desktop media picker dialog shown by chooseDesktopMedia().",
"parameters": [
{
"name": "desktopMediaRequestId",
"type": "integer",
"description": "Id returned by chooseDesktopMedia()"
}
]
}
]
}
]