Forum Replies Created
-
-
11 years ago in reply to: How to stop autoplay on a page revisit
I got it working by creating a plugin that uses a custom shortcode to call the FV WordPress Flowplayer shortcode. My short code looks for the new user cookie to determine whether or not to add the autoplay command Here is my plugin file:
Use this shortcode on your page/post: [spokesmodel src=’http://cdn.example.com/myfile.flv’ width=152 height=368 ]
<?php
/*
Plugin Name: Spokesmodel Settings
Plugin URI: http://sample.com
Description: Plugin to display the talking spokesmodel
Version: 1.0
Author: Brandon
Author URI: http://example.com
License: All Rights Reserved
*////SET NEW USER COOKIE
function set_newuser_cookie() {
if (!isset($_COOKIE)) {
setcookie(‘tic_new_visitor’, 1, time()+86400, COOKIEPATH, COOKIE_DOMAIN, false);
}
}
add_action( ‘init’, ‘set_newuser_cookie’);add_shortcode( ‘spokesmodel’, ‘spokesmodelShortCode’ );
function spokesmodelShortCode($atts) {
$src = $atts;
$height = $atts;
$width = $atts;
$autoplay = $atts;
$splash = $atts;if(!$src){return false;}
$atts_output = ”;
if($src){$atts_output .= ” src=’$src'”;}
if($height){$atts_output .= ” height=$height”;}
if($width){$atts_output .= ” width=$width”;}
if($splash){$atts_output .= ” splash=’$splash'”;}
if($autoplay){$atts_output .= ” autoplay=$autoplay”;}
else{
if (isset($_COOKIE)) {
$atts_output .= ” autoplay=false”;
}
else {
$atts_output .= ” autoplay=true”;
}
}$atts_output .= ” splashend=show'”;
return do_shortcode(“[fvplayer $atts_output]“);
}
?>