OLD | NEW |
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 */ |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 } | 71 } |
72 | 72 |
73 /** | 73 /** |
74 * Must be called after calling doGetUserMedia. | 74 * Must be called after calling doGetUserMedia. |
75 * @return {string} Returns not-called-yet if we have not yet been called back | 75 * @return {string} Returns not-called-yet if we have not yet been called back |
76 * by WebRTC. Otherwise it returns either ok-got-stream or | 76 * by WebRTC. Otherwise it returns either ok-got-stream or |
77 * failed-with-error-x (where x is the error code from the error | 77 * failed-with-error-x (where x is the error code from the error |
78 * callback) depending on which callback got called by WebRTC. | 78 * callback) depending on which callback got called by WebRTC. |
79 */ | 79 */ |
80 function obtainGetUserMediaResult() { | 80 function obtainGetUserMediaResult() { |
81 // Translate from the old error to the new. Remove when rename fully deployed. | |
82 if (gRequestWebcamAndMicrophoneResult === 'PERMISSION_DENIED') | |
83 gRequestWebcamAndMicrophoneResult = 'PermissionDeniedError'; | |
84 | |
85 returnToTest(gRequestWebcamAndMicrophoneResult); | 81 returnToTest(gRequestWebcamAndMicrophoneResult); |
86 return gRequestWebcamAndMicrophoneResult; | 82 return gRequestWebcamAndMicrophoneResult; |
87 } | 83 } |
88 | 84 |
89 /** | 85 /** |
90 * Stops the local stream. | 86 * Stops the local stream. |
91 */ | 87 */ |
92 function stopLocalStream() { | 88 function stopLocalStream() { |
93 if (gLocalStream == null) | 89 if (gLocalStream == null) |
94 throw failTest('Tried to stop local stream, ' + | 90 throw failTest('Tried to stop local stream, ' + |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
319 return source; | 315 return source; |
320 } | 316 } |
321 | 317 |
322 /** | 318 /** |
323 * @private | 319 * @private |
324 * @param {NavigatorUserMediaError} error Error containing details. | 320 * @param {NavigatorUserMediaError} error Error containing details. |
325 */ | 321 */ |
326 function getUserMediaFailedCallback_(error) { | 322 function getUserMediaFailedCallback_(error) { |
327 // Translate from the old error to the new. Remove when rename fully deployed. | 323 // Translate from the old error to the new. Remove when rename fully deployed. |
328 var errorName = error.name; | 324 var errorName = error.name; |
329 if (errorName === 'PERMISSION_DENIED') | |
330 errorName = 'PermissionDeniedError'; | |
331 | 325 |
332 debug('GetUserMedia FAILED: Maybe the camera is in use by another process?'); | 326 debug('GetUserMedia FAILED: Maybe the camera is in use by another process?'); |
333 gRequestWebcamAndMicrophoneResult = 'failed-with-error-' + errorName; | 327 gRequestWebcamAndMicrophoneResult = 'failed-with-error-' + errorName; |
334 debug(gRequestWebcamAndMicrophoneResult); | 328 debug(gRequestWebcamAndMicrophoneResult); |
335 } | 329 } |
OLD | NEW |