Extension:Flash Video

From MediaWiki.org

Jump to: navigation, search
Manual on MediaWiki Extensions
List of MediaWiki Extensions
Flash Video

Release status: unknown

Implementation Tag
Description This extension helps you display a list of video files,

with navigation by cue points.

Author(s) Brigitte Jellinek
Version 0.0
Download see below

This extension helps you display a list of video files, with navigation by cue points. It was originally created for lectures.

See also FLVPlayer.

[edit] Syntax

The Flash Video extension use the <flv></flv> tag to add a List of Video-Files that should be displayed in the Wiki. The flv-Files are external files. If the Video Files contain Cue Points, those are displayed and offered for navigation.

You need to install create wiki-video-player.swf to use this, so you need the commercial software Flash!

[edit] Sample

The flv-Tag takes several attributes and contains one line for each flv-file:

<flv 
   title="Beispiel mit xxx und yyy" 
   base="http://some.where.on.the.net/folder/with/files/">
 first.flv|First things first
 second.flv|Second to none
 third.flv|Third time's a charm
</flv>
  • Use the base attribute if all your flv-files are contained in one folder
  • the title attribute will be displayed bottom left on the player
  • each line inside the flv-tag consists of:
    • the URL or filename of the flv-files
    • |
    • the title of the movie (will be displayed top left in the player)

[edit] Installation

You need to drop flv.php into your extensions-folder, and place require_once("extensions/flv.php"); inside LocalSettings.php.

You also need to create wiki-video-player.swf from the [fla]-file. Change the URL of the Skin to fit your installation! Place the wiki-video-player.swf into your extension folder. The swf will try to load another swf that contains the skin of the video player. You can set the URL of this swf in the Parameters of the Video Player.

When you copy the followin Code: remove any whitespace before the EOM; on line 60. The E really needs to be the first character on this line.

The Code in flv.php:

<?php
 // MediaWiki Flv Extension Ver 0.0
 // set up MediaWiki to react to the "<flv>" tag
 // created by Brigitte Jellinek
 $wgExtensionFunctions[] = "wfFlv";
 function wfFlv() {
         global $wgParser;
         $wgParser->setHook( "flv", "RenderFlv" );
 }
 function RenderFlv( $input, $argv ) {
      global $wgServer, $wgScriptPath;
      // <flv title=".." base="...">
      // movie1|label1
      // movie2|label2
      // </flv>
      // these values will be passed to the swf-file as parameters:
      // ...wiki-video-player.swf?base=...&title=...&movies=movie1|movie2&labels=label1|label2
      $output = "";
      $title = isset($argv['title']) ? $argv['title'] : 'Video';
      $param = "title=" . urlencode($title);
      if( isset($argv['base']) ) {
        $param .= "&base=" . urlencode( $argv['base'] );
      }
      $width  = 550;
      $height = 280;
      $movies = array();
      $labels = array();
      foreach( explode("\n", $input) as $line ) {
        list($m,$l) = explode("|", $line);
        if ( strpos($m, ".flv") == strlen($m)-4 ) {
                array_push($movies, urlencode($m));
                array_push($labels, urlencode($l));
        }
      }
      $param .= "&movies=" . join("|", $movies);
      $param .= "&labels=" . join("|", $labels);
      $url =  $wgServer . $wgScriptPath . "/extensions/wiki-video-player.swf";
      $id = "wiki-video-player";
      $output  .=<<<EOM
 <!-- display the wiki-video-player that will play the flv-files -->
 <div class="swf" style="width:{$width}px">
 <object
     classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/flvlash.cab#version=8,0,0,0"
     width="$width" height="$height" id="$id" align="middle">
 <param name="allowScriptAccess" value="sameDomain" />
 <param name="movie" value="{$url}?{$param}" />
 <param name="quality" value="high" />
 <param name="bgcolor" value="#ffffff" />
 <embed src="{$url}?{$param}" quality="high" bgcolor="#ffffff"
        width="$width" height="$height"
        name="$id" align="middle" allowScriptAccess="sameDomain"
        type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
 </object>
 </div>
 <!-- end of flv display -->
 EOM;
      $output = str_replace("\n", "", $output);
      return $output;
 }
Personal tools