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 * Keeps track of our local stream (e.g. what our local webcam is streaming). | 8 * Keeps track of our local stream (e.g. what our local webcam is streaming). |
9 * @private | 9 * @private |
10 */ | 10 */ |
(...skipping 19 matching lines...) Expand all Loading... | |
30 } | 30 } |
31 | 31 |
32 debug("Requesting webcam and microphone."); | 32 debug("Requesting webcam and microphone."); |
33 navigator.webkitGetUserMedia({video: requestVideo, audio: requestAudio}, | 33 navigator.webkitGetUserMedia({video: requestVideo, audio: requestAudio}, |
34 getUserMediaOkCallback, | 34 getUserMediaOkCallback, |
35 getUserMediaFailedCallback); | 35 getUserMediaFailedCallback); |
36 returnToPyAuto('ok-requested'); | 36 returnToPyAuto('ok-requested'); |
37 } | 37 } |
38 | 38 |
39 /** | 39 /** |
40 * This function cancel the GetUserMedia request by reloading the web page. | |
41 */ | |
phoglund_chromium
2012/07/04 14:20:58
I think it makes more sense to call this guy Reloa
no longer working on chromium
2012/07/05 14:05:19
Done.
| |
42 function CancelGetUserMediaRequest() { | |
43 location.reload(); | |
44 | |
phoglund_chromium
2012/07/04 14:20:58
Reloading page
no longer working on chromium
2012/07/05 14:05:19
Done.
| |
45 debug("Cancelling GetUserMedia request."); | |
phoglund_chromium
2012/07/04 14:20:58
ok-reloaded-page
no longer working on chromium
2012/07/05 14:05:19
Done.
| |
46 returnToPyAuto('ok-calceled-request'); | |
47 } | |
48 | |
49 /** | |
40 * Must be called after calling getUserMedia. Returns not-called-yet if we have | 50 * Must be called after calling getUserMedia. Returns not-called-yet if we have |
41 * not yet been called back by WebRTC. Otherwise it returns either ok-got-stream | 51 * not yet been called back by WebRTC. Otherwise it returns either ok-got-stream |
42 * or failed-with-error-x (where x is the error code from the error callback) | 52 * or failed-with-error-x (where x is the error code from the error callback) |
43 * depending on which callback got called by WebRTC. | 53 * depending on which callback got called by WebRTC. |
44 */ | 54 */ |
45 function obtainGetUserMediaResult() { | 55 function obtainGetUserMediaResult() { |
46 returnToPyAuto(gRequestWebcamAndMicrophoneResult); | 56 returnToPyAuto(gRequestWebcamAndMicrophoneResult); |
47 } | 57 } |
48 | 58 |
49 | 59 |
(...skipping 15 matching lines...) Expand all Loading... | |
65 | 75 |
66 function getUserMediaOkCallback(stream) { | 76 function getUserMediaOkCallback(stream) { |
67 gLocalStream = stream; | 77 gLocalStream = stream; |
68 var streamUrl = webkitURL.createObjectURL(stream); | 78 var streamUrl = webkitURL.createObjectURL(stream); |
69 document.getElementById("local_view").src = streamUrl; | 79 document.getElementById("local_view").src = streamUrl; |
70 | 80 |
71 gRequestWebcamAndMicrophoneResult = 'ok-got-stream'; | 81 gRequestWebcamAndMicrophoneResult = 'ok-got-stream'; |
72 } | 82 } |
73 | 83 |
74 function getUserMediaFailedCallback(error) { | 84 function getUserMediaFailedCallback(error) { |
75 gRequestWebcamAndMicrophoneResult = 'failed-with-error-' + error.code; | 85 gRequestWebcamAndMicrophoneResult = 'failed-with-error-' + error.code; |
phoglund_chromium
2012/07/04 14:20:58
Not sure what happened on this line?
no longer working on chromium
2012/07/05 14:05:19
Not sure, it does not change anything in my editor
| |
76 } | 86 } |
OLD | NEW |