FLVPlayer-Talk

Summary: Talk page for FLVPlayer.
Maintainer: HaraldC?
Users: (View / Edit)

This space is for User-contributed commentary and notes. Please include your name and a date along with your comment.


It seems to be not working with $EnableDirectDownload = 0. Has someone got any hints for solution? Thanks from Germany! matthias? February 09, 2012, at 01:12 PM


Well, if the professionals can't help I must come back with my workaround. It's NOT perfect code and - I'm very sure - not very elegant, but for me it works! If someone else might add the parts I'm not able, the community might appreciate it wonderfully. Also don't ask my why it works! I just see it really does! Sorry for some German variable-names. Take your own, if you want to!

Include it as described on main-page. Use it like this:

  • (:flv flv=testvideo.flv:) you don't need to set width/height, defaults are 640x480, otherwise use:
  • (:flv width=800 height=600 flv=testvideo.flv:) also things like
  • %center% (:flv flv=testvideo.flv:) are possible, too.

So here's my code:

<?php if (!defined('PmWiki')) exit();

$RecipeInfo['FLVPlayer']['Version'] = '2011-02-20'; # based on this version

SDV($EnableExternalResource, 1);

# add markup (:flv ... :)
Markup('flv', 'directives',
  '/\\(:flv\\s*(.*?)\\s*:\\)/ei',
  "FLV(\$pagename, PSS('$1'))");

function FLV($pagename, $opt) {
  global $IncludeUrlDefaults, $EnableExternalResource,
         $HandleActions, $EnableUrlApprovalRequired,
         $ScriptUrl;
  SDVA($IncludeUrlDefaults, array(
    'width' => '640px',
    'height' => '480px',
  ));
  $opt = ParseArgs($opt);
  if($opt[''][0])
    $tgt = $opt[''][0];
  else
    foreach($opt as $k => $v)
      if(! array_key_exists($k, $IncludeUrlDefaults)
      && ! in_array($k, array('', '#', '+', '-'))) {
        $tgt = "$k:$v";
        break;
      }
  $opt = array_merge($IncludeUrlDefaults, $opt);
  if(!IsEnabled($EnableExternalResource, 1) && preg_match('/^https?/', $tgt))
    return Keep("<h5>{$opt['errormsg']}</h5>");

  if($HandleActions['approvesites']
  && IsEnabled($EnableUrlApprovalRequired, 1)
  && preg_match('/<a[^>]+action=approvesites[^>]+>/', $url))
    return Keep($url);

  $seitenname=$pagename; # can't get $group and $name from globals, don't know why
  $gruppe=strstrb($seitenname, '.'); #strstrb function as workaround for php < V5.3
  $seite =strstr($seitenname, ".");
  $seite =ltrim($seite  , ".");


  $out = array();

  $opt[flv]=$ScriptUrl."?n=".$gruppe.".".$seite."?action=download&upname=".$opt[flv];
  $opt[flv]=urlencode($opt[flv]);   #encode for flash-vars


  $out[]=	"<object width=\"".$opt[width]."\" height=\"".$opt[height]."\" type=\"application/x-shockwave-flash\" data=\"../flvplayer/player_flv_maxi.swf\">
		<noscript><a href=\"http://flv-player.net/\">free video player for FLV files</a></noscript>
		<param name=\"movie\" value=\"../flvplayer/player_flv_maxi.swf\" />
		<param name=\"allowFullScreen\" value=\"true\" />
		<param name=\"wmode\" value=\"opaque\" />
		<param name=\"allowScriptAccess\" value=\"sameDomain\" />
		<param name=\"FlashVars\" 	value=\"flv=".$opt[flv]."&amp;startimage=".$opt[flv].".png&amp;configxml=../flvplayer/player_flv_maxi.xml\" />
	</object>";

  return Keep(implode("\n", $out));

}#of function FLV

#strstrb Funktion für workaround vor php V5.3
function strstrb($h,$n){
    return array_shift(explode($n,$h,2));
}

Talk page for the FLVPlayer recipe (users).