HTML Audio/Video DOM canplaythrough Event
Example
Prompt that the video can be played continuously without stopping:
myVid=document.getElementById("video1"); myVid.oncanplaythrough=alert("Can play through video without stopping");
Definition and Usage
The canplaythrough event occurs when the browser expects to be able to play the specified audio/video continuously without stopping for buffering.
The following events occur in sequence when the audio/video is loading:
- loadstart
- durationchange
- loadedmetadata
- loadeddata
- progress
- canplay
- canplaythrough
Browser Support
All mainstream browsers support the canplaythrough event.
Note:Internet Explorer 8 or earlier browsers do not support this event.
Syntax
In HTML:
<audio|video oncanplaythrough="SomeJavaScriptCode">
In JavaScript:
audio|video.oncanplaythrough=SomeJavaScriptCode;
Use addEventListener():
audio|video.addEventListener("canplaythrough", function() { //Some JavaScript Code } );
Technical Details
The following HTML tags are supported: | <audio>, <video> |
---|---|
The following JavaScript objects are supported: | Audio, Video |