Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /** | 1 /** |
| 2 * Copyright 2014 The Chromium Authors. All rights reserved. | 2 * Copyright 2014 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. See | 9 * information on getUserMedia. See |
| 10 * http://dev.w3.org/2011/webrtc/editor/webrtc.html for more information on | 10 * http://dev.w3.org/2011/webrtc/editor/webrtc.html for more information on |
| (...skipping 898 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 909 print_(gRequestWebcamAndMicrophoneResult); | 909 print_(gRequestWebcamAndMicrophoneResult); |
| 910 } | 910 } |
| 911 | 911 |
| 912 /** @private */ | 912 /** @private */ |
| 913 function success_(method) { | 913 function success_(method) { |
| 914 $('messages').innerHTML += '<span style="color:green;">' + method + | 914 $('messages').innerHTML += '<span style="color:green;">' + method + |
| 915 '(): success. </span><br>'; | 915 '(): success. </span><br>'; |
| 916 } | 916 } |
| 917 | 917 |
| 918 /** @private */ | 918 /** @private */ |
| 919 function warning_(message) { | |
|
mcasas
2014/08/21 10:53:17
It seems that there are:
- function print_(message
| |
| 920 $('debug').innerHTML += '<span style="color:orange;">' + message + | |
| 921 '</span><br>'; | |
| 922 } | |
| 923 | |
| 924 /** @private */ | |
| 919 function failure_(method, error) { | 925 function failure_(method, error) { |
| 920 error_(method + '() failed: ' + JSON.stringify(error)); | 926 error_(method + '() failed: ' + JSON.stringify(error)); |
| 921 } | 927 } |
| 922 | 928 |
| 923 /** @private */ | 929 /** @private */ |
| 924 function iceCallback_(event) { | 930 function iceCallback_(event) { |
| 925 if (event.candidate) | 931 if (event.candidate) |
| 926 sendToPeer(global.remotePeerId, JSON.stringify(event.candidate)); | 932 sendToPeer(global.remotePeerId, JSON.stringify(event.candidate)); |
| 927 } | 933 } |
| 928 | 934 |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1000 window.addEventListener('loadedmetadata', function() { | 1006 window.addEventListener('loadedmetadata', function() { |
| 1001 displayVideoSize_(videoTag);}, true); | 1007 displayVideoSize_(videoTag);}, true); |
| 1002 | 1008 |
| 1003 // Throw an error when no video is sent from camera but gUM returns OK. | 1009 // Throw an error when no video is sent from camera but gUM returns OK. |
| 1004 stream.getVideoTracks()[0].onended = function() { | 1010 stream.getVideoTracks()[0].onended = function() { |
| 1005 error_(global.localStream + ' getUserMedia successful but ' + | 1011 error_(global.localStream + ' getUserMedia successful but ' + |
| 1006 'MediaStreamTrack.onended event fired, no frames from camera.'); | 1012 'MediaStreamTrack.onended event fired, no frames from camera.'); |
| 1007 }; | 1013 }; |
| 1008 | 1014 |
| 1009 // Print information on track going to mute or back from it. | 1015 // Print information on track going to mute or back from it. |
| 1010 // TODO(mcasas): add a warning_() function and move the following print_() | |
| 1011 // notifications to error_() and warning_(), respectively. | |
| 1012 stream.getVideoTracks()[0].onmute = function() { | 1016 stream.getVideoTracks()[0].onmute = function() { |
| 1013 print_(global.localStream + ' track onmute event has fired'); | 1017 error_(global.localStream + ' MediaStreamTrack.onmute event has fired, ' + |
| 1018 'no frames to the track.'); | |
| 1014 }; | 1019 }; |
| 1015 stream.getVideoTracks()[0].onunmute = function() { | 1020 stream.getVideoTracks()[0].onunmute = function() { |
| 1016 print_(global.localStream + ' track onunmute event has fired'); | 1021 warning_(global.localStream + ' MediaStreamTrack.onunmute event has ' + |
| 1022 'fired.'); | |
| 1017 }; | 1023 }; |
| 1018 } | 1024 } |
| 1019 } | 1025 } |
| 1020 | 1026 |
| 1021 /** | 1027 /** |
| 1022 * @private | 1028 * @private |
| 1023 * @param {string} videoTag The ID of the video tag + stream used to | 1029 * @param {string} videoTag The ID of the video tag + stream used to |
| 1024 * write the size to a HTML tag based on id if the div's exists. | 1030 * write the size to a HTML tag based on id if the div's exists. |
| 1025 */ | 1031 */ |
| 1026 function displayVideoSize_(videoTag) { | 1032 function displayVideoSize_(videoTag) { |
| (...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1401 | 1407 |
| 1402 /** @private */ | 1408 /** @private */ |
| 1403 function readResponseHeader_(request, key) { | 1409 function readResponseHeader_(request, key) { |
| 1404 var value = request.getResponseHeader(key); | 1410 var value = request.getResponseHeader(key); |
| 1405 if (value == null || value.length == 0) { | 1411 if (value == null || value.length == 0) { |
| 1406 error_('Received empty value ' + value + | 1412 error_('Received empty value ' + value + |
| 1407 ' for response header key ' + key + '.'); | 1413 ' for response header key ' + key + '.'); |
| 1408 } | 1414 } |
| 1409 return parseInt(value); | 1415 return parseInt(value); |
| 1410 } | 1416 } |
| OLD | NEW |