Advertisement
Home Open Editor ❯

HTML Audio/Video DOM canplaythrough Event

Example

//Accessing the element
var vid = document.getElementById("myVideo");

//Creating a function
vid.oncanplaythrough = function() {
    alert("The video can play through without stopping");
};

Try this code ❯

Meaning

The canplaythrough event run when the browser can play through the audio/video without stopping for buffering.


Standard Syntax

HTML:

<element oncanplaythrough="myScript">

JavaScript:

object.oncanplaythrough=function(){myScript};

JavaScript, using the addEventListener() method::

object.addEventListener("canplaythrough", myScript);


Advertisement

Technical Details

Type Description
Supported HTML tags: <audio> and <video>
Supported JavaScript objects: Audio, Video
Home Open Editor ❯
Advertisement