| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <html> | 2 <html> |
| 3 <!-- | 3 <!-- |
| 4 Copyright (c) 2012 The Chromium Authors. All rights reserved. | 4 Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 5 Use of this source code is governed by a BSD-style license that can be | 5 Use of this source code is governed by a BSD-style license that can be |
| 6 found in the LICENSE file. | 6 found in the LICENSE file. |
| 7 --> | 7 --> |
| 8 <head> | 8 <head> |
| 9 <title>Audio Input Example</title> | 9 <title>Audio Input Example</title> |
| 10 <script type="text/javascript"> | 10 <script type="text/javascript"> |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 function UseDevice(display_text, command) { | 50 function UseDevice(display_text, command) { |
| 51 var in_use_device = document.getElementById('in_use_device'); | 51 var in_use_device = document.getElementById('in_use_device'); |
| 52 in_use_device.innerText = display_text; | 52 in_use_device.innerText = display_text; |
| 53 var plugin = document.getElementById('plugin'); | 53 var plugin = document.getElementById('plugin'); |
| 54 plugin.postMessage(command); | 54 plugin.postMessage(command); |
| 55 | 55 |
| 56 var available_devices = document.getElementById('available_devices'); | 56 var available_devices = document.getElementById('available_devices'); |
| 57 available_devices.parentNode.removeChild(available_devices); | 57 available_devices.parentNode.removeChild(available_devices); |
| 58 | 58 |
| 59 var control_panel = document.getElementById('control_panel'); | 59 var control_panel = document.getElementById('control_panel'); |
| 60 var link = document.createElement('a'); | 60 control_panel.style.display = 'block'; |
| 61 link.href = 'javascript:Stop();'; | |
| 62 link.innerText = 'Stop'; | |
| 63 control_panel.appendChild(link); | |
| 64 } | 61 } |
| 65 | 62 |
| 66 function Stop() { | 63 function Stop() { |
| 67 var plugin = document.getElementById('plugin'); | 64 var plugin = document.getElementById('plugin'); |
| 68 plugin.postMessage('Stop'); | 65 plugin.postMessage('Stop'); |
| 69 } | 66 } |
| 70 | 67 |
| 68 function Start() { |
| 69 var plugin = document.getElementById('plugin'); |
| 70 plugin.postMessage('Start'); |
| 71 } |
| 72 |
| 71 function Initialize() { | 73 function Initialize() { |
| 72 var plugin = document.getElementById('plugin'); | 74 var plugin = document.getElementById('plugin'); |
| 73 plugin.addEventListener('message', HandleMessage, false); | 75 plugin.addEventListener('message', HandleMessage, false); |
| 74 plugin.postMessage('PageInitialized'); | 76 plugin.postMessage('PageInitialized'); |
| 75 } | 77 } |
| 76 | 78 |
| 77 document.addEventListener('DOMContentLoaded', Initialize, false); | 79 document.addEventListener('DOMContentLoaded', Initialize, false); |
| 78 </script> | 80 </script> |
| 79 </head> | 81 </head> |
| 80 | 82 |
| 81 <body> | 83 <body> |
| 82 <embed id="plugin" type="application/x-ppapi-example-audio-input" | 84 <embed id="plugin" type="application/x-ppapi-example-audio-input" |
| 83 width="800" height="400"/> | 85 width="800" height="400"/> |
| 84 <div style="margin-bottom:10px">In-use device: | 86 <div style="margin-bottom:10px">In-use device: |
| 85 <span id="in_use_device" style="font-weight:bold">None</span> | 87 <span id="in_use_device" style="font-weight:bold">None</span> |
| 86 </div> | 88 </div> |
| 87 <div id="available_devices"> | 89 <div id="available_devices"> |
| 88 Available device(s), choose one to open: | 90 Available device(s), choose one to open: |
| 89 <ul id="device_list"> | 91 <ul id="device_list"> |
| 90 <li><a href="javascript:UseDefaultDevice(true);"> | 92 <li><a href="javascript:UseDefaultDevice(true);"> |
| 91 Default - use interface version 0.1</a></li> | 93 Default - use interface version 0.1</a></li> |
| 92 <li><a href="javascript:UseDefaultDevice(false);"> | 94 <li><a href="javascript:UseDefaultDevice(false);"> |
| 93 Default - use interface version 0.2 and NULL device ref</a></li> | 95 Default - use interface version 0.2 and NULL device ref</a></li> |
| 94 </ul> | 96 </ul> |
| 95 </div> | 97 </div> |
| 96 <div id="control_panel"></div> | 98 <div id="control_panel" style="display:none"> |
| 99 <a href="javascript:Stop();">Stop</a> |
| 100 <a href="javascript:Start();">Start</a> |
| 101 </div> |
| 97 <div id="status"></div> | 102 <div id="status"></div> |
| 98 </body> | 103 </body> |
| 99 </html> | 104 </html> |
| OLD | NEW |