2 Copyright 2013 The Chromium Authors. All rights reserved.
3 Use of this source code is governed by a BSD-style license that can be
4 found in the LICENSE file.
8 var extensionId = "knldjmfmopnpolahpmmgbagdohdnhkik";
10 function sendToBrowser(msg) {
11 domAutomationController.send(msg);
15 function requestStreamId(callback) {
16 function onResponse(response) {
17 if (chrome.runtime.lastError) {
25 chrome.runtime.sendMessage(
26 extensionId, ["getStream"], onResponse);
29 function getStream() {
30 function onStreamId(id) {
35 navigator.webkitGetUserMedia({
37 video: { mandatory: { chromeMediaSource: "desktop",
38 chromeMediaSourceId: id } }
39 }, sendToBrowser.bind(null, true), sendToBrowser.bind(null, false));
41 requestStreamId(onStreamId);
44 function getStreamWithInvalidId() {
45 function onStreamId(id) {
50 navigator.webkitGetUserMedia({
52 video: { mandatory: { chromeMediaSource: "desktop",
53 chromeMediaSourceId: id + "x" } }
54 }, sendToBrowser.bind(null, false), sendToBrowser.bind(null, true));
56 requestStreamId(onStreamId);