trying to use 'each' to preload
i find that on my website, when i click on a video to play it there is a noticeable pause while it loads.
i have found that i can set up a secondary video element with preload=auto, with the video names (1 ogv and 1 mp4) filled in as source, and it will preload them. and then when that video is actually called by the main video element, there is no delay. as expected. but i have to set up a preloader for every video if i do it that way, and that is a pain.
i have my videos set to play when their image is clicked, as can be seen in the js/jQ code. and that works fine (and the v1 & v2 variables are correctly alerted, depending on which thumb was picked).
what i would like to do is figure out how to automatically walk thru each of the class.thumb divs, and have it substitute the v1 & v2 into a single Preload video element, let it preload, then do the same for the next in the list.
i have tried using the 'each' method (instead of .click), and many permutations and other jQ methods (i.e. attr(onclick()) ), and can't get it to pick out the value of v1, like it does if the element is actually clicked.
i would appreciate any suggestions.
in retrospect, my post was pared down way too much. in fact, it probably didn't make sense. so i added much of the code back in, and tried to be more clear about the issue :
the problem is not getting v1 and v2 to appear in alert boxes, it is passing their values into the Preloader video element for processing.
when i mentioned "instead of clicking", i meant that, if i click on a box, that v1 and v2 are loaded into the Preloader and processed. no problem. (run this new code). they can be loaded into the main video element, or a Preload video element, or both (which would be pointless). i have put most of my code in so you can see it working.
But, as i said, when actually used on a webpage, there is a delay when the box is picked, while the video is loaded. to get around this, my thought was, using the 'each' method, to have js code walk thru each of the .thumb elements (there may be 20 of them), inserting each v1 & v2 into a "Preloader" video element (that has no display) as it goes, and thereby preloading all my videos before a single one is called in the Webpage. they are only about 8 seconds long each, so preloading shouldn't take long.
if i click on each .thumb (box) it loads fine, but i can't seem to get 'each' to do it. here is the fiddle - http://jsfiddle.net/pratto/tuQVs/10/
|All times are GMT +1. The time now is 10:32 AM.|
Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.