In JavaScript:
object.onprogress = function(){
myScript};
This example uses the HTML DOM to assign an "onprogress" event to a video element.
<!DOCTYPE html> <html> <body> <video controls id="myVideo"> <source src="video.mp4" type="video/mp4"> <source src="video.ogg" type="video/ogg"> Your browser does not support HTML5 video. </video>/*w ww . j av a2s . c om*/ <p id="demo"></p> <script> document.getElementById("myVideo").onprogress = function() {myFunction()}; function myFunction() { document.getElementById("demo").innerHTML = "Downloading video"; } </script> </body> </html>
Bubbles: | No |
---|---|
Cancelable: | No |
Event type: | Event |
Supported HTML tags: | <audio>, <video> |