Template:EmbedVideo/doc: Difference between revisions

Jump to navigation Jump to search
Update doc for 2.x version
(Update doc for 2.x version)
 
(6 intermediate revisions by 2 users not shown)
Line 1: Line 1:
The EmbedVideo Extension is a MediaWiki extension which adds parser functions called #ev and #evp for embedding video clips from popular video sharing services.
The '''EmbedVideo''' Extension is a MediaWiki extension which adds a parser function called <tt>#ev</tt> for embedding video clips from over 24 popular video sharing services in multiple languages and countries.


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


The EmbedVideo parser function expects to be called in any of the following ways:
====#ev - Classic Parser Tag====
* <tt><nowiki>{{#ev:service|id}}</nowiki></tt>
* <code><nowiki>{{#ev:service|id}}</nowiki></code>
* <tt><nowiki>{{#ev:service|id|width}}</nowiki></tt>
* <code><nowiki>{{#ev:service|id|dimensions}}</nowiki></code>
* <tt><nowiki>{{#ev:service|id|width|align}}</nowiki></tt>
* <code><nowiki>{{#ev:service|id|dimensions|alignment}}</nowiki></code>
* <tt><nowiki>{{#ev:service|id|width|align|desc}}</nowiki></tt>
* <code><nowiki>{{#ev:service|id|dimensions|alignment|description}}</nowiki></code>
* <tt><nowiki>{{#evp:service|id|desc}}</nowiki></tt>
* <code><nowiki>{{#ev:service|id|dimensions|alignment|description|container}}</nowiki></code>
* <tt><nowiki>{{#evp:service|id|desc|align}}</nowiki></tt>
* <code><nowiki>{{#ev:service|id|dimensions|alignment|description|container|urlargs}}</nowiki></code>
* <tt><nowiki>{{#evp:service|id|desc|align|width}}</nowiki></tt>


Where:
However, if needed optional arguments may be left blank by not putting anything between the pipes:
* <tt>service</tt> is the name of a video sharing service (See "service name" in the list below)
* <code><nowiki>{{#ev:service|id|||description}}</nowiki></code>
* <tt>id</tt> is the id of the video to include
* <tt>width</tt> (optional) is the width in pixels of the viewing area (height will be determined automatically)
* <tt>align</tt> (optional) is an alignment (float) attribute. May be "left" or "right".
* <tt>desc</tt> (optional) is a short description to display beneath the video when it is aligned


==Examples==
====#evt - Parser Tag for Templates====
The <nowiki>#evt</nowiki> parser tag allows for key=value pairs which allows for easier templating and readability.


A video of this URL:
<pre><nowiki>{{#evt:
service=youtube
|id=https://www.youtube.com/watch?v=pSsYTj9kCHE
|alignment=right
}}</nowiki></pre>


<pre>http://www.youtube.com/watch?v=R9u_BJXRyuI</pre>
====<nowiki><embedvideo></nowiki> - Tag Hook====
Videos can easily be embedded with the <nowiki><embedvideo></embedvideo></nowiki> tag hook.  The ID/URL goes as the input between the tags and parameters can be added as the tag arguments.


Would end up like this with the EmbedVideo plugin:
<pre><nowiki><embedvideo service="youtube">https://www.youtube.com/watch?v=pSsYTj9kCHE</embedvideo></nowiki></pre>


<pre>{{#ev:youtube|R9u_BJXRyuI}}</pre>
=== Attributes for Parser Tags ===
{| class="wikitable"
|-
! Attribute
! Description
|-
| <code>service="<nowiki>(See Supported Services below.)</nowiki>"</code>
| '''Required:''' yes
:The video service to call.
|-
| <code>id="<nowiki>[id|url]</nowiki>"</code>
| '''Required:''' yes
:The raw ID of the video or URL from the player page.
|-
| <code>dimensions="<nowiki>[WIDTH|WIDTHxHEIGHT|xHEIGHT]</nowiki>"</code>
| '''Required:''' no, '''Default:''' <tt>640</tt>
:Dimensions in pixels to size the embed container.  The standard format is width x height where either can be omitted, but the <tt>x</tt> must proceed height to indicate it as the height.
:Examples: <tt>480</tt>, <tt>480x320</tt>, <tt>x320</tt>.  If the height is not provided it will be calculated automatically from the width and service default ratio.
:Some services such as ''Gfycat'' do not have standard heights and should be specified for each embed.  <tt>$wgEmbedVideoDefaultWidth</tt> can be set in <tt>LocalSettings.php</tt> to override the default width.
|-
| <code>alignment="<nowiki>[left|center|right]</nowiki>"</code>
| '''Required:''' no, '''Default:''' <tt>none</tt>
:Align the placement of the video either to the left, centered, or to the right.
|-
| <code>description="<nowiki>[wiki text]</nowiki>"</code>
| '''Required:''' no, '''Default:''' <tt>none</tt>
:Display a description under the embed container.
|-
| <code>container="<nowiki>[frame]</nowiki>"</code>
| '''Required:''' no, '''Default:''' <tt>none</tt>
:Specifies the container type to use for the embed.
::<tt>frame</tt>: Wrap the video player in a Mediawiki thumbnail box.
|-
| <code>urlargs="<nowiki>modestbranding=1&version=3</nowiki>"</code>
| '''Required:''' no, '''Default:''' <tt>none</tt>
:Allows extra URL arguments to be appended to the generated embed URL.  This is useful for obscure options only supported on one service.
|}


It could be further modified by reducing it's size, aligning it, etc etc, as outlined above. That video at 100px wide, left alignment, and a description, would be like so:
=== Examples ===
For example, a video from YouTube use the 'youtube' service selector enter either the raw ID:
<pre>{{#ev:youtube|pSsYTj9kCHE}}</pre>
Or the full URL:
<pre>{{#ev:youtube|https://www.youtube.com/watch?v=pSsYTj9kCHE}}</pre>


<pre>{{#ev:youtube|R9u_BJXRyuI|100|left|super smash bros brawl in 3d dolphin emulator}}</pre>
To display the same video as a right aligned large thumbnail with a description:
<pre>{{#ev:youtube|https://www.youtube.com/watch?v=pSsYTj9kCHE|1000|right|Let eet GO|frame}}</pre>


==Supported Services==
For YouTube to have the video start at a specific time code utilize the urlargs(URL arguments) parameter.  Take the rest of the URL arguments from the custom URL and place them into the urlargs.  Please note that not all video services support extra URL arguments or may have different keys for their URL arguments.
<pre>https://www.youtube.com/watch?v=pSsYTj9kCHE&start=76</pre>
<pre>{{#ev:youtube|https://www.youtube.com/watch?v=pSsYTj9kCHE|||||start=76}}</pre>


As of version 1.0, EmbedVideo supports embedding video content from the following services:
=== Supported Services ===
As of version 2.x, EmbedVideo supports embedding video content from the following services:
{| class="wikitable"
{| class="wikitable"
|-
|-
! Site  
! Site  
! Service Name
! colspan="2"|Service Name(s)
! ID Example
! URL Example(s)
|-
! [https://archive.org/details/movies Archive.org Videos]
| colspan="2"|<tt>archiveorg</tt>
| <nowiki>electricsheep-flock-244-80000-6</nowiki>
| <nowiki>https://archive.org/details/electricsheep-flock-244-80000-6</nowiki>
  <nowiki>https://archive.org/embed/electricsheep-flock-244-80000-6</nowiki>
|-
! [http://bambuser.com/ Bambuser]
| <tt>bambuser</tt> - Broadcasts
| <tt>bambuser_channel</tt> - Channels
| <nowiki>5262334</nowiki>
| <nowiki>http://bambuser.com/v/5262334</nowiki>
|-
! [https://beam.pro/ Beam]
| colspan="2"|<tt>beam</tt> - Streams
| <nowiki>RocketBear</nowiki>
| <nowiki>https://beam.pro/RocketBear</nowiki>
|-
! [http://www.bing.com/videos/ Bing]
| colspan="2"|<tt>bing</tt>
| <nowiki>31ncp9r7l</nowiki>
| <nowiki>http://www.bing.com/videos/watch/video/adorable-cats-attempt-to-eat-invisible-tuna/31ncp9r7l</nowiki>
|-
! [http://www.blip.tv/ Blip.tv]
| colspan="2"|<tt>blip</tt> - Blip requires the full URL to the video page and does not accept the raw ID.
|
|<nowiki>http://blip.tv/vinylrewind/review-6864612</nowiki>
|-
! [http://www.collegehumor.com/ CollegeHumor]
| colspan="2"|<tt>collegehumor</tt>
| <nowiki>6875289</nowiki>
| <nowiki>http://www.collegehumor.com/video/6875289/batman-says-his-goodbyes</nowiki>
|-
|-
! [http://www.dailymotion.com/ Dailymotion]  
! [http://www.dailymotion.com/ Dailymotion]  
| <tt>dailymotion</tt>
| colspan="2"|<tt>dailymotion</tt>
| <nowiki>x1adiiw_archer-waking-up-as-h-jon-benjamin_shortfilms</nowiki>
| <nowiki>http://www.dailymotion.com/video/x1adiiw_archer-waking-up-as-h-jon-benjamin_shortfilms</nowiki>
|-
! [http://tvpot.daum.net/ Daum TVPot]
| colspan="2"|<tt>tvpot</tt> - Obtain the URL or ID from the share menu URL.
| <nowiki>s9011HdLzYwpLwBodQzCHRB</nowiki>
| <nowiki>http://tvpot.daum.net/v/s9011HdLzYwpLwBodQzCHRB</nowiki>
|-
! [http://www.divshare.com Div Share]
| colspan="2"|<tt>divshare</tt>
|
|
|-
! [http://edutopia.org Edutopia]
| colspan="2"|Edutopia content moved to YouTube.  Please use the youtube service selector below.
|
|
|-
! [http://www.funnyordie.com/ FunnyOrDie]
| colspan="2"|<tt>funnyordie</tt>
| <nowiki>c61fb67ac9</nowiki>
| <nowiki>http://www.funnyordie.com/videos/c61fb67ac9/to-catch-a-predator-elastic-heart-edition</nowiki>
|-
! [http://gfycat.com/ Gfycat]
| colspan="2"|<tt>gfycat</tt>
| <nowiki>BruisedSilentAntarcticfurseal</nowiki>
| <nowiki>http://www.gfycat.com/BruisedSilentAntarcticfurseal</nowiki>
|-
! [http://www.hitbox.tv/ Hitbox]
| colspan="2"|<tt>hitbox</tt>
| <nowiki>Washuu</nowiki>
| <nowiki>http://www.hitbox.tv/Washuu</nowiki>
|-
|-
! Div Share
! [http://www.kickstarter.com/ Kickstarter]
| <tt>DivShare</tt>
| colspan="2"|<tt>kickstarter</tt>
| <nowiki>elanlee/exploding-kittens</nowiki>
| <nowiki>https://www.kickstarter.com/projects/elanlee/exploding-kittens</nowiki>
|-
|-
! [http://edutopia.org Edutopia]  
! [http://www.metacafe.com/ Metacafe]
| <tt>edutopia</tt>
| colspan="2"|<tt>metacafe</tt>
| <nowiki>11404579</nowiki>
| <nowiki>http://www.metacafe.com/watch/11404579/lan_party_far_cry_4/</nowiki>
|-
|-
! [http://www.funnyordie.com/ FunnyOrDie]  
! [http://www.nicovideo.jp/ Nico Nico Video]
| <tt>funnyordie</tt>
| colspan="2"|<tt>nico</tt>
| <nowiki>sm24394325</nowiki>
| <nowiki>http://www.nicovideo.jp/watch/sm24394325</nowiki>
|-
|-
! [http://video.google.com/ Google Video]  
! [http://rutube.ru/ RuTube]
| <tt>googlevideo</tt>
| colspan="2"|<tt>rutube</tt>
| <nowiki>b698163ccb67498db74d50cb0f22e556</nowiki>
| <nowiki>http://rutube.ru/video/b698163ccb67498db74d50cb0f22e556/</nowiki>
|-
|-
! [http://interia.pl/ Interia]  
! [http://teachertube.com TeacherTube]
| <tt>interia</tt> or <tt>interiavideo</tt>
| colspan="2"|<tt>teachertube</tt>
| <nowiki>370511</nowiki>
| <nowiki>http://www.teachertube.com/video/thats-a-noun-sing-along-hd-version-370511</nowiki>
|-
|-
! [http://revver.com/ Revver]  
! [http://www.ted.com/talks/browse/ TED Talks]
| <tt>revver</tt>
| colspan="2"|<tt>ted</tt>
| <nowiki>bruce_aylward_humanity_vs_ebola_the_winning_strategies_in_a_terrifying_war</nowiki>
| <nowiki>http://www.ted.com/talks/bruce_aylward_humanity_vs_ebola_the_winning_strategies_in_a_terrifying_war</nowiki>
|-
|-
! [http://sevenload.com/ sevenload]  
! [http://www.tudou.com/ Tudou]
| <tt>sevenload</tt>
| colspan="2"|<tt>tudou</tt>
| <nowiki>mfQXfumwiew</nowiki>
| <nowiki>http://www.tudou.com/listplay/mfQXfumwiew.html</nowiki>
|-
|-
! [http://teachertube.org TeacherTube]  
! [http://www.twitch.tv Twitch]
| <tt>teachertube</tt>
| <tt>twitch</tt> - Live Streams
| <tt>twitchvod</tt> - Archived Videos on Demand
| <nowiki>twitchplayspokemon</nowiki>
| <nowiki>http://www.twitch.tv/twitchplayspokemon</nowiki>
|-
|-
! [http://www.youtube.com/ YouTube]  
! [http://89.160.51.62/recordme/spelain.htm Videomaten]
| <tt>youtube</tt> and <tt>youtubehd</tt>
| colspan="2"|<tt>videomaten</tt>
|
|
|-
|-
! [http://www.vimeo.com Vimeo]
! [http://www.vimeo.com Vimeo]
| <tt>vimeo</tt>
| colspan="2"|<tt>vimeo</tt>
| <nowiki>105035718</nowiki>
| <nowiki>http://vimeo.com/105035718</nowiki>
|-
! [http://vine.co Vine]
| colspan="2"|<tt>vine</tt>
| <nowiki>h2B7WMtuX2t</nowiki>
| <nowiki>https://vine.co/v/h2B7WMtuX2t</nowiki>
|-
! [http://screen.yahoo.com/ Yahoo Screen]
| colspan="2"|<tt>yahoo</tt>
| <nowiki>katy-perry-dances-sharks-2015-024409668</nowiki>
| <nowiki>https://screen.yahoo.com/videos-for-you/katy-perry-dances-sharks-2015-024409668.html</nowiki>
|-
! [http://www.youtube.com/ YouTube]
| <tt>youtube</tt> - Single Videos
| <tt>youtubeplaylist</tt> - Playlists
| <nowiki>pSsYTj9kCHE</nowiki>
| <nowiki>https://www.youtube.com/watch?v=pSsYTj9kCHE</nowiki>
  <nowiki>https://www.youtube.com/watch?v=CW_PbErQ_c8&list=PL76E80C7F756A2047</nowiki>
|-
! [http://www.youku.com/ Youku]
| colspan="2"|<tt>youku</tt>
| <nowiki>XODc3NDgzMTY4</nowiki>
| <nowiki>http://v.youku.com/v_show/id_XODc3NDgzMTY4.html</nowiki>
|-
|}
|}

Navigation menu