Upstream version 5.34.104.0
[platform/framework/web/crosswalk.git] / src / ppapi / examples / media_stream_audio / media_stream_audio.html
1 <!DOCTYPE html>
2 <html>
3   <!--
4   Copyright 2014 The Chromium Authors. All rights reserved.
5   Use of this source code is governed by a BSD-style license that can be
6   found in the LICENSE file.
7   -->
8 <head>
9   <title>Media Stream Audio Example</title>
10   <script type="text/javascript">
11     var plugin;
12     var stream;
13
14     function handleMessage(message) {
15       console.log(message);
16     }
17
18     function success(s) {
19       stream = s;
20       plugin.postMessage({track: stream.getAudioTracks()[0]});
21     }
22
23     function failure(e) {
24       console.log(e);
25     }
26
27     function initialize() {
28       plugin = document.getElementById('plugin');
29       plugin.addEventListener('message', handleMessage, false);
30       navigator.webkitGetUserMedia({ 'audio': true }, success, failure);
31     }
32
33     document.addEventListener('DOMContentLoaded', initialize, false);
34   </script>
35 </head>
36
37 <body>
38   <h1>Pepper MediaStream Audio API Example</h1><br>
39   This example demonstrates receiving frames from an audio MediaStreamTrack and
40   rendering them in a plugin.<br>
41   <embed id="plugin" type="application/x-ppapi-example-media-stream-audio"
42       width="320" height="240"/>
43 </body>
44 </html>