Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Buffering between YouTube videos

Instead of working with 2 YouTube iFrame API players at a time (playing on one while buffering then playing on the second one and then switching and doing the same on the first one) is there a better way?

Playing videos on one and using the second one for buffering would be a lot cleaner and lot less error prone implementation if it worked - that is one player does not seem to be aware of what the other one has buffered.

All of this ends up even more important when slicing and splicing together a stream of shorter sub-sections from numerous videos because the buffering spinner ends up popping up much more often.

Any ideas ?

like image 632
user556634 Avatar asked Nov 14 '22 13:11

user556634


1 Answers

First you would need to use Youtube's API to get the duration of each song (then maybe put it in a database) if you haven't already.

If you want to use two players, I would suggest using Tikku's tubeplayer jquery plugin . It works wonders with youtube's jquery API. you could set a function and delay playing (and then pausing once buffer starts - also easy with Tubeplayer) after 90% of the current song has played.

that's just an idea

like image 89
d-_-b Avatar answered Nov 16 '22 02:11

d-_-b