• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 and Audio)</title>
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>
17  <script type="text/javascript">
18  function requestVideoAndAudio() {
19    // Call into getUserMedia via the polyfill (adapter.js).
20    getUserMedia({video: true, audio: true},
21                         getUserMediaOkCallback,
22                         getUserMediaFailedCallback);
23  }
24
25  function getUserMediaFailedCallback(error) {
26    alert("User media request denied with error code " + error.code);
27  }
28
29  function getUserMediaOkCallback(stream) {
30    attachMediaStream(document.getElementById("view1"), stream);
31    attachMediaStream(document.getElementById("audio1"), stream);
32  }
33  </script>
34</head>
35<body onload="requestVideoAndAudio();">
36  <table border="0">
37    <tr>
38      <td>Local Preview</td>
39    </tr>
40    <tr>
41      <td><video width="320" height="240" id="view1"
42          autoplay="autoplay"></video></td>
43      <td><audio id="audio1" autoplay="autoplay"></audio></td>
44    </tr>
45  </table>
46</body>
47</html>
48