audioPage.html (1068B)
1 <html> 2 <head> 3 <title>Audio_Test_Page</title> 4 </head> 5 <body> 6 <p id="testContent">Page content: audio player</p> 7 8 <div class="audioPlayer"> 9 <audio id="audioSample" controls loop> 10 <source src="resources/audioSample.mp3" /> 11 </audio> 12 </div> 13 14 <div class="playbackState"></div> 15 16 <script> 17 const audio = document.querySelector("audio"); 18 var showPlayingAlert = true; 19 20 audio.addEventListener("playing", _event => { 21 <!--document.querySelector('.playbackState').innerText="Media file is playing"--> 22 <!--Need this hack to verify that the video is playing,--> 23 <!--the test cannot currently verify the text displayed on the page--> 24 if (showPlayingAlert === true) { 25 showPlayingAlert = false; 26 alert("Media file is playing"); 27 } 28 }); 29 30 audio.addEventListener("pause", _event => { 31 <!--document.querySelector('.playbackState').innerText="Media file is paused"--> 32 alert("Media file is paused"); 33 }); 34 </script> 35 </body> 36 </html>