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> |
elham@webrtc.org | 90eb5c8 | 2013-03-05 19:53:01 +0000 | [diff] [blame] | 14 | <meta http-equiv="X-UA-Compatible" content="chrome=1"/> |
| 15 | <!-- Load the polyfill to switch-hit between Chrome and Firefox --> |
| 16 | <script src="adapter.js"></script> |
phoglund@webrtc.org | f1d6e0a | 2012-06-04 10:06:52 +0000 | [diff] [blame] | 17 | <script type="text/javascript"> |
| 18 | function requestVideo(target) { |
elham@webrtc.org | 90eb5c8 | 2013-03-05 19:53:01 +0000 | [diff] [blame] | 19 | // Call into getUserMedia via the polyfill (adapter.js). |
| 20 | getUserMedia({video: true, audio: false}, |
| 21 | function(stream) { |
| 22 | getUserMediaOkCallback(stream, target); |
| 23 | }, |
| 24 | getUserMediaFailedCallback); |
phoglund@webrtc.org | f1d6e0a | 2012-06-04 10:06:52 +0000 | [diff] [blame] | 25 | } |
| 26 | |
| 27 | function getUserMediaFailedCallback(error) { |
| 28 | alert("User media request denied with error code " + error.code); |
| 29 | } |
| 30 | |
| 31 | function getUserMediaOkCallback(stream, target) { |
elham@webrtc.org | 90eb5c8 | 2013-03-05 19:53:01 +0000 | [diff] [blame] | 32 | // Call the polyfill wrapper to attach the media stream to this element. |
| 33 | attachMediaStream(document.getElementById("view1"), stream); |
| 34 | attachMediaStream(document.getElementById("view2"), stream); |
phoglund@webrtc.org | f1d6e0a | 2012-06-04 10:06:52 +0000 | [diff] [blame] | 35 | } |
| 36 | </script> |
| 37 | </head> |
| 38 | <body onload="requestVideo('view1'); requestVideo('view2');"> |
| 39 | <table border="0"> |
| 40 | <tr> |
| 41 | <td>Local Preview</td> |
| 42 | </tr> |
| 43 | <tr> |
| 44 | <td><video width="320" height="240" id="view1" |
| 45 | autoplay="autoplay"></video></td> |
| 46 | <td><video width="320" height="240" id="view2" |
| 47 | autoplay="autoplay"></video></td> |
| 48 | </tr> |
| 49 | </table> |
| 50 | </body> |
| 51 | </html> |