Sample Coding for oncanplaythrough Attribute in HTML:
Tryit<!DOCTYPE html><html><head><title>Wikitechy oncanplaythrough attribute</title></head><body><video width="320" height="240" controls oncanplaythrough="onCanPlayThrough()"><source src="hibiscus.mp4" type="video/mp4"></video><script>
function onCanPlayThrough() {
alert("Wikitechy Video Can be Played Fully!");
}
</script></body></html>
Code Explanation for oncanplaythrough Attribute in HTML:
<video> tag is used to embed a video file in the HTML Document.
The oncanplaythrough attribute is used to trigger an event when the video can be ready to play no need to buffer remaining frames.
The JavaScript function onCanPlayThrough is used to display an alert message.
Output for oncanplaythrough Attribute in HTML:
The alert message shows when media file has been fully buffered.
Browser Support for oncanplaythrough Attribute in HTML: