Hi Marius,
I'm trying to set a video background for my homepage that will play a random video each time.
My temporary website url: http://82.80.209.62/~cleanpla/sasha2017
I've added a video background via the gridder, and I run this script each time the homepage loads:
if($("body").hasClass("slug-home2")) {
var videosrc = Math.floor(Math.random() * 6) + 1;
var homeurl = 'http://82.80.209.62/~cleanpla/sasha2017/videobg/';
videopath = homeurl+videosrc+'.mp4';
$('video').attr('preload', videopath);
$('video source').attr('src', videopath);
}
uder the:
Frontend.GlobalEvents.on("newpageshown", function(layoutObj, type, obj){}
event.
Everything works smooth and fast in Chrome, but in Safari there is usually a long lag with showing and starting a video (when going back to homepage from Info/Shop/Works page.
Is there anything I can do to preload the videos faster in safari? or maybe there is a problem with my script or the event that I'm launching it at?
Thanks in advance for any help.