Extension:Flash Video

From MediaWiki.org
Jump to: navigation, search
MediaWiki extensions manual - list
Crystal Clear action run.png
Flash Video

Release status: unknown

Flash Video Extension Screenshot with explanations.png
Implementation Tag
Description This extension helps you display a list of video files,

with navigation by cue points.

Author(s) Brigitte Jellinek (BjelliTalk)
Last version 1.0
License No license specified
Download see below

Check usage (experimental)

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

See also FLVPlayer.

Contents

[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.

[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 three files into your extensions-folder,

  1. flv.php - code given below
  2. wiki-video-player.swf - the Player itself
  3. SteelExternalAll.swf - a part of the FLVPlayback-Component from Actionscript 2

[edit] LocalSettings.php

Place

require_once("extensions/flv.php");

inside LocalSettings.php.

[edit] flv.php

When you copy the following code: Remove any whitespace before the EOM; on line 84. The E really needs to be the first character on this line.

 <?php
 
/**
 * MediaWiki Flash Flv extension
 * set up MediaWiki to react to the "<flv>" tag
 *
 * @version 1.0
 * @author Brigitte Jellinek
 */
 
/**
 * Protect against register_globals vulnerabilities.
 * This line must be present before any global variable is referenced.
 */
if (!defined('MEDIAWIKI')) die();
 
//Avoid unstubbing $wgParser too early on modern (1.12+) MW versions, as per r35980
if ( defined( 'MW_SUPPORTS_PARSERFIRSTCALLINIT' ) ) {
    $wgHooks['ParserFirstCallInit'][] = 'wfFlv';
} else {
    $wgExtensionFunctions[] = 'wfFlv';
}
 
$wgExtensionCredits['parserhook'][] = array(
    'name' => 'Flash FLV',
    'version' => '1.0',
    'author' => 'Brigitte Jellinek',
    'description' => 'Allows the display of flash flv videos within a wiki with the <tt>&lt;flv&gt;</tt> tag, supports multible flv-files and cue points',
    'url' => 'http://www.mediawiki.org/wiki/Extension:Flash_flv',
);
 
 function wfFlv() {
         global $wgParser;
         $wgParser->setHook( "flv", "RenderFlv" );
         return true;
 }
 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);
      $param .= "&skinbase={$wgScriptPath}/extensions/";
      $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;
 }
 ?>

[edit] External link

Personal tools
Namespaces
Variants
Actions
Site
Support
Download
Development
Communication
Print/export
Toolbox