Hi, before I start digging I just wanted to ask is there a way to make flvplayer preload the videos to a certain point?... Like say it does not start to play the video until 30% have been loaded.
Thanks Malte... I tried and tried and nothing worked... Until I saw the link you posted was about the other player. Stupid me. I like FLVplayer better then the flowplayer.
Well anyways I had a quick look through the document and found it pretty easy to understand how things work in the `flvplayer` I didnt look at the other one...
So what I suggest is a change in the code like such. in the flvplayer.php ` <?php /** * flvplayer -- plugin support for the flvplayer flash video player. * NOTE: Flash players do not support external albums! * * @author Malte Müller (acrylian), Stephen Billard (sbillard) * @version 1.0.2.8.3 * @package plugins */
$plugin_description = ($external = (getOption('album_folder_class') === 'external'))? gettext('<strong>Flash players do not support External Albums!'): gettext("Enable FLV player to handle multimedia files. IMPORTANT: Only one multimedia player plugin can be enabled at the time. Please see JW FLV media player for more info about the player and its licence."); $plugin_author = "Malte Müller (acrylian), Stephen Billard (sbillard)"; $plugin_version = '1.0.2.8.3'; $plugin_URL = "http://www.zenphoto.org/documentation/plugins/_plugins---flvplayer.php.html"; $plugin_disable = $external; $option_interface = new flvplayer(); $_zp_flash_player = $option_interface; // claim to be the flash player.
if ($external) return; // can't process external album images
// register the scripts needed addPluginScript('');
/** * Plugin option handling class * */ class flvplayer {
function getOptionsSupported() { return array( gettext('flv player width') => array('key' => 'flv_player_width', 'type' => 0, 'desc' => gettext("Player width (ignored for mp3 files.)")), gettext('flv player height') => array('key' => 'flv_player_height', 'type' => 0, 'desc' => gettext("Player height (ignored for .mp3 files if there is no preview image available.)")), gettext('Backcolor') => array('key' => 'flv_player_backcolor', 'type' => 0, 'desc' => gettext("Backgroundcolor of the controls, in HEX format.")), gettext('Frontcolor') => array('key' => 'flv_player_frontcolor', 'type' => 0, 'desc' => gettext("Texts & buttons color of the controls, in HEX format.")), gettext('Lightcolor') => array('key' => 'flv_player_lightcolor', 'type' => 0, 'desc' => gettext("Rollover color of the controls, in HEX format.")), gettext('Screencolor') => array('key' => 'flv_player_screencolor', 'type' => 0, 'desc' => gettext("Color of the display area, in HEX format.")), gettext('Displayheight') => array('key' => 'flv_player_displayheight', 'type' => 0, 'desc' => gettext("The height of the player display. Generally it should be the same as the height. (ignored for .mp3 files if there is no preview image available.)")), gettext('Autostart') => array('key' => 'flv_player_autostart', 'type' => 1, 'desc' => gettext("Should the video start automatically. Yes if selected.")), gettext('BufferSize') => array('key' => 'flv_player_buffer', 'type' => 0, 'desc' => gettext("Size of the buffer in % before the video starts.")), ); }
/** * Prints the JS configuration of flv player * * @param string $moviepath the direct path of a movie (within the slideshow), if empty (within albums) the zenphoto function getUnprotectedImageURL() is used * @param string $imagetitle the title of the movie to be passed to the player for display (within slideshow), if empty (within albums) the function getImageTitle() is used */ function playerConfig($moviepath='',$imagetitle='',$count ='') { define ('FLV_PLAYER_MP3_HEIGHT', 20) ; global $_zp_current_image, $_zp_current_album; if(empty($moviepath)) { $moviepath = getUnprotectedImageURL(); $ext = strtolower(strrchr(getUnprotectedImageURL(), ".")); } else { $ext = strtolower(strrchr($moviepath, ".")); } if(empty($imagetitle)) { $imagetitle = getImageTitle(); } if(!empty($count)) { $count = "-".$count; } $imgextensions = array(".jpg",".jpeg",".gif",".png"); if(is_null($_zp_current_image)) { $albumfolder = $moviepath; $filename = $imagetitle; $videoThumb = ''; } else { $album = $_zp_current_image->getAlbum(); $albumfolder = $album->name; $filename = $_zp_current_image->filename; $videoThumb = checkObjectsThumb(getAlbumFolder().$albumfolder, $filename); if (!empty($videoThumb)) { $videoThumb = getAlbumFolder(WEBPATH).$albumfolder.'/'.$videoThumb; } } echo '
/** * Returns the height of the player * @param object $image the image for which the width is requested * * @return int */ function getVideoWidth($image=NULL) { return getOption('flv_player_width'); }
/** * Returns the width of the player * @param object $image the image for which the height is requested * * @return int */ function getVideoHeigth($image=NULL) { if (!is_null($image) && strtolower(strrchr($image->filename, ".") == '.mp3')) { return FLV_PLAYER_MP3_HEIGHT; } return getOption('flv_player_height'); } }
?> ` The reason being is there when you have video you almost always want to buffer it for some % into the video. I wasn't 100% sure how you would put it into a sentence so I just wrote `"Size of the buffer in % before the video starts."`
I hope I did this right as I found it pretty easy to do.
EDIT: maybe I should state the changes. ` setOptionDefault('flv_player_buffer', '0'); ` ` gettext('BufferSize') => array('key' => 'flv_player_buffer', 'type' => 0, 'desc' => gettext("Size of the buffer in % before the video starts.")), ` ` so.addVariable("bufferlength","'.getOption('flv_player_buffer').'"); `
Ah, sorry, I confused the both playes. I like flvplayer better, too (note we still use v3 since v4 skipped all color options in favor of pure flash skinning), but flowplayer's advantage is that it is really free while flvplayer costs for none private use.
Comments
Well anyways I had a quick look through the document and found it pretty easy to understand how things work in the `flvplayer` I didnt look at the other one...
So what I suggest is a change in the code like such. in the flvplayer.php
`
<?php
/**
* flvplayer -- plugin support for the flvplayer flash video player.
* NOTE: Flash players do not support external albums!
*
* @author Malte Müller (acrylian), Stephen Billard (sbillard)
* @version 1.0.2.8.3
* @package plugins
*/
$plugin_description = ($external = (getOption('album_folder_class') === 'external'))? gettext('<strong>Flash players do not support External Albums!'): gettext("Enable FLV player to handle multimedia files. IMPORTANT: Only one multimedia player plugin can be enabled at the time. Please see JW FLV media player for more info about the player and its licence.");
$plugin_author = "Malte Müller (acrylian), Stephen Billard (sbillard)";
$plugin_version = '1.0.2.8.3';
$plugin_URL = "http://www.zenphoto.org/documentation/plugins/_plugins---flvplayer.php.html";
$plugin_disable = $external;
$option_interface = new flvplayer();
$_zp_flash_player = $option_interface; // claim to be the flash player.
if ($external) return; // can't process external album images
// register the scripts needed
addPluginScript('');
/**
* Plugin option handling class
*
*/
class flvplayer {
function flvplayer() {
setOptionDefault('flv_player_width', '320');
setOptionDefault('flv_player_height', '240');
setOptionDefault('flv_player_backcolor', '0xFFFFFF');
setOptionDefault('flv_player_frontcolor', '0x000000');
setOptionDefault('flv_player_lightcolor', '0x000000');
setOptionDefault('flv_player_screencolor', '0x000000');
setOptionDefault('flv_player_displayheight', '240');
setOptionDefault('flv_player_autostart', '');
setOptionDefault('flv_player_buffer', '0');
//setOptionDefault('flv_player_ignoresize_for_mp3', 'true');
}
function getOptionsSupported() {
return array( gettext('flv player width') => array('key' => 'flv_player_width', 'type' => 0,
'desc' => gettext("Player width (ignored for mp3 files.)")),
gettext('flv player height') => array('key' => 'flv_player_height', 'type' => 0,
'desc' => gettext("Player height (ignored for .mp3 files if there is no preview image available.)")),
gettext('Backcolor') => array('key' => 'flv_player_backcolor', 'type' => 0,
'desc' => gettext("Backgroundcolor of the controls, in HEX format.")),
gettext('Frontcolor') => array('key' => 'flv_player_frontcolor', 'type' => 0,
'desc' => gettext("Texts & buttons color of the controls, in HEX format.")),
gettext('Lightcolor') => array('key' => 'flv_player_lightcolor', 'type' => 0,
'desc' => gettext("Rollover color of the controls, in HEX format.")),
gettext('Screencolor') => array('key' => 'flv_player_screencolor', 'type' => 0,
'desc' => gettext("Color of the display area, in HEX format.")),
gettext('Displayheight') => array('key' => 'flv_player_displayheight', 'type' => 0,
'desc' => gettext("The height of the player display. Generally it should be the same as the height. (ignored for .mp3 files if there is no preview image available.)")),
gettext('Autostart') => array('key' => 'flv_player_autostart', 'type' => 1,
'desc' => gettext("Should the video start automatically. Yes if selected.")),
gettext('BufferSize') => array('key' => 'flv_player_buffer', 'type' => 0,
'desc' => gettext("Size of the buffer in % before the video starts.")),
);
}
/**
* Prints the JS configuration of flv player
*
* @param string $moviepath the direct path of a movie (within the slideshow), if empty (within albums) the zenphoto function getUnprotectedImageURL() is used
* @param string $imagetitle the title of the movie to be passed to the player for display (within slideshow), if empty (within albums) the function getImageTitle() is used
*/
function playerConfig($moviepath='',$imagetitle='',$count ='') {
define ('FLV_PLAYER_MP3_HEIGHT', 20)
; global $_zp_current_image, $_zp_current_album;
if(empty($moviepath)) {
$moviepath = getUnprotectedImageURL();
$ext = strtolower(strrchr(getUnprotectedImageURL(), "."));
} else {
$ext = strtolower(strrchr($moviepath, "."));
}
if(empty($imagetitle)) {
$imagetitle = getImageTitle();
}
if(!empty($count)) {
$count = "-".$count;
}
$imgextensions = array(".jpg",".jpeg",".gif",".png");
if(is_null($_zp_current_image)) {
$albumfolder = $moviepath;
$filename = $imagetitle;
$videoThumb = '';
} else {
$album = $_zp_current_image->getAlbum();
$albumfolder = $album->name;
$filename = $_zp_current_image->filename;
$videoThumb = checkObjectsThumb(getAlbumFolder().$albumfolder, $filename);
if (!empty($videoThumb)) {
$videoThumb = getAlbumFolder(WEBPATH).$albumfolder.'/'.$videoThumb;
}
}
echo '
'.gettext("Get Flash").' to see this player.
';
if($ext === ".mp3" AND !isset($videoThumb)) {
echo' var so = new SWFObject("' . WEBPATH . '/' . ZENFOLDER . '/plugins/flvplayer/flvplayer.swf","player'.$count.'","'.getOption('flv_player_width').'","'.FLV_PLAYER_MP3_HEIGHT.'","7");';
} else {
echo' var so = new SWFObject("' . WEBPATH . '/' . ZENFOLDER . '/plugins/flvplayer/flvplayer.swf","player'.$count.'","'.getOption('flv_player_width').'","'.getOption('flv_player_height').'","7");
so.addVariable("displayheight","'.getOption('flv_player_displayheight').'");';
}
echo '
so.addParam("allowfullscreen","true");
so.addVariable("file","' . $moviepath . '&title=' . strip_tags($imagetitle) . '");
' . (!empty($videoThumb) ? 'so.addVariable("image","' . $videoThumb . '")' : '') . '
so.addVariable("backcolor","'.getOption('flv_player_backcolor').'");
so.addVariable("frontcolor","'.getOption('flv_player_frontkcolor').'");
so.addVariable("lightcolor","'.getOption('flv_player_lightcolor').'");
so.addVariable("screencolor","'.getOption('flv_player_screencolor').'");
so.addVariable("autostart","' . (getOption('flv_player_autostart') ? 'true' : 'false') . '");
so.addVariable("overstretch","true");
so.addVariable("bufferlength","'.getOption('flv_player_buffer').'");
so.write("player'.$count.'");
';
}
/**
* Returns the height of the player
* @param object $image the image for which the width is requested
*
* @return int
*/
function getVideoWidth($image=NULL) {
return getOption('flv_player_width');
}
/**
* Returns the width of the player
* @param object $image the image for which the height is requested
*
* @return int
*/
function getVideoHeigth($image=NULL) {
if (!is_null($image) && strtolower(strrchr($image->filename, ".") == '.mp3')) {
return FLV_PLAYER_MP3_HEIGHT;
}
return getOption('flv_player_height');
}
}
?>
`
The reason being is there when you have video you almost always want to buffer it for some % into the video. I wasn't 100% sure how you would put it into a sentence so I just wrote `"Size of the buffer in % before the video starts."`
I hope I did this right as I found it pretty easy to do.
EDIT: maybe I should state the changes.
`
setOptionDefault('flv_player_buffer', '0');
`
`
gettext('BufferSize') => array('key' => 'flv_player_buffer', 'type' => 0,
'desc' => gettext("Size of the buffer in % before the video starts.")),
`
`
so.addVariable("bufferlength","'.getOption('flv_player_buffer').'");
`
The change seems to make sense. I will add that.