phoboslab / jsmpeg

MPEG1 Video Decoder in JavaScript
MIT License
6.37k stars 1.43k forks source link

Queue up videos? #60

Closed aizawak closed 9 years ago

aizawak commented 9 years ago

I'm currently playing videos successively by using the handy externalFinishedCallback. Do you think it would be possible to send an XMLHttpRequest for every next video before it's turn for decoding? Is there any way to split the decoder from the player?

phoboslab commented 9 years ago

Sure. Easiest way, depending on your use case, would be to construct a new jsmpeg() for each new video, but don't use autoplay (and maybe hack jsmpeg to not show the loading anim!?). jsmpeg will load the new video but not render it.

aizawak commented 9 years ago

Thank you! I actually ended up hacking jsmpeg a bit more by playing around with the externalLoadCallback function to load as many clips as possible, store them in a queue of arraybuffers, and then shift() to get the next clip as soon as the previous is finished.