Removed audio element from volume measuring demo.

This removes the possibility of feedback loops, which can happen if you
run this demo on an Android device.

BUG=
R=dutton@google.com

Review URL: https://webrtc-codereview.appspot.com/5589004

git-svn-id: http://webrtc.googlecode.com/svn/trunk@5258 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
hta@webrtc.org
2013-12-11 11:12:39 +00:00
parent 1133ffda4b
commit 26c40ba166

View File

@ -5,7 +5,6 @@
<title>Local Audio Rendering Demo</title> <title>Local Audio Rendering Demo</title>
<script type="text/javascript" src="../../base/adapter.js"></script> <script type="text/javascript" src="../../base/adapter.js"></script>
<script> <script>
var audioElement;
var buttonStart; var buttonStart;
var buttonStop; var buttonStop;
var localStream; var localStream;
@ -81,7 +80,6 @@
if (audioTracks.length == 1 && videoTracks.length == 0) { if (audioTracks.length == 1 && videoTracks.length == 0) {
console.log('gotStream({audio:true, video:false})'); console.log('gotStream({audio:true, video:false})');
console.log('Using audio device: ' + audioTracks[0].label); console.log('Using audio device: ' + audioTracks[0].label);
attachMediaStream(audioElement, stream);
stream.onended = function() { stream.onended = function() {
console.log('stream.onended'); console.log('stream.onended');
buttonStart.disabled = false; buttonStart.disabled = false;
@ -106,7 +104,7 @@
paintMeter(meter_clip, soundMeter.clip); paintMeter(meter_clip, soundMeter.clip);
}, 200); }, 200);
} else { } else {
alert('The media stream contains an invalid amount of tracks:' alert('The media stream contains an invalid number of tracks:'
+ audioTracks.length + ' audio ' + videoTracks.length + ' video'); + audioTracks.length + ' audio ' + videoTracks.length + ' video');
stream.stop(); stream.stop();
} }
@ -125,7 +123,6 @@
} catch(e) { } catch(e) {
alert('Web Audio API not found'); alert('Web Audio API not found');
} }
audioElement = $('audio');
buttonStart = $('start'); buttonStart = $('start');
buttonStop = $('stop'); buttonStop = $('stop');
buttonStart.enabled = true; buttonStart.enabled = true;
@ -158,7 +155,11 @@
and see the numbers change as you speak.</p> and see the numbers change as you speak.</p>
The "instant" volume changes approximately every 50 ms; the "slow" The "instant" volume changes approximately every 50 ms; the "slow"
volume approximates the average volume over about a second. volume approximates the average volume over about a second.
<audio id="audio" autoplay="autoplay" controls="controls"></audio><br><br> <br>
Note that you will NOT hear your own voice; use the
<a href="local-audio-rendering.html">local audio rendering demo</a>
for that.
<p>
<button id="start" onclick="start()">Start</button> <button id="start" onclick="start()">Start</button>
<button id="stop" onclick="stop()">Stop</button><br><br> <button id="stop" onclick="stop()">Stop</button><br><br>
Volume (instant): <span id="volume">Not set</span><br> Volume (instant): <span id="volume">Not set</span><br>