How to Start and Stop Multiple Players on One page.
The have two demos here that I created that use the new JWPlayer and displays multiple podcasts and videos on one page.
Each has multiple players.
My goal is to only have 1 player play at a time. so when I click click play on one player the other player(s) pause or stop.
Ethan Feldman (a very kind, helpful and awesome programmer) showed me a sample that has multiple players on one page that also play all the time and his solution was to links at the bottom of page to play or stop them all at once.
with a script written like this.
bc.. <a onclick="jwplayer('uniquenameofcontainer').play();jwplayer('uniquenameofcontainer2').play();jwplayer('uniquenameofcontainer3').play();" href="#">Play All Players</a>
bc.. <a onclick="jwplayer('uniquenameofcontainer').stop();jwplayer('uniquenameofcontainer2').stop();jwplayer('uniquenameofcontainer3').stop();" href="#">Stop All Players</a>
He suggested I use a similar script to stop some of the players or pause some of the players with a script like this
bc.. <a href="#" onclick="jwplayer('container').play();jwplayer('container2').stop();jwplayer('container3').stop();">Play All Players</a>
That sort of works, but all players have to be stopped and I have click the link twice to get a particular player to to start.
I also saw this sample that fakes the player with images
I think we need to have a way using the jwplayer("audioplayer121207").setup function to be able to stop or pause other players on the page so we won't have to use the links at all and can fire the action with just using the player play, pause, stop buttons.
I'm opening this forum post about it and will share development of how to solve this issue. If anyone has something to contribute to solve the problem please post to this forum thread as I think other people would like to use ability.
*Wait, Wait. News Flash from Ethan. He just sent me an email that does what we're looking for*
bc.. from Ethan:
"My link is just an example.
You can extend the API to do other things though.
For example - http://qa.longtailvideo.com/~ethan/multiple2.html
For each player, I made it so that when it plays, the other ones stop."
Am reseaching what he did but he may have solved the problem. Woo hoo!
Thanks Ethan. Hats off to you, kind sir,