phoglund@webrtc.org | f1d6e0a | 2012-06-04 10:06:52 +0000 | [diff] [blame^] | 1 | <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> |
| 2 | <!-- |
| 3 | Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
| 4 | |
| 5 | Use of this source code is governed by a BSD-style license |
| 6 | that can be found in the LICENSE file in the root of the source |
| 7 | tree. An additional intellectual property rights grant can be found |
| 8 | in the file PATENTS. All contributing project authors may |
| 9 | be found in the AUTHORS file in the root of the source tree. |
| 10 | --> |
| 11 | <html> |
| 12 | <head> |
| 13 | <title>Single Local Preview (Video Only)</title> |
| 14 | <script type="text/javascript"> |
| 15 | function requestVideo(target) { |
| 16 | navigator.webkitGetUserMedia({video: true, audio: false}, |
| 17 | function(stream) { |
| 18 | getUserMediaOkCallback(stream, target); |
| 19 | }, |
| 20 | getUserMediaFailedCallback); |
| 21 | } |
| 22 | |
| 23 | function getUserMediaFailedCallback(error) { |
| 24 | alert("User media request denied with error code " + error.code); |
| 25 | } |
| 26 | |
| 27 | function getUserMediaOkCallback(stream, target) { |
| 28 | var streamUrl = webkitURL.createObjectURL(stream); |
| 29 | document.getElementById(target).src = streamUrl; |
| 30 | } |
| 31 | </script> |
| 32 | </head> |
| 33 | <body onload="requestVideo('view1'); requestVideo('view2');"> |
| 34 | <table border="0"> |
| 35 | <tr> |
| 36 | <td>Local Preview</td> |
| 37 | </tr> |
| 38 | <tr> |
| 39 | <td><video width="320" height="240" id="view1" |
| 40 | autoplay="autoplay"></video></td> |
| 41 | <td><video width="320" height="240" id="view2" |
| 42 | autoplay="autoplay"></video></td> |
| 43 | </tr> |
| 44 | </table> |
| 45 | </body> |
| 46 | </html> |