Extension:Video
Video Release status: beta |
|
---|---|
Implementation | Special page |
Description | Allows new Video namespace for embeddable media on supported sites |
Author(s) | David Pean Jack Phoenix John Du Hart Mainframe98 Universal Omega |
Latest version | 1.9.4 |
MediaWiki | 1.43+ |
Database changes | Yes |
License | GNU General Public License 2.0 or later |
Download | README |
Example | Social Tools Development Wiki |
|
|
Quarterly downloads | 32 (Ranked 104th) |
Translate the Video extension if it is available at translatewiki.net | |
Issues | Open tasks · Report a bug |
Video is an extension that allows you to import videos from different video services, such as YouTube, DailyMotion or Metacafe. The extension adds two new special pages, Special:AddVideo, which all registered users or other users with 'addvideo' permission can access to add new videos to the site and Special:NewVideos, which lists all recently added videos. The extension also adds <videogallerypopulate>
parser hook tag.
Video additions are logged into the video log at Special:Log/video.
This extension was originally written by David Pean for Fandom, Inc. Some code cleanup was done by Łukasz 'TOR' Garczewski and Bartek Łapiński for Fandom, Inc. and by Jack Phoenix for ShoutWiki.
Supported video providers
editInstallation
edit- Download and move the extracted
Video
folder to yourextensions/
directory.
Developers and code contributors should install the extension from Git instead, using:cd extensions/
git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/Video - Add the following code at the bottom of your LocalSettings.php file:
wfLoadExtension( 'Video' );
- Run the update script which will automatically create the necessary database tables that this extension needs.
- Done – Navigate to Special:Version on your wiki to verify that the extension is successfully installed.
Usage
editAfter adding a video through Special:AddVideo, you can embed it into an article by using the syntax [[Video:Video's Name Here]]
or <video name="Video's Name Here"/>
.
The extension also has the functionality to display videos in a gallery format, in similar fashion to the <gallery>
tag. To achieve this, wrap the videos in the <videogallery>
tag.
To-do list/known bugs
edit- Write the code for supporting 5min.com, Nicovideo and Tangler.com
- If a video is embeded in a page and this page is later transcluded, it only shows a link to Video:foo and not the embeded video.
Developer Info
editProvider classes for different video hosting sites are stored in the providers
directory. Writing a new provider class is easy:
- copy the example provider class into the providers directory and name it accordingly (for example,
ExampleVideo.php
) - autoload the new provider class in Video.php
- add the provider to Video::$providers
- enjoy!
Example provider class
edit<?php
class ExampleVideoProvider extends BaseVideoProvider {
// Used to extract the $video_id from the URL
protected $videoIdRegex = '#/watch/([a-zA-Z0-9_\-]+)/#';
// Set this to the embed, and use $width, $height and $video_id appropriately
protected $embedTemplate = '<object width="$width" height="$height"><param name="movie" value="$video_id">...etc';
/**
* Gives all domains that this provider should respond to
*
* Second level domains are preferred
*
* @return array
*/
public static function getDomains() {
return array( 'example.com' );
}
/**
* Return the aspect ratio for the video player
*
* Just what the player is set to by default: Width / Height
*
* @return float
*/
protected function getRatio() {
return 512 / 296;
}
/**
* If there is more complexity to retrieving the $video_id for the embed
* code than a single regular expression, override this function.
*
* If you make an HTTP call (eg. to an API) you MUST cache it with $wgMemc
*
* @param string $url URL to extract the ID from
* @return bool|null|Object
*/
/*
protected function extractVideoId( $url ) {
// Check out HuluVideoProvider or Viddler for an example
}
*/
/**
* Override this function for cases where the HTML embed code is complex
* and has special cases.
*
* @return string Raw HTML to display the video
*/
/*
public function getEmbedCode() {
return '...';
}
*/
}
This extension is included in the following wiki farms/hosts and/or packages: This is not an authoritative list. Some wiki farms/hosts and/or packages may contain this extension even if they are not listed here. Always check with your wiki farms/hosts or bundle to confirm. |