Auto-Play video from HTML link, then load another video onComplete
Here is my test page: http://www.toddcassetty.com/index_test2.html
This is what I want to happen: 1. The player loads and auto plays the first video (featured_2_h264.mov) 2. Upon clicking the "WATCH OUR REEL" link, the player loads and plays the second video (videos/reel_tcws_2k_h264.mov) 3. At the end of the second video, player loads the first video, and displays thumbnail, but does not auto play.
Currently, The player loads and auto-plays the first video. Upon clicking the "WATCH OUR REEL" link, the player loads the second video, but doesn't auto-play.
After that, I have no idea how to call the onComplete function..
Can anyone tell me if this is even possible? I've tried just about everything I can think of with my limited knowledge of javascript and I can't get it to work..
Thank You, thank you, thank you!! I had to tweak it just a bit, but its working just like I wanted it to.
If you check this thread again, can you tell me what "return false" does?
Also, was it not possible to add the onComplete function to the code I had before? It works perfectly now, just curious and trying to learn more about the best way to do things.
bc.. When you set the href of an anchor to '#', it means "go to the current page, at the top" and so the browser will scroll to the top. When you return false in javascript, it cancels the click action of the hyperlink, which means when normally it would follow the link ((this page, top)), it will not do any hyperlink action ((link-following)), so there's no scrolling. So for those users without javascript, it doesn't have a chance to return false ((since none of the script will run at all)), and will "fall through" and do the hyperlink action. In a lot of cases, an empty href will do what you're looking for ((that is, nothing, i think, when there is no javascript available)), or javascript:void(0), or some similar gimmick.
bc.. Also, was it not possible to add the onComplete function to the code I had before? It works perfectly now, just curious and trying to learn more about the best way to do things.
i did use the code that i copied from: *http://www.toddcassetty.com/index_test2.html* so now i'm puzzled...
Well, you added the onComplete function to the jwPlayer setup code, whereas I was trying to add it to the href link.
Also, you changed the href link code from this: bc.. <a href="#" onclick="player.sendEvent('LOAD', 'videos/reel_tcws_2k_h264.mov');player.sendEvent('PLAY', 'true');player.onComplete('LOAD', 'videos/featured_2_h264.mov', 'images/thumb_featured.jpg');return false;">WATCH OUR REEL</a>
Obviously, the way I was trying to implement the "player.onComplete" function wasn't working, but I'm curious about the other syntax and if the "sendEvent" is not a good way to go about it. I got that bit from another thread here, and it was suggested by a LongTail moderator..
I'm guessing, like with any other code, there are a million ways to do anything. Just wondering why one method may be better than the other. Ultimately, I'm just happy that it works, but I'm also trying to understand it better.
Thanks again for your time, I really do appreciate it!