loadedmetadata event listener sucks
It works, but I find it to be the cause of irregular errors, and there is a cleaner way to do this anyway.
Ready state value 1 is for has meta data.
The meta data is only needed to get the total duration of the video for when an out is not defined, we default to the video's duration.
Comments and changes to this ticket
ahhhh, it all makes sense. Why I get irregular errors.
It has been happening in chrome, and in demos with smaller videos, and that is because loadedmetadata is being called, and finished quicker, and in some cases, before popcorn gets to the moment in the code where we create the event listener, thus, the code in it is never called. Missed the boat.
The idea of ready states will solve this. Just check, from inside an interval, if the state is 1 or greater, so if it is already loaded by the time we get there, the ready state will be greater than one, and we can just continue on.
- State changed from assigned to peer-review-requested
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
Popcorn.js is an HTML5 video framework that lets you bring elements of the web into your videos.
Popcorn.js is a project of Web Made Movies, Mozilla's Open Video Lab.