'350' ,'defaultAudioHeight' => '24' ,'defaultVideoWidth' => '640' ,'defaultVideoHeight' => '504' ,'scale' => '1' ,'fs' => 'false' ,'autoplay' => 'false' ,'gloss' => 'high' ,'bgColor' => '000000' ,'bgGradient' => 'medium' # more info: http://flowplayer.org/documentation/configuration/plugins.html#styling-properties ,'sliderColor' => '777777' ,'progressColor' => '777777' ,'timeColor' => 'eeeeee' ,'durationColor' => '01DAFF' ,'buttonColor' => '333333' ,'buttonOverColor' => '505050' )); SDV($ArchiveOrgPlayerROEenabled, true); # ROEPatterns - ARCHIVE.ORG EMBED CONVERSION # Converts pasted ArchiveOrgPlayer embed code into valid pmwiki (:archive.org:) code if ($ArchiveOrgPlayerROEenabled) { $ROEPatterns['!!ie'] = "ArchiveOrgPlayerROE(PSS('$0'))"; SDV($ArchiveOrgPlayerROEFmt, '(:archive.org filenames params:)'); function ArchiveOrgPlayerROE($videocode) { global $ArchiveOrgPlayerROEFmt, $ArchiveOrgPlayerDefaultParams; # get filename(s) $filenamecount = preg_match_all('#http://www.archive.org/download/([^"]+\.[^"]+)",#', $videocode, $filenamesArray); if ($filenamecount==0) { return $videocode; } elseif ($filenamecount==1) { # return only 1 filename, no brackets $filenames = $filenamesArray[1][0]; # determine type: video or audio $typeZ = mediaType($filenames); } elseif ($filenamecount>1) { # return list of [filenames] (in brackets separated by commas) $filenames = "[".implode(",",$filenamesArray[1])."]"; //echo $filenames; break; ## 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($filenamesArray[1] as $key => $val) { $i = $key+1; $trackListing .= "# %newwin%[[http://www.archive.org/download/$val | $val]]\n"; } # determine type: video or audio $typeZ = mediaType($filenamesArray[1][0]); } $type = $typeZ[1]; $ext = $typeZ[0]; # change and remove some parameters from the audio version if ($type=="audio") { $ArchiveOrgPlayerDefaultParams['height'] = $ArchiveOrgPlayerDefaultParams['defaultAudioHeight']; $ArchiveOrgPlayerDefaultParams['width'] = $ArchiveOrgPlayerDefaultParams['defaultAudioWidth']; # remove scale & fs params in audio version $ArchiveOrgPlayerDefaultParams = array_diff_key($ArchiveOrgPlayerDefaultParams, array('scale'=>'','fs'=>'')); //$removeDefaultParams = "#(scale|fs)#"; } elseif ($type=="video") { $ArchiveOrgPlayerDefaultParams['height'] = $ArchiveOrgPlayerDefaultParams['defaultVideoHeight']; $ArchiveOrgPlayerDefaultParams['width'] = $ArchiveOrgPlayerDefaultParams['defaultVideoWidth']; } # remove some parameters from both versions -- don't need to be output $ArchiveOrgPlayerDefaultParams = array_diff_key($ArchiveOrgPlayerDefaultParams, array('defaultAudioWidth'=>'', 'defaultAudioHeight'=>'', 'defaultVideoWidth'=>'', 'defaultVideoHeight'=>'')); # get default params - add all of the ArchiveOrgPlayerDefaultParams to the flowplayer pmwiki code foreach($ArchiveOrgPlayerDefaultParams as $key => $val) { $params .= " $key=$val"; } # output -- pops in filenames & parameters $out = $ArchiveOrgPlayerROEFmt; $out = str_replace(array('filenames','params'), array($filenames,$params), $out); if ($trackListing) { # spit out track listing if there are tracks $out .= "\n\nuse the << and >> buttons to navigate the playlist:\n$trackListing"; } return $out; } } function ShowArchiveOrgPlayer($id, $args) { global $ArchiveOrgPlayerDefaultParams; # add default parameters before parsing arguments $args = array_merge($ArchiveOrgPlayerDefaultParams, ParseArgs($args)); # uses ArchiveOrgPlayerDefaultParams, unless supplied by user # determine type: video or audio $typeZ = mediaType($id); $type = $typeZ[1]; $ext = $typeZ[0]; # 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 = $args['width']; $height = $args['height']; if(!$width) { if($type=="video") $width = $ArchiveOrgPlayerDefaultParams['defaultVideoWidth']; else $width = $ArchiveOrgPlayerDefaultParams['defaultAudioWidth']; } if(!$height) { if($type=="video") $height = $ArchiveOrgPlayerDefaultParams['defaultVideoHeight']; else $height = $ArchiveOrgPlayerDefaultParams['defaultAudioHeight']; } # apply scaling $scale = $args['scale']; $width *= $scale; $height *= $scale; $autoplay = $args['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 = $args['fs']; if($fullscreen=="1") $fullscreen = "true"; elseif($fullscreen=="0") $fullscreen = "false"; } # check for 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"}'; if ($type=="audio") $playlistFmt = $playlistAudioFmt; elseif ($type=="video") $playlistFmt = $playlistVideoFmt; if (strpos($id,"[")===0) { # playlist present: [$id] $playlist_enabled = "true"; $id = str_replace(array("[","]"),'',$id); # remove brackets $playlist_array = explode(",",$id); # create playlist foreach($playlist_array as $key => $fn) { # allow for part of the url, or the entire url if (strpos($fn,"http")===false) $fn = "http://www.archive.org/download/$fn"; if ($key!=0) { $playlist .= ",".str_replace("FILENAME",$fn,$playlistFmt); } # 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); } } } } else { # playlist NOT PRESENT: $id $playlist_enabled = "false"; # allow for part of the url, or the entire url if (strpos($id,"http")===false) $id = "http://www.archive.org/download/$id"; # should have autoplay set to the current autoplay setting $playlist = str_replace(array("FILENAME","\"autoPlay\":true"),array($id,"\"autoPlay\":$autoplay"),$playlistFmt); } # for context menu - everything before the slash/ if(preg_match('#download/([^/]+)/([^/"]+)"#',$playlist,$matches)) $id_reduced = $matches[1]; # Output $out = "'; $out .= ''; return Keep($out); } function mediaType($filename) { # determine type: video or audio $ext = end(explode(".",str_replace(array("[","]"),'',$filename))); if ($ext=="mp3" || $ext=="ogg") $type = "audio"; # include jpg as a video b/c archive.org often uses .jpg still as a the first item in a playlist elseif ($ext=="mp4" || $ext=="jpg") $type = "video"; return array($ext, $type); }