Last active
August 29, 2015 14:16
-
-
Save joe-watkins/6b65f01b6cdeae8c4731 to your computer and use it in GitHub Desktop.
Test to see if HTML5 Video is buffered.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Tests to see if video has been buffered. | |
html5VideoBufferedTest(player,showVideo); | |
https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement | |
*/ | |
var html5VideoBufferedTest = function(videoObject,callback_function){ | |
videoBuffered = false; | |
setInterval(function(){ | |
if(videoObject.readyState == 4){ // VIDEO IS BUFFERED | |
// assign global | |
videoBuffered = true; | |
// if callback run it | |
if(callback_function){ callback_function(); } | |
clearInterval(html5VideoBufferedTest); | |
} | |
},400); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment