Javascript examples for DOM HTML Element:Audio
The networkState property returns the current network activity of the audio.
Type | Description |
---|---|
Number | Represents the current network state of the audio element: |
The following code shows how to get the current network state of the audio:
<!DOCTYPE html> <html> <body> <audio id="myAudio" controls autoplay> <source src="your.ogg" type="audio/ogg"> <source src="your.mp3" type="audio/mpeg"> Your browser does not support the audio element. </audio>/*from ww w. j a v a2 s .co m*/ <button onclick="myFunction()">Test</button> <p id="demo"></p> <script> function myFunction() { var x = document.getElementById("myAudio").networkState; document.getElementById("demo").innerHTML = x; } </script> </body> </html>