Extension:EmbedVideo
From MediaWiki.org
|
EmbedVideo Release status: beta |
|
|---|---|
| Implementation | Parser function |
| Description | Adds a parser function called #ev for embedding video clips from popular video sharing services. |
| Author(s) | Jim R. Wilson (Jimbojw) |
| Version | 0.1.2 |
| MediaWiki | 1.6.x, 1.9.x, 1.10.x or higher |
| Download | EmbedVideo.php |
| Example | see the Project Homepage |
The EmbedVideo Extension is a MediaWiki extension which adds a parser function called #ev for embedding video clips from popular video sharing services.
- Project Homepage
- EmbedVideo Extension - Jimbojw.com
- Source Code
- EmbedVideo.php
- Licensing
- EmbedVideo is released under The MIT License.
[edit] Installation
- Download EmbedVideo, and be sure to rename the downloaded file to EmbedVideo.php.
- Drop this script in $IP/extensions
- Note: $IP is your MediaWiki install directory.
- Enable the extension by adding this line to your LocalSettings.php:
require_once('extensions/EmbedVideo.php');
[edit] Usage
The EmbedVideo parser function expects to be called in either of the following ways:
- {{#ev:service|id}} -or-
- {{#ev:service|id|width}}
Where:
- service is the name of a video sharing service.
- 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)
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, you could use:
{{#ev:youtube|dMH0bHeiRNg|100}}
Note: See the Project Homepage for more examples.
[edit] Supported Services
As of version 0.1, EmbedVideo supports embedding video content from the following services:
[edit] Developer Notes
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}}

