Extension:MediawikiPlayer

From MediaWiki.org
Jump to: navigation, search
MediaWiki extensions manualManual:Extensions
Crystal Clear action run.png
MediawikiPlayer

Release status:Extension status unmaintained

ImplementationTemplate:Extension#type Tag
DescriptionTemplate:Extension#description Embeds a media player into a wiki page
Author(s)Template:Extension#username Swiftlytilting (Frantiktalk)
Latest versionTemplate:Extension#version 0.3.0 (2010-10-19)
MediaWikiTemplate:Extension#mediawiki ≤ 1.23
LicenseTemplate:Extension#license GPL-2.0+ (but requires non-free CC BY-NC-SA JW Player)
Download MediawikiPlayer 0.3.0
ParametersTemplate:Extension#parameters
  • $wgMWPlayerDefaultSettings
  • $wgMWPlayerDir
  • $wgMWPlayerConfig
  • $wgMWPlayerUseSWFObject

Translate the MediawikiPlayer extension if it is available at translatewiki.net

Check usage and version matrix.

The MediawikiPlayer extension embeds the JW FLV Media Player into a wiki page and supports multiple formats like FLV, MP4 (H264/AAC), MP3, Youtube-related formats, various streaming server-related formats and various XML playlists formats.

It is, however, licensed under a non-free CC BY-NC-SA license with noncommercial restrictions.

Currently working with the latest JW Player as of 2/6/2013. Addon PlayerPointer not working.

Usage[edit]

<mediaplayer argument=value >mediaURL</mediaplayer>

The argument may be any parameter or "flashvar" supported by the JW FLV Player. See the list of flashvars for more information regarding options of the JW FLV player.

Simple[edit]

<mediaplayer>http://www.yourdomain.com/mediafile.flv</mediaplayer>

Using arguments[edit]

<mediaplayer width='500' height='300'>http://www.yourdomain.com/mediafile.flv</mediaplayer>

Using a preview image[edit]

<mediaplayer image='http://domain.com/image.jpg'>http://www.yourdomain.com/mediafile.flv</mediaplayer>

Youtube[edit]

<mediaplayer>http://www.youtube.com/watch?v=y8Kyi0WNg40</mediaplayer>

Mp3 player[edit]

(simply sets default height='20')

<mp3player>http://www.yourdomain.com/mediafile.mp3</mp3player>

or without path to file

<mp3player>File:mediafile.mp3</mp3player>

Media uploaded to the wiki[edit]

<mediaplayer>File:UploadedMediafile.flv</mediaplayer>

Note about flashvars with dots in the name[edit]

Beginning with 0.2.5, some flashvars, such as captions.file or logo.position can be used with MediawikiPlayer. Since Mediawiki will not recognize non-alphanumeric characters in tag parameter names, a special code has been designated to signify a dot (period) character: 00.

For example, to represent captions.file, use the following code segment

<mediaplayer captions00file="http://example.com/captions.xml" ....

Currently there are no flashvars which utilize any character besides the dot, but just in case some extras were defined. The following special "escape" codes can be used in parameter names:

00 => . (dot/period)
01 => - (dash)
02 => _ (underscore)
09 => 0 (zero)

Downloads[edit]

Installation[edit]

To install this extension:

  1. Install MediawikiPlayer in yourwikidir/extensions/MediawikiPlayer/
  2. Install the following files from the JW FLV Media Player installation (available www.jwplayer.com) in yourwikidir/extensions/MediawikiPlayer/
    • player.swf
    • jwplayer.js
  1. Add the following to LocalSettings.php:
require_once("$IP/extensions/MediawikiPlayer/MediawikiPlayer.php");

Please see this section if you need to install a license key.

Configuration parameters[edit]

$wgMWPlayerDefaultSettings[edit]

An array of the default settings for the player.

Default array:

