1

I'm trying to create a simple youtube player using some javascript. Example is here:

http://jsfiddle.net/YX8pQ/6/

I've got the basic functionality working (kinda) using click functions to toggle the visibility of each iframe.

HOWEVER:

  1. When clicking each thumbnail in succession, loading the iframes becomes a bit buggy; sometimes the video you click doesn't load, and sometimes (no idea why!) a different video loads.

  2. When clicking a different thumbnail, currently-playing videos keep on loading.

Is there a more elegant/robust way of doing this? It's a pretty simple function but I can't seem to work out a better way to make this work.

2 Answers 2

2

You need to hide the previous video frame before toggling the new one. See updated example : http://jsfiddle.net/ampersand/YX8pQ/8/

I've created a vidframe class on each iframe. This is used in the css as well as in the jQuery selector.

0
0

I know you want to solve the problems you have with your video player, but in case you rethink it, you could use flowplayer, it's awesome, and has streaming also :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.