ironman Posted January 8, 2008 Share Posted January 8, 2008 I have a video on my home page that autoplays. I like the fact the video auto plays the first time you load the home page, but would like to know if there was a way (possibly with session cookies?) to remember if the person made a visit to the home page. If he did (and thus ha already seen the video) the video wouldnt auto load. The video would only auto load the first time a visitor has loaded the home page. Any help or suggestions would be much appreciated! Quote Link to comment https://forums.phpfreaks.com/topic/85047-solved-video-question/ Share on other sites More sharing options...
revraz Posted January 8, 2008 Share Posted January 8, 2008 Post the code that has the autoplay in it. Quote Link to comment https://forums.phpfreaks.com/topic/85047-solved-video-question/#findComment-433731 Share on other sites More sharing options...
ironman Posted January 8, 2008 Author Share Posted January 8, 2008 <!-- begin embedded QuickTime file... --> <table border='0' cellpadding='0' align="center"> <!-- begin video window... --> <tr><td> <OBJECT classid='clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B' width="280" height="250" codebase='http://www.apple.com/qtactivex/qtplugin.cab' > <param name='src' value="http://www.nugentappraisal.com/multimedia/video/Nugent.mov"> <param name='autoplay' value="true"> <param name='controller' value="true"> <param name='loop' value="false"> <EMBED src=" http://www.nugentappraisal.com/multimedia/video/Nugent.mov" width="280" height="250" autoplay="true" controller="true" loop="false" pluginspage=' http://www.apple.com/quicktime/download/'> </EMBED> </OBJECT> </td></tr> <!-- ...end embedded QuickTime file --> </table> Quote Link to comment https://forums.phpfreaks.com/topic/85047-solved-video-question/#findComment-433732 Share on other sites More sharing options...
c_shelswell Posted January 8, 2008 Share Posted January 8, 2008 You could I guess use session cookies - google "php set cookie" or you could have a mysql table that logs ip addresses when someone visits the homepage which would be in the $_SERVER global. Hope that helps Quote Link to comment https://forums.phpfreaks.com/topic/85047-solved-video-question/#findComment-433791 Share on other sites More sharing options...
revraz Posted January 8, 2008 Share Posted January 8, 2008 What part of that actually controls the autoplay feature? Quote Link to comment https://forums.phpfreaks.com/topic/85047-solved-video-question/#findComment-433800 Share on other sites More sharing options...
PHPNewbie55 Posted January 8, 2008 Share Posted January 8, 2008 Try this:::: <?php // if the cookie variable "visit" is NOT SET if (!isset($_COOKIE["visit"])) { $time = time(); $autoplay = "true"; // Set The 24 Hour Cookie // setcookie("visit", "1", $time+60*60*24*1); } else { // if the cookie variable "visit" IS SET $autoplay = "false"; } ?> Then in your table that has the movie embedded::: <?php <!-- begin embedded QuickTime file... --> <table border='0' cellpadding='0' align="center"> <!-- begin video window... --> <tr><td> <OBJECT classid='clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B' width="280" height="250" codebase='http://www.apple.com/qtactivex/qtplugin.cab' > <param name='src' value="http://www.nugentappraisal.com/multimedia/video/Nugent.mov"> ///// ADD THE $AUTOPLAY VALUE BELOW ////////////////////////// <param name='autoplay' value="$autoplay"> <param name='controller' value="true"> <param name='loop' value="false"> <EMBED src=" http://www.nugentappraisal.com/multimedia/video/Nugent.mov" width="280" height="250" autoplay="true" controller="true" loop="false" pluginspage=' http://www.apple.com/quicktime/download/'> </EMBED> </OBJECT> </td></tr> <!-- ...end embedded QuickTime file --> </table> ?> That may work if your entire site is in PHP...... Quote Link to comment https://forums.phpfreaks.com/topic/85047-solved-video-question/#findComment-433846 Share on other sites More sharing options...
revraz Posted January 8, 2008 Share Posted January 8, 2008 If it's HTML, but you have to save it as a .php filename if it's not. I didn't even see that PARAM You can also do this with sessions if you don't want to rely on a cookie. <!-- begin embedded QuickTime file... --> <table border='0' cellpadding='0' align="center"> <!-- begin video window... --> <tr><td> <OBJECT classid='clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B' width="280" height="250" codebase='http://www.apple.com/qtactivex/qtplugin.cab' > <param name='src' value="http://www.nugentappraisal.com/multimedia/video/Nugent.mov"> <param name='autoplay' value=<?php echo $autoplay ?>> <param name='controller' value="true"> <param name='loop' value="false"> <EMBED src=" http://www.nugentappraisal.com/multimedia/video/Nugent.mov" width="280" height="250" autoplay="true" controller="true" loop="false" pluginspage=' http://www.apple.com/quicktime/download/'> </EMBED> </OBJECT> </td></tr> <!-- ...end embedded QuickTime file --> </table> Quote Link to comment https://forums.phpfreaks.com/topic/85047-solved-video-question/#findComment-433850 Share on other sites More sharing options...
PHPNewbie55 Posted January 9, 2008 Share Posted January 9, 2008 Actually if it IS html and you want to use some PHP and you don't want to change the page extensions.. then just add this to your .htaccess file.... AddType application/x-httpd-php .html .htm .shtml Then put this code above your <html> tag... <?php // if the cookie variable "visit" is NOT SET if (!isset($_COOKIE["visit"])) { $time = time(); $autoplay = "true"; // Set The 24 Hour Cookie // setcookie("visit", "1", $time+60*60*24*1); } else { // if the cookie variable "visit" IS SET $autoplay = "false"; } ?> Then use revraz's example to display the movie table... <!-- begin embedded QuickTime file... --> <table border='0' cellpadding='0' align="center"> <!-- begin video window... --> <tr><td> <OBJECT classid='clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B' width="280" height="250" codebase='http://www.apple.com/qtactivex/qtplugin.cab' > <param name='src' value="http://www.nugentappraisal.com/multimedia/video/Nugent.mov"> <param name='autoplay' value=<?php echo $autoplay ?>> <param name='controller' value="true"> <param name='loop' value="false"> <EMBED src=" http://www.nugentappraisal.com/multimedia/video/Nugent.mov" width="280" height="250" autoplay="true" controller="true" loop="false" pluginspage=' http://www.apple.com/quicktime/download/'> </EMBED> </OBJECT> </td></tr> <!-- ...end embedded QuickTime file --> </table> Hope that helps... or better yet hope it is correct seeing as I am a noob........... Quote Link to comment https://forums.phpfreaks.com/topic/85047-solved-video-question/#findComment-434312 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.