OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 // Custom bindings for the Tab Capture API. | |
6 var chromeHidden = requireNative('chrome_hidden').GetChromeHidden(); | |
7 | |
8 chromeHidden.registerCustomHook('tabCapture', | |
9 function(bindingsAPI, extensionId) { | |
10 var apiFunctions = bindingsAPI.apiFunctions; | |
11 | |
12 apiFunctions.setCustomCallback('capture', | |
13 function(name, request, response) { | |
14 if (response && request.callback) { | |
15 var callback = request.callback; | |
16 var successFunc = function(stream) { | |
17 callback(stream); | |
18 }; | |
19 var errorFunc = function() { | |
20 callback(null); | |
21 }; | |
22 | |
23 var options = {}; | |
24 options.video = response.videoConstraints; | |
25 options.audio = response.audioConstraints; | |
26 | |
27 navigator.webkitGetUserMedia(options, successFunc, errorFunc); | |
Aaron Boodman
2012/10/16 04:19:27
Silly question: Does the implementation of webKitG
justinlin
2012/10/17 08:32:26
I think you're right. Unfortunately, I've thought
Aaron Boodman
2012/10/17 20:28:14
If this is going to ever be exposed without the fl
justinlin
2012/10/17 23:41:48
My PM (markdavidscott@) might have a better answer
| |
28 } else { | |
29 request.callback(); | |
30 } | |
31 request.callback = null; | |
32 }); | |
33 }); | |
OLD | NEW |