Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(338)

Side by Side Diff: trunk/src/chrome/test/data/webrtc/manual/constraints.js

Issue 22840006: Revert 217770 "Landing https://codereview.chromium.org/18769010/." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /** 1 /**
2 * Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 * Copyright (c) 2012 The Chromium Authors. All rights reserved.
3 * Use of this source code is governed by a BSD-style license that can be 3 * Use of this source code is governed by a BSD-style license that can be
4 * found in the LICENSE file. 4 * found in the LICENSE file.
5 */ 5 */
6 6
7 /** 7 /**
8 * See http://dev.w3.org/2011/webrtc/editor/getusermedia.html for more 8 * See http://dev.w3.org/2011/webrtc/editor/getusermedia.html for more
9 * information on getUserMedia. 9 * information on getUserMedia.
10 */ 10 */
11 11
12 /** 12 /**
13 * Asks permission to use the webcam and mic from the browser. 13 * Asks permission to use the webcam and mic from the browser.
14 */ 14 */
15 function doGetUserMedia() { 15 function getUserMedia() {
16 // Call into getUserMedia via the polyfill (adapter.js).
17 var constraints = getConstraints_(); 16 var constraints = getConstraints_();
18 var constraintsString = JSON.stringify(constraints, null, ' '); 17 var constraintsString = JSON.stringify(constraints, null, ' ');
19 $('getusermedia-constraints').innerHTML = constraintsString; 18 $('getusermedia-constraints').innerHTML = constraintsString;
20 if (!getUserMedia) { 19 if (!navigator.webkitGetUserMedia) {
21 log_('Browser does not support WebRTC.'); 20 log_('Browser does not support WebRTC.');
22 return; 21 return;
23 } 22 }
24 log_('Requesting getUserMedia with constraints: ' + constraintsString); 23 log_('Requesting getUserMedia with constraints: ' + constraintsString);
25 getUserMedia(constraints, getUserMediaOkCallback_, 24 navigator.webkitGetUserMedia(constraints,
26 getUserMediaFailedCallback_); 25 getUserMediaOkCallback_,
26 getUserMediaFailedCallback_);
27 } 27 }
28 28
29 // Internals 29 // Internals
30 30
31 /** 31 /**
32 * Builds a Javascript constraints dictionary out of the selected options in the 32 * Builds a Javascript constraints dictionary out of the selected options in the
33 * HTML controls on the page. 33 * HTML controls on the page.
34 * @private 34 * @private
35 * @return {Object} A dictionary of constraints. 35 * @return {Object} A dictionary of constraints.
36 */ 36 */
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 return c; 97 return c;
98 } 98 }
99 99
100 /** 100 /**
101 * @private 101 * @private
102 * @param {MediaStream} stream Media stream. 102 * @param {MediaStream} stream Media stream.
103 */ 103 */
104 function getUserMediaOkCallback_(stream) { 104 function getUserMediaOkCallback_(stream) {
105 gLocalStream = stream; 105 gLocalStream = stream;
106 var videoTag = $('local-view'); 106 var videoTag = $('local-view');
107 attachMediaStream(videoTag, stream); 107 videoTag.src = webkitURL.createObjectURL(stream);
108 108
109 // Due to crbug.com/110938 the size is 0 when onloadedmetadata fires. 109 // Due to crbug.com/110938 the size is 0 when onloadedmetadata fires.
110 // videoTag.onloadedmetadata = updateVideoTagSize_(videoTag); 110 // videoTag.onloadedmetadata = updateVideoTagSize_(videoTag);
111 // Use setTimeout as a workaround for now. 111 // Use setTimeout as a workaround for now.
112 setTimeout(function() {updateVideoTagSize_(videoTag)}, 500); 112 setTimeout(function() {updateVideoTagSize_(videoTag)}, 500);
113 gRequestWebcamAndMicrophoneResult = 'ok-got-stream'; 113 gRequestWebcamAndMicrophoneResult = 'ok-got-stream';
114 } 114 }
115 115
116 /** 116 /**
117 * @private 117 * @private
(...skipping 23 matching lines...) Expand all
141 141
142 /** 142 /**
143 * Simple logging function. 143 * Simple logging function.
144 * @private 144 * @private
145 * @param {string} message Message to print. 145 * @param {string} message Message to print.
146 */ 146 */
147 function log_(message) { 147 function log_(message) {
148 console.log(message); 148 console.log(message);
149 $('messages').innerHTML += message + '<br>'; 149 $('messages').innerHTML += message + '<br>';
150 } 150 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698