$wgMWPlayerDefaultSettings = array(
              'width' => '400',
              'height' => '300',
              'allowfullscreen' => 'true',
              'backcolor' => 'eeeeee',
              );

$wgMWPlayerDir[edit]

Directory where the media player flash and javascript files are located. Default is in the same folder as the MediawikiPlayer script.

Default:

$wgMWPlayerDir =  '/w/extensions/MediawikiPlayer';

$wgMWPlayerConfig[edit]

An array of arrays to define multiple custom configurations.

$wgMWPlayerConfig = array( 
   'MyCustomConfig' => array ( 'width' => '400',
                               'height' => '300',
                               'allowfullscreen' => 'false',
                               'backcolor' => 'cccccc',
   ),
   'AnotherConfig' => array (  'width' => '600',
                               'height' => '400',
                               'allowfullscreen' => 'true',
                               'backcolor' => '000000',
   )
);

To invoke one of these configurations in Mediawiki:

<mediaplayer MWPlayerConfig="MyCustomConfig">http://www.example.com/mediafile.flv</mediaplayer>

$wgMWPlayerUseSWFObject[edit]

Set this value to true if you wish to use the older style embedding using swfobject.js instead of jwplayer.js.

$wgMWPlayerUseSWFObject = true;

You may also enable/disable this on a video by video basis. (Both swfobject.js and jwplayer.js must be installed for this to work)

<mediaplayer useSWF=true>http://www.example.com/mediafile.flv</mediaplayer>

Using add-ons[edit]

AddOns are extensions for MediawikiPlayer.

To enable an AddOn, place the file in the /Mediawikiplayer/AddOns folder and add the following code in LocalSettings.php AFTER you have included main MediawikiPlayer extension file

MediawikiPlayer::useAddOn('AddOnName');
PlayerPointer[edit]

Currently one AddOn is included with MediawikiPlayer: PlayerPointer, created by Anner van Hardenbroek. This AddOn allows you to use the new JWPlayer API to make the mediaplayer seek to a specific location in the media file using the videopointer oraudiopointer tags.

Example:

<mediaplayer>File:MyMediafile.flv</mediaplayer>
<videopointer>30</videopointer>

In this example, a link will be created which will seek to 30 seconds into the clip. You may also use hh:mm:ss notation.

How to configure LocalSettings.php for use with PlayerPointer:

require_once( "$IP/extensions/MediawikiPlayer/MediawikiPlayer.php" );
MediawikiPlayer::useAddOn('PlayerPointer');

License key[edit]

In the line 218 in "MediawikiPlayer.php" change the following line to include your license key. Please note that the example does show an actually working key.

Replace

$code .= "jwplayer($wgMWPlayerIDJS).setup({flashplayer: $playerUrl"

by

$code .= "jwplayer($wgMWPlayerIDJS).setup({flashplayer: $playerUrl, key:'ay0adCRrquDxP08lIhxMyukAjPW3RrudoQ8bRq=='";

Changelog[edit]

v.0.3.0[edit]

  • Added support for JWPlayer 5.3's jwplayer.js
  • Added AddOn support
  • Added internationalization for the File: namespace
  • Reorganized code

v.0.2.5[edit]

  • Added support for flashvars with dots in the name so that captions can be used.

v.0.2.4[edit]

  • Fixed issue where some FlashParams were showing up as FlashVariables instead.

v.0.2.3[edit]

  • Additional security fix for servers with register_globals enabled.

v.0.2.2[edit]

  • Additional XSS security errors fixed.
  • Prevented register_globals injections. All settings must be made after the require_once call in LocalSettings.php

v.0.2.1[edit]

  • Fixed a bug when loading local files stored on the wiki

v.0.2.0[edit]

  • Fixed XSS security risk.
  • Added ability to load media directly from the wiki using File:medianame.ext shortcut
  • Added ability to store various default configurations with $wgMWPlayerConfig

v.0.1.0[edit]

  • First public release

External links[edit]