Dave Voyles
Dave Voyles

Reputation: 4605

How do I use readyState in videoJS?

I kept running into an issue where I couldn't get readyState to return correctly in the HTML5 video player, videojs.

The standard HTML5 video player simply has you request the state as such:

 if (video.readyState > 1) {  
     console.log(videoState); // Returns current video state as an int
 }

but when I try to use readyState for videojs, it just returns:

function vjs.Player.prototype.readyState()

How can I use readyState with videojs?

Upvotes: 2

Views: 3035

Answers (1)

Dave Voyles
Dave Voyles

Reputation: 4605

readyState is actually a function in videojs, so it needs to be called as such:

if (video.readyState() > 1) {
   console.log(videoState());  // Returns 4 (or whatever value the player currently is
}

Upvotes: 2

Related Questions