1 <!-- This is a test html file for audio test. --> 2 <html> 3 <body> 4 <audio id='testaudio' controls> 5 </audio> 6 </body> 7 8 <script type="text/javascript"> 9 var corruption = false; 10 var testaudio = document.getElementById('testaudio'); 11 12 function loadSourceAndRunCorruptionTest(audio) { 13 // Listen to the error event for playing corrupted audio. 14 testaudio.addEventListener("error", function() { corruption = true; }); 15 16 testaudio.src = audio; 17 testaudio.play(); 18 } 19 20 function corruptionDetected() { 21 return corruption; 22 } 23 </script> 24 </html> 25