Extension:EmbedVideo

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

Release status: stable

Implementation Parser function
Description Adds a parser function called #ev for embedding video clips from popular video sharing services.
Author(s) Andrew Whitworth (Whiteknight), Jim R. Wilson (Jimbojw), and Mohammad Derakhshani (Mderakhs)
Latest version 1.0
MediaWiki 1.14 - 1.20.2
License The MIT License
Download Project page

Git [Help]
Commit history
Note:
No localisation updates are provided by translatewiki.net.

Example Wikimini
Hooks used
ParserFirstCallInit

Translate the EmbedVideo extension if possible

Check usage and version matrix; code metrics

The EmbedVideo Extension is a MediaWiki extension which adds parser functions called #ev and #evp for embedding video clips from popular video sharing services.

Project Homepage
Documentation at Github
Source Code
Source code at Github
Licensing
EmbedVideo is released under The MIT License.

Notice: As of the 1.0 release the EmbedVideo extension has a new maintainer and a new code base. EmbedVideo has been merged with EmbedVideoPlus, and Version 1.0 should be backwards compatible with both old versions of EmbedVideo and old versions of EmbedVideoPlus.

Installation[edit | edit source]

  • Download and extract the files in a directory called EmbedVideo in your extensions/ folder. If you're a developer and this extension is in a Git repository, then instead you should clone the repository.
  • Add the following code at the bottom of your LocalSettings.php:
require_once( "$IP/extensions/EmbedVideo/EmbedVideo.php" );
  • Done! Navigate to "Special:Version" on your wiki to verify that the extension is successfully installed.

Usage[edit | edit source]

The EmbedVideo parser function expects to be called in any of the following ways:

  • {{#ev:service|id}}
  • {{#ev:service|id|width}}
  • {{#ev:service|id|width|align}}
  • {{#ev:service|id|width|align|desc}}
  • {{#evp:service|id|desc}}
  • {{#evp:service|id|desc|align}}
  • {{#evp:service|id|desc|align|width}}

Where:

  • service is the name of a video sharing service (See "service name" in the list below)
  • id is the id of the video to include
  • width (optional) is the width in pixels of the viewing area (height will be determined automatically)
  • align (optional) is an alignment (float) attribute. May be "left" or "right".
  • desc (optional) is a short description to display beneath the video when it is aligned. If it is not appearing try "auto" on align

For example, to include the famous "evolution of dance" YouTube video, you'd enter:

{{#ev:youtube|dMH0bHeiRNg}}

And if you wanted scaled down to thumbnail size, on the right with a short description, you could use:

{{#ev:youtube|dMH0bHeiRNg|100|right|This is an embedded video!}}
Note: See the Project Homepage for more examples.

Supported Services[edit | edit source]

As of version 1.0, EmbedVideo supports embedding video content from the following services:

Site Service Name
Dailymotion dailymotion
Div Share divshare
Edutopia edutopia
FunnyOrDie funnyordie
Google Video googlevideo
Interia interia or interiavideo
sevenload sevenload
TeacherTube teachertube
YouTube youtube and youtubehd
Vimeo vimeo

Enabling full-screen mode for youtube[edit | edit source]

Note: This modification is described by various commenters in the Discussion tab.

1. Open the EmbedVideo.hooks.php file and change the following:

  • line 157 from :
           " wmode=\"transparent\" width=\"{$width}\" height=\"{$height}\">" .
to :
           " wmode=\"transparent\" allowfullscreen=\"true\" width=\"{$width}\" height=\"{$height}\">" .
  • line 206 from :
           " wmode=\"transparent\" width=\"{$width}\" height=\"{$height}\"></embed>" .
to :
           " wmode=\"transparent\" allowfullscreen=\"true\" width=\"{$width}\" height=\"{$height}\"></embed>" .

2. Open EmbedVideo.Services.php and add add &fs=1 to both youtube URL values. For example, change http://www.youtube.com/v/$1 to http://www.youtube.com/v/$1&fs=1

To enable HD by default, add &hd=1 after the &fs=1.

Developer notes[edit | edit source]

The major benefit of using a parser function as the injection mechanism for video clips (as opposed to an extension tag) is that parser functions can utilize template parameters (of the form {{{1}}}).

For example, say you found yourself making a lot of YouTube videos in thumbnail size, right-aligned like an image. You might make a template called Template:Youtube_tn which could contain this:

<div class="thumb tright">
{{#ev:youtube|{{{1}}}|{{{2|100}}}}}
</div>

And then call it like this:

{{youtube tn|someYoutubeId}}

Reporting Bugs[edit | edit source]

There is an issue tracker set up on the Github project page.

Contributing[edit | edit source]

Bug reports, feature requests, and patches are always welcomed. New contributors can be added to the project if there is sufficient interest.

Weblinks[edit | edit source]