Extension:Video

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

Release status:Extension status beta

ImplementationTemplate:Extension#type Special page
DescriptionTemplate:Extension#description Allows new Video namespace for embeddable media on supported sites
Author(s)Template:Extension#username David Pean
Jack Phoenix
John Du Hart
Latest versionTemplate:Extension#version 1.5.3 (2015-12-12)
MediaWikiTemplate:Extension#mediawiki 1.27+
LicenseTemplate:Extension#license GNU General Public License 2.0 or later
Download
README
ExampleTemplate:Extension#example Social Tools Development Wiki
Added rightsTemplate:Extension#rights

addvideo

Hooks usedTemplate:Extension#hook
ArticleFromTitleManual:Hooks/ArticleFromTitle
CategoryPageViewManual:Hooks/CategoryPageView
ParserBeforeStripManual:Hooks/ParserBeforeStrip
ParserFirstCallInitManual:Hooks/ParserFirstCallInit
ArticleDeleteManual:Hooks/ArticleDelete
UndeleteForm::showRevisionManual:Hooks/UndeleteForm::showRevision
UndeleteForm::showHistoryManual:Hooks/UndeleteForm::showHistory
UndeleteForm::undeleteManual:Hooks/UndeleteForm::undelete

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

Check usage and version matrix.

IssuesPhabricator

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 Wikia, Inc. Some code cleanup was done by Łukasz 'TOR' Garczewski and Bartek Łapiński for Wikia, Inc. and by Jack Phoenix for ShoutWiki.

Warning Warning: This extension is most likely not feature-complete or otherwise suitable for a production-grade site yet! Proceed with caution. Please use Extension:YouTube or a similar alternative for the time being, unless you're a developer willing to develop this extension further.

Supported video providers[edit]

  1. DailyMotion
  2. Gametrailers
  3. Google Video
  4. MetaCafe
  5. MyVideo
  6. Sevenload
  7. South Park Studios
  8. Viddler
  9. Vimeo
  10. WeGame
  11. YouTube

Installation[edit]

  • Download and place the file(s) in a directory called Video in your extensions/ folder.
  • Add the following code at the bottom of your LocalSettings.php:
wfLoadExtension( 'Video' );
  • Run the update script which will automatically create the necessary database tables that this extension needs.
  • YesY Done - Navigate to Special:Version on your wiki to verify that the extension is successfully installed.

To users running MediaWiki 1.24 or earlier:

The instructions above describe the new way of installing extensions using wfLoadExtension(), since MediaWiki 1.25. If you need to install this extension in earlier versions, instead of wfLoadExtension( 'Video' );, you need to use:

require_once "$IP/extensions/Video/Video.php";

Usage[edit]

After 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"/>.

To-do list/known bugs[edit]

  1. Write the code for supporting 5min.com, Blip.tv, Nicovideo and Tangler.com
  2. 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[edit]

Provider classes for different video hosting sites are stored in the providers directory. Writing a new provider class is easy:

  1. copy the example provider class into the providers directory and name it accordingly (for example, ExampleVideo.php)
  2. autoload the new provider class in Video.php
  3. add the provider to Video::$providers
  4. 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 '...';
	}
	*/

}


Social toolsSocial tools
SocialProfileExtension:SocialProfile OverviewExtension:SocialProfileRoadmapExtension:SocialProfile/RoadmapDeveloper infoExtension:SocialProfile/For developersScreenshotsExtension:SocialProfile/ScreenshotsHistorySocial tools
Other social extensions Automatic Board WelcomeExtension:Automatic Board WelcomeBlogPageExtension:BlogPageChallengeExtension:ChallengeFanBoxesExtension:FanBoxesMiniInviteExtension:MiniInviteNewUsersListExtension:NewUsersListPictureGameExtension:PictureGamePollNYExtension:PollNYQuizGameExtension:QuizGameRandomFeaturedUserExtension:RandomFeaturedUserRandomGameUnitExtension:RandomGameUnitRandomUsersWithAvatarsExtension:RandomUsersWithAvatarsSiteMetricsExtension:SiteMetricsSiteScoutExtension:SiteScoutSportsTeamsExtension:SportsTeamsUserStatusExtension:UserStatusUserWelcomeExtension:UserWelcome
Other related extensions
(which do not depend on SocialProfile)
AnswersExtension:AnswersCommentsExtension:CommentsLinkFilterExtension:LinkFilterMediaWikiChatExtension:MediaWikiChatNewSignupPageExtension:NewSignupPageVideoExtension:VideoVoteNYExtension:VoteNYWikiForumExtension:WikiForumWikiTextLoggedInOutExtension:WikiTextLoggedInOut