Javascript examples for DOM HTML Element:Video
Video src Property - Get the URL of a video:
<!DOCTYPE html> <html> <body> <video id="myVideo" controls src="your.ogg"> Your browser does not support the video tag. </video>/*from ww w. ja v a2 s.c o m*/ <button onclick="myFunction()">Test</button> <p id="demo"></p> <script> var x = document.getElementById("myVideo"); function myFunction() { isSupp = x.canPlayType("video/mp4"); if (isSupp == "") { x.src = "your.ogg"; } else { x.src = "your.mp4"; } x.load(); document.getElementById("demo").innerHTML = x.src; } </script> </body> </html>