Extension:EmbedVideo

<translate> The <tvar name=1>EmbedVideo</tvar> extension adds a parser function called <tvar name=2>#ev</tvar> for embedding video clips from over 24 popular video sharing services in multiple languages and countries.</translate>
<translate> It also adds video and audio media handlers to support transforming standard <tvar name=1>[[File:Example.mp4]]</tvar> file links into embedded HTML5 <tvar name=2></tvar> and <tvar name=3></tvar> tags.</translate>
; <translate> Project Homepage</translate>
: <translate> Documentation at GitLab</translate>
; <translate> Source Code</translate>
: <translate> Source code at GitLab</translate>
; <translate> Bugs</translate>
: <translate> Issues at GitLab</translate>
; <translate> Licensing</translate>
: <translate> EmbedVideo is released under [<tvar name=url>https://www.opensource.org/licenses/mit-license.php</tvar> The MIT License].</translate>
; <translate> [[<tvar name=1>Special:MyLanguage/GDPR (General Data Protection Regulation) and MediaWiki software</tvar>|GDPR]]-conform Forge</translate>
: <translate> Source code at GitHub</translate> - <translate> focuses on a more privacy centric version of EmbedVideo.</translate> <translate> Note that only YouTube, Spotify, Vimeo and Archive.org are supported and every parser function but <tvar name=1>#ev</tvar> is removed.</translate>
<translate>
== Usage == 
=== Media handler === 
</translate>
<translate> For locally uploaded content the process for displaying it on a page is the same as an image.</translate>
<translate> [[<tvar name=1>Special:MyLanguage/Help:Images#Syntax</tvar>|See the image syntax documentation]] for complete reference on this feature.</translate>
<translate>
This example would display a video in page using a HTML5 <tvar name=1></tvar> tag.
</translate>
<nowiki>[[File:Example.mp4]]</nowiki>
<translate> To specify the start and end timestamps in the media use the start and end parameters.</translate>
<translate> The timestamp can be formatted as one of: ss, :ss, mm:ss, hh:mm:ss, or dd:hh:mm:ss.</translate>
<nowiki>[[File:Example.mp4|start=2|end=6]]</nowiki>
<translate>
=== Tags === 
The EmbedVideo parser function expects to be called in any of the following ways:
==== <tvar name=1>#ev</tvar> — Classic parser tag ==== 
</translate>
* {{#ev:service|id}}
* {{#ev:service|id|dimensions}}
* {{#ev:service|id|dimensions|alignment}}
* {{#ev:service|id|dimensions|alignment|description}}
* {{#ev:service|id|dimensions|alignment|description|container}}
* {{#ev:service|id|dimensions|alignment|description|container|urlargs}}
* {{#ev:service|id|dimensions|alignment|description|container|urlargs|autoresize}}
* {{#ev:service|id|dimensions|alignment|description|container|urlargs|autoresize|valignment}}
<translate> However, if needed optional arguments may be left blank by not putting anything between the pipes:</translate>
* {{#ev:service|id|||description}}
<translate>
==== <tvar name=1>#evt</tvar> — Parser tag for templates ==== 
The <tvar name=1>#evt</tvar> parser tag allows for key=value pairs which allows for easier templating and readability.
</translate>
<nowiki>{{#evt:
service=youtube
|id=https://www.youtube.com/watch?v=eAORm-8b1Eg
|alignment=right
}}</nowiki>
<translate>
==== <tvar name=1>#evu</tvar> — Parser tag for URLs ==== 
The <tvar name=1>#evu</tvar> parser tag is like the <tvar name=2>#evt</tvar> tag, but its first parameter is a URL that will be parsed to determine the service automatically.
</translate>
<nowiki>{{#evu:https://www.youtube.com/watch?v=eAORm-8b1Eg
|alignment=right
}}</nowiki>
<translate>
==== <tvar name=1></tvar> — Tag hook ==== 
</translate>
<translate> Videos can easily be embedded with the <tvar name=1></tvar> tag hook.</translate>
<translate> The ID/URL goes as the input between the tags and parameters can be added as the tag arguments.</translate>
<embedvideo service="youtube">https://www.youtube.com/watch?v=eAORm-8b1Eg</embedvideo>
<translate> Alternatively, you can also use the service id as the tag (assuming another extension isn't already using this tag).</translate>
<youtube>https://www.youtube.com/watch?v=eAORm-8b1Eg</youtube>
<translate>
=== Attributes for parser tags === 
</translate>
<translate> Attribute</translate> 	<translate> Description</translate> 	<translate> Required?</translate>	<translate> Default</translate>
service="<translate> (See Supported Services below.)</translate>"	<translate> The video service to call.</translate> 	 	
url]" 	<translate> The raw ID of the video or URL from the player page.</translate> 	 	
WIDTHxHEIGHT|xHEIGHT]" 	<translate> Dimensions in pixels to size the embed container.</translate> <translate> The standard format is width <tvar name=1>x</tvar> height where either can be omitted, but the <tvar name=1>x</tvar> must proceed height to indicate it as the height.</translate>
<translate> Examples: <tvar name=1>480480x320x320</tvar>.</translate>
<translate> If the height is not provided it will be calculated automatically from the width and service default ratio.</translate>
<translate> Some services such as Gfycat do not have standard heights and should be specified for each embed.</translate>
<translate> <tvar name=1>$wgEmbedVideoDefaultWidth</tvar> can be set in <tvar name=2>LocalSettings.php</tvar> to override the default width.</translate>	 	640
center|right|inline]" 	<translate> Align the placement of the video either to the left, centered, or to the right.</translate> <translate> Inline will allow multiple videos to display side by side without forced line breaks.</translate> 	 	none
description="[wikitext]" 	<translate> Display a description under the embed container.</translate> <translate> For line breaks use <tvar name=1>&#10;</tvar> (see <tvar name=2>https://www.w3.org/TR/REC-xml/#AVNormalize</tvar>)</translate> 	 	none
container="[frame]" 	<translate> Specifies the container type to use for the embed.</translate>
: frame — <translate> Wrap the video player in a Mediawiki thumbnail box.</translate> 	 	none
urlargs="modestbranding=1&version=3" 	<translate> Allows extra URL arguments to be appended to the generated embed URL.</translate> <translate> This is useful for obscure options only supported on one service.</translate> 	 	none
autoresize="false" 	<translate> Automatically resize videos when their size will cause them to break outside of their container element.</translate> 	 	true
middle|bottom|baseline]" 	<translate> Align the vertical placement of the video either to the top, middle, bottom, or baseline of the parent element.</translate> <translate> Using this parameter forces the alignment parameter to be inline.</translate>	 	none
<translate>
=== Examples === 
</translate>
<translate> For example, a video from YouTube uses the <tvar name=1>youtube</tvar> service selector.</translate>
<translate> You can specify either the raw ID:</translate>
{{#ev:youtube|eAORm-8b1Eg}}
<translate> Or specify the full URL:</translate>
{{#ev:youtube|https://www.youtube.com/watch?v=eAORm-8b1Eg}}
<translate> To display the same video as a right aligned large thumbnail with a description:</translate>
{{#ev:youtube|https://www.youtube.com/watch?v=eAORm-8b1Eg|1000|right|Let eet GO|frame}}
<translate> For YouTube to have the video start at a specific time code utilize the <tvar name=1>urlargs</tvar> (URL arguments) parameter.</translate>
<translate> Take the rest of the URL arguments from the custom URL and place them into the <tvar name=1>urlargs</tvar>.</translate>
<translate> Please note that not all video services support extra URL arguments or may have different keys for their URL arguments.</translate>
https://www.youtube.com/watch?v=eAORm-8b1Eg&start=76
{{#ev:youtube|https://www.youtube.com/watch?v=pSsYTj9kCHE|||||start=76}}
<translate> URL arguments can be used to chop up a video and loop it:</translate>
https://www.youtube.com/watch?v=eAORm-8b1Eg&start=160&end=180&loop=1
{{#ev:youtube|https://www.youtube.com/watch?v=eAORm-8b1Eg|||||start=160&end=180&loop=1}}
<translate>
== Support for VideoLink tags == 
Support for the unmaintained VideoLink extension's tags has been added since version 2.5.
From the original extension documentation:
</translate>
<translate nowrap>
<!--T:75-->
The VideoLink extension allows embedding of YouTube videos in articles; allowing for multiple linked videos to be played in a single embedded video player, first shown when a user clicks on a video link.
<!--T:76-->
The <tvar name=1><evlplayer /></tvar> specifies where the player should appear within the page, and the <tvar name=2>{{#vlink}}</tvar> parser function allows creation of links that load a specific video.
</translate>
<translate>
=== <tvar name=1></tvar> — Tag hook for video container === 
</translate>
<translate> This <tvar name=1></tvar> tag is used to position the video player container within the page.</translate>
<evlplayer id="player id" w="width" h="height" class="class" style="style"><translate nowrap><!--T:80--> default content</translate></evlplayer>
<translate> A default video can be set to fill the container by default instead of default content as well.</translate>
<evlplayer id="player1" w="480" h="360" service="youtube" defaultid="eAORm-8b1Eg" />
<translate> Attributes</translate>	<translate> Required</translate>	<translate> Default</translate> 	<translate> Description</translate>
id 	 	default 	<translate> An optional unique identifier for this container.</translate>
w 	 	800 	<translate> Width to send to the embedded player when its generated.</translate>
h 	 	<translate> achieve 16:9 from width</translate>	<translate> Height to send to the embedded player when it's generated.</translate>
class 	 	 	<translate> Additional CSS class to add to the container <tvar name=1></tvar>.</translate>
style 	 	 	<translate> Additional in-line CSS to apply to the container <tvar name=1></tvar>.</translate>
defaultid 	 	 	<translate> Video ID of default video, if you want a default video.</translate>
service 	 	 	<translate> Service of default video, if you want a default video.</translate>
<translate> An important caveat to make note of, is that the <tvar name=1>w</tvar> and <tvar name=2>h</tvar> attributes only effect the video that is being included into the container <tvar name=3></tvar>, and not the actual container.</translate>
<translate> For styling of the container, please use the <tvar name=1>class</tvar> or <tvar name=2>style</tvar> attributes.</translate>
<translate>
=== <tvar name=1>#evl</tvar> — Parser function for video links === 
</translate>
{{#evl:<<translate nowrap><!--T:98--> video id</translate>>|<<translate nowrap><!--T:99--> link text</translate>>|<<translate nowrap><!--T:100--> video to play</translate>>|service=youtube|player=<<translate nowrap><!--T:101--> player id</translate>>}}
<translate> In addition to all of the attributes supported by the <tvar name=1>#evt</tvar> tag, these specific attributes apply to the <tvar name=2>#evl</tvar> (and <tvar name=3>#vlink</tvar>) tags.</translate>
<translate> To maintain backwards compatibility, if you do not define a <tvar name=1>service</tvar> then <tvar name=2>youtube</tvar> is assumed.</translate>
<translate> Attributes</translate> 	<translate> Required</translate> 	<translate> Default</translate>	<translate> Description</translate>
<translate> video id</translate> 	 	none 	<translate> The ID of the video you would like to play or a comma separated list of videos to play.</translate> <translate> Please note that the use of multiple video IDs separated by a semicolon is now deprecated.</translate>
<translate> link text</translate> 	 	none 	<translate> The text to display inside the link.</translate>
<translate> video to play</translate>	 	<translate> none</translate> 	<translate> The number that represents the video to play from video ID if it is a comma separated list of IDs.</translate>
<translate> player id</translate> 	 	default 	<translate> Player container to load video in.</translate> <translate> Note that the ID <tvar name=1>default</tvar> will only exist if you’ve defined a player with no ID.</translate>
<translate> initial video</translate>	<translate> deprecated</translate>	 	<translate> In the original VideoLink, this would define what video to play first if multiple videos were define.</translate> <translate> Please see notes about in video id and start.</translate>
<translate> start</translate> 	<translate> deprecated</translate>	0:00 	<translate> In the original VideoLink, this defined the start time of a video.</translate> <translate> Since we support multiple video services, this feature can now be replicated with the urlargs parameter.</translate> <translate> For backwards compatibility, this attribute will be respect on videos with the service <tvar name=1>youtube</tvar>.</translate>
<translate>
=== Video link examples === 
Creating a video list allows video links to create a playlist on the fly using the <tvar name=1>youtube</tvar> and <tvar name=2>youtubevideolist</tvar> service.
</translate>
<evlplayer w="width" h="height" class="class" style="style" id="example-player"><translate nowrap><!--T:131--> default content</translate></evlplayer>
{{#evl:21X5lGlDOfg|NASA Live|1|player=example-player}}
{{#evl:lEyCq2KRZik|IIS Q&A|2|player=example-player}}
{{#evl:OLeWbRdW6rY|Space Station Tour|3|player=example-player}}
<translate>
== Supported services == 
As of version 2.x, EmbedVideo supports embedding video content from the following services:
</translate>
<translate> Site</translate> 	<translate> Service name(s)</translate> 	<translate> ID example</translate> 	<translate> URL example(s)</translate> 	<translate> Notes</translate>
Archive.org <translate> Videos</translate>	archiveorg 	electricsheep-flock-244-80000-6 	https://archive.org/embed/electricsheep-flock-244-80000-6 	
Bambuser 	bambuser 	5262334 	http://bambuser.com/v/5262334 	<translate> Broadcasts</translate>
Bambuser 	bambuser_channel 	5262334 	http://bambuser.com/v/5262334 	<translate> Channels</translate>
Beam 	beam 	RocketBear 	https://beam.pro/RocketBear 	<translate> Streams</translate>
Bing 	bing 	31ncp9r7l 	http://www.bing.com/videos/watch/video/adorable-cats-attempt-to-eat-invisible-tuna/31ncp9r7l 	
Blip.tv 	blip 	 	http://blip.tv/vinylrewind/review-6864612 	<translate> Blip requires the full URL to the video page and does not accept the raw ID.</translate>
C3TV 	mediacccde 	32c3-7305-quantum_cryptography 	https://media.ccc.de/v/32c3-7305-quantum_cryptography 	
CollegeHumor 	collegehumor 	6875289 	http://www.collegehumor.com/video/6875289/batman-says-his-goodbyes 	
Dailymotion 	dailymotion 	x1adiiw_archer-waking-up-as-h-jon-benjamin_shortfilms 	http://www.dailymotion.com/video/x1adiiw_archer-waking-up-as-h-jon-benjamin_shortfilms 	
Daum TVPot 	tvpot — <translate> Obtain the URL or ID from the share menu URL.</translate>	s9011HdLzYwpLwBodQzCHRB 	http://tvpot.daum.net/v/s9011HdLzYwpLwBodQzCHRB 	
Div Share 	divshare 	 	 	
Edutopia 	 	 	 	<translate> Edutopia content moved to YouTube.</translate> <translate> Please use the YouTube service selector below.</translate>
FunnyOrDie 	funnyordie 	c61fb67ac9 	http://www.funnyordie.com/videos/c61fb67ac9/to-catch-a-predator-elastic-heart-edition 	
Gfycat 	gfycat 	BruisedSilentAntarcticfurseal 	http://www.gfycat.com/BruisedSilentAntarcticfurseal 	
Hitbox 	hitbox 	Washuu 	http://www.hitbox.tv/Washuu 	
JW Player 	jwplayer 	cr5d8nbu-8ZpoNmmJ 	https://content.jwplatform.com/players/cr5d8nbu-8ZpoNmmJ.html 	
Kickstarter 	kickstarter 	elanlee/exploding-kittens 	https://www.kickstarter.com/projects/elanlee/exploding-kittens 	
Metacafe 	metacafe 	11404579 	http://www.metacafe.com/watch/11404579/lan_party_far_cry_4/ 	
Nico Nico Video 	nico 	sm24394325 	http://www.nicovideo.jp/watch/sm24394325 	
RuTube 	rutube 	b698163ccb67498db74d50cb0f22e556 	http://rutube.ru/video/b698163ccb67498db74d50cb0f22e556/ 	
SoundCloud 	soundcloud 	 	https://soundcloud.com/skrillex/skrillex-rick-ross-purple-lamborghini 	<translate> SoundCloud requires the full URL.</translate>
TeacherTube 	teachertube 	370511 	http://www.teachertube.com/video/thats-a-noun-sing-along-hd-version-370511 	
TED Talks 	ted 	bruce_aylward_humanity_vs_ebola_the_winning_strategies_in_a_terrifying_war	http://www.ted.com/talks/bruce_aylward_humanity_vs_ebola_the_winning_strategies_in_a_terrifying_war	
Tubi TV 	tubitv 	318409 	http://tubitv.com/video/318409 	
Tudou 	tudou 	mfQXfumwiew 	http://www.tudou.com/listplay/mfQXfumwiew.html 	
Twitch 	twitch 	twitchplayspokemon 	http://www.twitch.tv/twitchplayspokemon 	<translate> Live Streams</translate>
Twitch 	twitchvod 	twitchplayspokemon 	http://www.twitch.tv/twitchplayspokemon 	<translate> Archived Videos on Demand</translate>
Videomaten 	videomaten 	 	 	
Vimeo 	vimeo 	105035718 	http://vimeo.com/105035718 	
Vine 	vine 	h2B7WMtuX2t 	https://vine.co/v/h2B7WMtuX2t 	
Yahoo Screen 	yahoo 	katy-perry-dances-sharks-2015-024409668 	https://screen.yahoo.com/videos-for-you/katy-perry-dances-sharks-2015-024409668.html 	
YouTube 	youtube 	pSsYTj9kCHE 	https://www.youtube.com/watch?v=pSsYTj9kCHE 	<translate> Single videos</translate>
YouTube 	youtubeplaylist 	pSsYTj9kCHE 	https://www.youtube.com/watch?v=CW_PbErQ_c8&list=PL76E80C7F756A2047 	<translate> Playlists</translate>
YouTube 	youtubevideolist 	pSsYTj9kCHE 	https://www.youtube.com/watch?v=CW_PbErQ_c8&playlist=CW_PbErQ_c8,CW_PbErQ_c8 	<translate> Video list</translate>
Youku 	youku 	XODc3NDgzMTY4 	http://v.youku.com/v_show/id_XODc3NDgzMTY4.html 	
<translate>
== Installation == 
</translate>
<translate>
== Configuration == 
</translate>
<translate> Variable</translate>	<translate> Default value</translate>	<translate> Type</translate> 	<translate> Description</translate>
$wgEmbedVideoAddFileExtensions 	 	<translate> Boolean</translate>	<translate> Enable or disable adding video/audio file extensions to the list of allowable files to be uploaded.</translate>
$wgEmbedVideoEnableVideoHandler 	 	<translate> Boolean</translate>	<translate> Enable or disable the video media handlers for displaying embedded video in articles.</translate>
$wgEmbedVideoEnableAudioHandler 	 	<translate> Boolean</translate>	<translate> Enable or disable the audio media handlers for displaying embedded audio in articles.</translate>
$wgEmbedVideoDefaultWidth 	'' 	<translate> Integer</translate>	<translate> Globally override the default width of video players.</translate> <translate> When not set this uses the video service's default width which is typically 640 pixels.</translate>
$wgEmbedVideoMinWidth 	'' 	<translate> Integer</translate>	<translate> Minimum width of video players.</translate> <translate> Widths specified below this value will be automatically bounded to it.</translate>
$wgEmbedVideoMaxWidth 	'' 	<translate> Integer</translate>	<translate> Maximum width of video players.</translate> <translate> Widths specified above this value will be automatically bounded to it.</translate>
$wgFFmpegLocation 	 	<translate> String</translate> 	<translate> Set the location of the <tvar name=1>ffmpeg</tvar> binary.</translate>
$wgFFprobeLocation 	 	<translate> String</translate> 	<translate> Set the location of the <tvar name=1>ffprobe</tvar> binary.</translate>
<translate>
== Version history == 
</translate>
; v2.9.0
* Fix stored XSS in AudioTransformOutput and VideoTransformOutput.
* Fix autoResize on mobile.
* Fix video caption escaping the container.
* Handle multiple video sizes per page in resize.
* Move beam service to mixer.
* Add a default link title for #evl/#vlink.
* Add spotify playlist embeds.
* Add facebook video embeds.
* Fix centering of videos.
* Add Microsoft Stream service.
* Add title to iframes.
* Add API help messages for 1.33 compatibility.
* Fix static analysis issues.
* Fix Twitch embeds.
; v2.8.0
* Renamed hitbox.tv to smashcast.tv.
* Updated Nico Video embed code.
* Added support for Twitch clips.
* Fix issues with Twitch VODs.
* Removed unused $wgFFmpegLocation that was interferring with TimedMediaHandler.
* Added Polish translation.
; v2.7.4
* Added support for playlist to evlplayer
* Added support for youtube video list
* Updated Documentation for evlplayer
* Added missing dependency for evlplayer in extension.json
; v2.7.3
* Default Twitch VOD to autoplay=false by default
* Allow videos to be sized in 1:1 aspect ratios for special use cases.
; v2.7.2
* Added feature to evlplayer to allow default video content
; v2.7.1
* Fixed issue with youku videos not embedding properly on https enabled wikis.
; v2.7.0
* Added SoundCloud support
* Added ability to use service name as a parser tag (if not defined previously)
; v2.6.1
* Added new configuration options to disable adding media handlers and file extensions.
** https://gitlab.com/hydrawiki/extensions/EmbedVideo/issues/76
* Fixed an uninitialized array.
** https://gitlab.com/hydrawiki/extensions/EmbedVideo/issues/77
* Fixed undefined indexes in the AudioHandler class.
** https://gitlab.com/hydrawiki/extensions/EmbedVideo/issues/78
* Fixed class properties that were unintentionally declared as static.
** https://gitlab.com/hydrawiki/extensions/EmbedVideo/issues/75
* Fixed RTL language issues with CSS.
** https://gitlab.com/hydrawiki/extensions/EmbedVideo/pull/73
== 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:
{{#ev:youtube|{{{1}}}|{{{2|100}}}}}
And then call it like this:
{{youtube tn|someYoutubeId}}
=== Reporting bugs ===
There is an issue tracker set up on the GitLab project page.
=== Contributing ===
Bug reports, feature requests, and patches are always welcome. New contributors can be added to the GitLab project if there is sufficient interest.
== See also ==
* Fork of EmbedVideo — A more privacy centric version of this Extension. Note that only YouTube, Spotify, Vimeo and Archive.org is supported, but new services can be requested through GitHub. Moreover every parser function but #ev and the parser tags like <embedvideo>, <youtube> etc. are removedMediaWiki.org - Topic:W5ad54qjb5sbkg7b, 2021-04-23
== Weblinks ==
* Fandom Help Wiki / French
== References ==
Category:Video player extensions
Category:YouTube extensions