I am working on a project that has a Flash video that autoplays once it loads on the page. My client would like it only to autoplay the first time someone visits the page. Consequent visits (in the same session) would load the video, but keep it paused.
The Flash video has a JS function that I can call to pause or play the video. So my thought was to set a cookie once the user visits the page and have it trigger the callback on consequent visits.
//wait until everything has loaded
$(window).load(function(){
//set a cookie
$.cookie('welcome_cookie', 'welcome');
//check for the cookie and call the pause function
if($.cookie('welcome_cookie')){
controlPlayback('pause');
}
});
This works, but it pauses the video on the very first time… How do I make it so that the playback function is triggered only on return to this page?
Just switch order to set the cookie after the first check;
You probably don´t have to set the cookie on every page load so why not just set the cookie if it´s not set;