HTML Audio / Video Event DOM canplaythrough
HTML Audio / Video DOM Reference
Examples
Tips can not pause the video has been playing:
myVid=document.getElementById("video1");
myVid.oncanplaythrough=alert("Can play through video without stopping");
myVid.oncanplaythrough=alert("Can play through video without stopping");
try it"
Definition and Usage
When the browser is expected to be able to stop in the case of continuous playback buffering specified audio / video, canplaythrough event occurs.
When the audio / video is loading process will be followed by the following events occur:
- loadstart
- durationchange
- loadedmetadata
- loadeddata
- progress
- canplay
- canplaythrough
Browser Support
All major browsers support canplaythrough event.
Note: 8 and earlier versions of Internet Explorer does not support the event.
grammar
In HTML:
<audio|video oncanplaythrough=" SomeJavaScriptCode ">
In JavaScript:
audio|video .oncanplaythrough= SomeJavaScriptCode ;
Use addEventListener ():
audio|video .addEventListener("canplaythrough", function()
{
//SomeJavaScriptCode
}
);
{
//SomeJavaScriptCode
}
);
technical details
以下 HTML 标签支持: | <audio>, <video> |
---|---|
以下 JavaScript 对象支持: | Audio, Video |
More examples
Use oncanplaythrough attributes on HTML elements
Use addEventListener () to listen for the event canplaythrough
HTML Audio / Video DOM Reference