array(
'width' => '640'
,'height' => '506'
,'scale' => '1'
,'fs' => 'true'
,'basename' => '' # i.e. http://www.archive.org/basename/, or just 'basename'
)
,'basicPropertiesAudio' => array(
'width' => '350'
,'height' => '26'
,'fs' => 'true'
,'basename' => '' # i.e. http://www.archive.org/basename/, or just 'basename'
)
,'clipProperties' => array(
# CLIP PROPERTIES - http://static.flowplayer.org/documentation/configuration/clips.html
'accelerated' => ''
,'autoBuffering' => 'false' # player begins automatically loading the file
,'autoplay' => 'false'
,'baseUrl' => '' # different depending on whether it's audio or video - supplied by recipe
,'bufferLength' => ''
,'connectionProvider' => ''
,'cuepointMultiplier' => ''
,'cuepoints' => ''
,'controls' => ''
,'duration' => '' # how long until playback ceases - (default: 0)
,'extension' => ''
,'fadeInSpeed' => '' # fade-in, in milliseconds - (default: 1000)
,'fadeOutSpeed' => '' # fade-out, in milliseconds - (default: 1000)
,'image' => ''
,'linkUrl' => '' # link to a url when user clicks on video window
,'linkWindow' => '' # window to open new url in (_self, _blank, _parent, _top)
,'live' => ''
,'metaData' => ''
,'originalUrl' => ''
,'position' => ''
,'playlist' => ''
,'provider' => '' # different depending on whether it's audio or video - supplied by recipe
,'scaling' => '' # different depending on whether it's audio or video - supplied by recipe
,'seekableOnBegin' => ''
,'start' => '' # start position, in seconds - (default: 0)
,'url' => ''
,'urlResolvers' => ''
)
,'controlbarProperties' => array(
# CONTROLBAR PROPERTIES - http://flowplayer.org/plugins/flash/controlbar.html
# empty values ('') from here on out will use the FlowPlayer defaults unless specified
# MAIN OPTIONAL CONTROLS (not including playlist or fullscreen)
'controls' => '' # if 'null' or 'false', controls will not appear at all
,'all' => '' # show or hide all btns - true shows all, false, allows for enabling one-button-at-a-time
,'time' => '' # show or hide the time
,'timeColor' => ''
,'timeBgColor' => ''
,'timeBgHeightRatio' => ''
,'timeBorder' => ''
,'timeBorderColor' => ''
,'timeBorderWidth' => ''
,'timeFontSize' => '9'
,'timeSeparator' => ''
,'durationColor' => ''
,'play' => '' # show or hide the play btn
,'stop' => '' # show or hide the stop btn
,'mute' => 'false' # show or hide the mute button
,'playlist' => ''
,'fastBackward' => ''
,'fastForward' => ''
,'slowBackward' => ''
,'slowForward' => ''
,'fullscreen' => ''
,'volume' => '' # show or hide the volume slider
,'volumeColor' => ''
,'volumeSliderColor' => ''
,'volumeSliderGradient' => '' # vals: none, low, medium or high; or an array: [0.2, 1.0]
,'volumeSliderHeightRatio' => ''
,'volumeBarHeightRatio' => ''
,'volumeBorder' => ''
,'volumeBorderWidth' => ''
,'volumeBorderColor' => ''
,'scrubber' => '' # show or hide the time scrubber
,'scrubberHeightRatio' => '0.6'
,'scrubberBarHeightRatio' => ''
,'progressColor' => ''
,'progressGradient' => '' # vals: none, low, medium or high; or an array: [0.2, 1.0]
,'bufferColor' => '' # a hex value: i.e. #777777
,'bufferGradient' => '' # vals: none, low, medium or high; or an array: [0.2, 1.0]
,'sliderColor' => ''
,'sliderGradient' => '' # vals: none, low, medium or high; or an array: [0.2, 1.0]
,'sliderBorder' => ''
,'sliderBorderWidth' => ''
,'sliderBorderColor' => ''
,'buttonColor' => ''
,'buttonOverColor' => ''
# AUTO HIDE CONTROLS
,'autoHide' => '' # values: 'always', 'never', 'fullscreen', false -- see below for more values
# POSITION CONTROLS
,'bottom' => '' # bottom position of the player controls, measured in pixels from the bottom
,'top' => '' # top position of the player controls, measured in pixels from the top
,'ctrlHeight' => '26' # height of controls
,'ctrlWidth' => '' # width of controls
# AESTHETICS
,'opacity' => '' # opacity of controls (decimal value between 0-1)
,'borderRadius' => '' # rounding of the controller's edges (default is no rounding)
,'gloss' => ''
,'backgroundColor' => '#000000'
,'backgroundGradient' => '' # more info: http://flowplayer.org/documentation/configuration/plugins.html#styling-properties
)
,'autohideProperties' => array(
# AUTOHIDE PROPERTIES - part of controlbar properties - http://flowplayer.org/plugins/flash/controlbar.html
'enabled' => ''
,'fullscreenOnly' => 'true'
,'hideDelay' => ''
,'hideDuration' => ''
,'hideStyle' => ''
,'mouseOutDelay' => ''
)
,'canvasProperties' => array(
# CANVAS PROPERTIES - part of controlbar properties - http://flowplayer.org/documentation/configuration/plugins.html#display-properties
'background' => '' # shorthand for setting all canvas properties as once, i.e.:
# format: backgroundImage backgroundRepeat left top.
# example: url(/my/image.jpg) no-repeat 100 30.
,'backgroundColor' => '#000000'
,'backgroundGradient' => 'none'
,'backgroundImage' => '' # i.e 'url(/img/demos/helloworld.jpg)'
,'backgroundRepeat' => ''
,'border' => ''
,'borderRadius' => ''
,'display' => ''
)
));
#####################
# EMBED (:ARCHIVE.ORG:)
### (:archive.org videocode params:)
Markup('archive.org', '!ie'] = "ArchiveOrgPlayerROE(PSS('$0'))";
SDV($trackListing_enabled, true);
function ArchiveOrgPlayerROE($videocode) {
global $ArchiveOrgPlayerDefaultParams, $trackListing_enabled;
# get basename
preg_match("#'baseUrl':'http://www.archive.org/download/([^/]+)/'#", $videocode, $basename);
$basename = $basename[1];
# get filename(s)
$files = preg_match("#'playlist':\[([^\]]+)\]#", $videocode, $matches);
$files = str_replace(array("'",'{','}','url:'),'',$matches[1]);
$filenamesArray = explode(",",$files);
foreach($filenamesArray as $item) {
if (!preg_match('#(format=|:)#',$item)) {
$filenamesArrayReduced[] .= $item;
}
}
$count = count($filenamesArrayReduced);
if ($count==0) { return $videocode; }
elseif ($count==1) {
# return only 1 filename, no brackets
$filenames = "$basename/".$filenamesArrayReduced[0];
} elseif ($count>1) {
$playlist = true;
# return list of [filenames] (in brackets separated by commas)
$filenames = "[".implode(",",$filenamesArrayReduced)."]";
$filenames .= " basename=$basename"; # append basename=basename for playlists
## NOTE: The playlist function works, however, the list of tracks won't show up in this version - flowplayer has to be implemented slightly differently. The tracks, however, can be reached individually via the << and >> buttons.
## For now, the track listing is spit out automatically in the ROEPattern in case it's helpful, and in order to make it clear that indeed it's a playlist
foreach($filenamesArrayReduced as $key => $val) {
$trackListing .= "# %newwin%[[http://www.archive.org/download/$basename/$val | $val]]\n";
}
}
# type: audio or video?
$typeZ = mediaType($filenamesArrayReduced[0]);
$type = $typeZ[1]; $ext = $typeZ[0];
preg_match('#width="\d+" height="\d+"#',$videocode,$matches);
$dimensions = str_replace('"','',$matches[0]);
#echo $dimensions; break;
# output -- pop in filenames & parameters
if($type=="video") $out = "(:archive.org $filenames $dimensions scale=".$ArchiveOrgPlayerDefaultParams['basicPropertiesVideo']['scale'].":)";
else $out = "(:archive.org $filenames $dimensions:)"; # no scale for audio
# output -- adds tracklisting
if ($trackListing && $trackListing_enabled && $playlist) {
# spit out track listing if there are tracks
$out .= "\n\nuse the << and >> buttons to navigate the playlist. here's a list of the tracks included in this playlist:\n$trackListing";
}
return $out;
}
}
#######
function ShowArchiveOrgPlayer($id, $args, $escape='') {
global $ArchiveOrgPlayerDefaultParams, $hexcheck_enabled, $linkToArchiveOrg, $linkToArchiveOrg_text, $flowplayerVersion;
# escape SIMPLE EMBED if url is preceded by a `, ex.: `http://...
if($escape[0]=="`") return $escape[1];
# get args
$args = ParseArgs($args);
# determine type: video or audio
list($ext, $type) = mediaType($id);
# remove unnecessary video or audio properties from the defaultParamsArray
# must do _local version of DefaultParams, or else flowplayers on the same page will mistakenly share params...
if($type=="video") {
$basicPropertiesKey = 'basicPropertiesVideo';
# if video, remove 'basicPropertiesAudio' from the defaultParams array
$ArchiveOrgPlayerDefaultParams_local = array_diff_key($ArchiveOrgPlayerDefaultParams, array('basicPropertiesAudio'=>''));
} else {
$basicPropertiesKey = 'basicPropertiesAudio';
# if video, remove 'basicPropertiesAudio' from the defaultParams array
$ArchiveOrgPlayerDefaultParams_local = array_diff_key($ArchiveOrgPlayerDefaultParams, array('basicPropertiesVideo'=>''));
}
# compare user-args with default-args of each array - update default-args if given
foreach($ArchiveOrgPlayerDefaultParams_local as $defaultArrayKey => &$defaultArrayN) {
# intersect - lists keys in arg1 that are present in arg2
$keysToUpdate = array_intersect_key($args, $defaultArrayN);
#echo " ";
# update these keys
if($keysToUpdate) $defaultArrayN = array_merge($defaultArrayN, $keysToUpdate);
}
# organize default properties - quick vars
$ArchiveOrg_BasicProperties = $ArchiveOrgPlayerDefaultParams_local[$basicPropertiesKey];
$ArchiveOrg_ControlBarProperties = $ArchiveOrgPlayerDefaultParams_local['controlbarProperties'];
$ArchiveOrg_AutoHideProperties = $ArchiveOrgPlayerDefaultParams_local['autohideProperties'];
$ArchiveOrg_ClipProperties = $ArchiveOrgPlayerDefaultParams_local['clipProperties'];
$ArchiveOrg_CanvasProperties = $ArchiveOrgPlayerDefaultParams_local['canvasProperties'];
# is it a playlist? for a playlist, the $id looks like '[file1, file2, ...]' rather than 'file'
if (strpos($id,"[")===0) {
# playlist present: [$id]
$playlist_enabled = true;
$playlist_array = explode(",",str_replace(array("[","]"),'',$id));
}
# get basename ... and filename (if it's a single file)
if($playlist_enabled)
# look at the first file in a playlist to determine the basename
preg_match("#^(http://(www\.)?archive\.org/download/)?(.*)$#", $playlist_array[0], $matches);
else
preg_match("#^(http://(www\.)?archive\.org/download/)?(.*)$#", $id, $matches);
$idClean = $matches[3];
#echo $idClean; break;
if(strpos($idClean, "/"))
# if basename is provided via the first file in the form 'baseName/filename', then...
list($idBaseName,$idFileName) = explode("/",$idClean);
else {
# if not provided in the first filename, then use the 'baseName' parameter
$idBaseName = $ArchiveOrg_BasicProperties['basename'];
$idFileName = $idClean; # not really necessary
# error
if (!$idBaseName) return Keep("Archive.org: Sorry - you need to provide a basename via a) basename=mybasename, or b) basename/filename");
}
# define width & height
## one can supply a 'scale' default different than '1', but it's not suggested, as it could be confusing to users
$width = $ArchiveOrg_BasicProperties['width'];
$height = $ArchiveOrg_BasicProperties['height'];
if(!$width) {
if($type=="video") $width = $ArchiveOrgPlayerDefaultParams_local['defaultVideoWidth'];
else $width = $ArchiveOrgPlayerDefaultParams_local['defaultAudioWidth'];
}
if(!$height) {
if($type=="video") $height = $ArchiveOrgPlayerDefaultParams_local['defaultVideoHeight'];
else $height = $ArchiveOrgPlayerDefaultParams_local['defaultAudioHeight'];
}
# apply scaling to video (but not to audio)
if($type=="video") {
$scale = $ArchiveOrg_BasicProperties['scale'];
$width *= $scale;
$height *= $scale;
}
$autoplay = $ArchiveOrg_ClipProperties['autoplay'];
if($autoplay=="1") $autoplay = "true";
elseif($autoplay=="0") $autoplay = "false";
if ($type=="audio") $fullscreen = "false"; # don't allow fullscreen for audio
elseif ($type=="video") {
$fullscreen = $ArchiveOrg_BasicProperties['fs'];
if($fullscreen=="1") $fullscreen = "true";
elseif($fullscreen=="0") $fullscreen = "false";
}
# format playlist
## NOTE: The playlist function works, however, the list of tracks won't show up in this version - flowplayer has to be implemented slightly differently. The tracks, however, can be reached individually via the << and >> buttons.
## For now, the track listing is spit out automatically in the ROEPattern in case it's helpful...
$playlistAudioFmt = "{'url':'FILENAME','autoPlay':true}";
#$playlistVideoFmt = "{'url':'FILENAME','autoPlay':true,'accelerated':true,'scaling':'fit','provider':'h264streaming'}";
$playlistVideoFmt = "{'url':'FILENAME','autoPlay':true}";
if ($type=="audio") $playlistFmt = $playlistAudioFmt;
else $playlistFmt = $playlistVideoFmt;
if ($playlist_enabled) {
# create playlist
foreach($playlist_array as $key => $fn) {
# remove basename/ from $fn
if(strpos($fn,"/")) $fn = preg_replace('#^[^/]+/#','',$fn);
#echo "$fn ";
if ($key>0) $playlist .= ",'$fn'";
# 1st should have autoplay set to the current autoplay setting, and have no comma at the front
else {
$thisExt = mediaType($fn); $thisExt = $thisExt[0];
if ($thisExt=="jpg") { # for jpg, autoplay should always be true (so leave it alone)
$playlist .= str_replace("FILENAME",$fn,$playlistFmt);
} else { # videofiles get default autoplay, (except the 1st one after a jpg)
$playlist .= str_replace(array("FILENAME","'autoPlay':true"),array($fn,"'autoPlay':$autoplay"),$playlistFmt);
}
}
}
# NO PLAYLIST - SINGLE FILE
} else {
$playlist = str_replace(array("FILENAME","'autoPlay':true"),array($idFileName,"'autoPlay':$autoplay"),$playlistFmt);
}
# PLAYLIST THUMBNAIL -- add a thumbnail to the front of a video playlist
if($type=="video") $playlist = "'format=Thumbnail?.jpg',$playlist";
/* # Hex-Number Check - previous version of this recipe didn't prepend color values with a '#' - this will check for the # and prepend it if missing
if($hexcheck_enabled) {
foreach($args as $key => &$val) {
//echo $key." - ".$val; # prelim values
# only check keys with Color in the name
if(strpos($key,"Color")) {
if(strlen($val)>0 && strpos($val,"#")!==0)
$val = '#'.$val;
}
//echo " - fixed: $val." "; # subsequent values
}
}
*/
#### Output
#