Quantcast
Viewing latest article 5
Browse Latest Browse All 7

Answer by efaj for Tell whether video is loaded or not in Javascript

To make this into a listener, under normal circumstances, you'll want to listen to the suspend event. It's triggered when download is paused or stopped for any reason, including it's finished.

You'll also want to listen to playing for the cases when the content is already loaded (like, from cache)

video.addEventListener("playing", function() {    console.log("[Playing] loading of video");    if ( video.readyState == 4 ) {        console.log("[Finished] loading of video");    }});video.addEventListener("suspend", function(e) {    console.log("[Suspended] loading of video");    if ( video.readyState == 4 ) {        console.log("[Finished] loading of video");    }});

Source: https://developer.mozilla.org/en/docs/Web/Guide/Events/Media_events


Viewing latest article 5
Browse Latest Browse All 7

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>