Template:EmbedVideo: Difference between revisions

From Dolphin Emulator Wiki
Jump to navigation Jump to search
(Using this template to generate the global documentation because it doesn't do anything, only show the embedvideo plugin usage. So, I can use it to generate the global documentation and showing plugin usage together ;D [WIP stage!])
(Using a variable to reduce the mess)
Line 1: Line 1:
<includeonly>This template provides a simplified way to use the [[Template:EmbedVideo|EmbedVideo]] plugin. It automatically uses the standard thumbnail size and position used on this wiki
<includeonly>This template provides a simplified way to use the [[Template:EmbedVideo|EmbedVideo]] plugin. It automatically uses the standard thumbnail size and position used on this wiki
 
{{#vardefine:servicename|{{#switch:{{{1}}}|dailymotion=Dailymotion|divshare=DivShare|funnyordie=Funny or Die|googlevideo=Google Video|interia=Interia|youtube=YouTube|vimeo=Vimeo}}}}
==Usage==
==Usage==
The {{#switch:{{{1}}}|dailymotion=Dailymotion|divshare=DivShare|funnyordie=Funny or Die|googlevideo=Google Video|interia=Interia|youtube=YouTube|vimeo=Vimeo}} template should be called in the following way:
The {{#var:servicename}} template should be called in the following way:
*<code><nowiki>{{{{#switch:{{{1}}}|dailymotion=Dailymotion|divshare=DivShare|funnyordie=Funny or Die|googlevideo=Google Video|interia=Interia|youtube=YouTube|vimeo=Vimeo}}|<videoID>|<title>|<options>}}</nowiki></code>
*<code><nowiki>{{{{#var:servicename}}|<videoID>|<title>|<options>}}</nowiki></code>
where
where
*<code>Video ID</code> is the ID is the bold part of the URL (<nowiki>http://www.youtube.com/watch?v=</nowiki>'''VqNcksMfAjM''')
*<code>Video ID</code> is the ID is the bold part of the URL (<nowiki>http://www.youtube.com/watch?v=</nowiki>'''VqNcksMfAjM''')
*<code>Title</code> (optional) is the caption for the video
*<code>Title</code> (optional) is the caption for the video
*<code>options</code> (optional) control some other functionalities of this template. Specifying <code>br</code> in this parameter tell the template to create a new row after embedding the video. Specifying <code>link</code> makes the template return only a hiperlink to watch the video on {{#switch:{{{1}}}|dailymotion=Dailymotion|divshare=DivShare|funnyordie=Funny or Die|googlevideo=Google Video|interia=Interia|youtube=YouTube|vimeo=Vimeo}}.
*<code>options</code> (optional) control some other functionalities of this template. Specifying <code>br</code> in this parameter tell the template to create a new row after embedding the video. Specifying <code>link</code> makes the template return only a hiperlink to watch the video on {{#var:servicename}}.


==Examples==
==Examples==
* Embed a video by specifying video ID and title. Titles longer than the box will automatically be truncated. We are embedding only one video, so we should add the <code>br</code> tag to the 3rd parameter. In this example, <code><nowiki>{{{{#switch:{{{1}}}|dailymotion=Dailymotion|divshare=DivShare|funnyordie=Funny or Die|googlevideo=Google Video|interia=Interia|youtube=YouTube|vimeo=Vimeo}}|VqNcksMfAjM|The Legend of Zelda: The Wind Waker Intro with title longer than box|br}}</nowiki></code> will produce this:
* Embed a video by specifying video ID and title. Titles longer than the box will automatically be truncated. We are embedding only one video, so we should add the <code>br</code> tag to the 3rd parameter. In this example, <code><nowiki>{{{{#var:servicename}}|VqNcksMfAjM|The Legend of Zelda: The Wind Waker Intro with title longer than box|br}}</nowiki></code> will produce this:
{{{{#switch:{{{1}}}|dailymotion=Dailymotion|divshare=DivShare|funnyordie=Funny or Die|googlevideo=Google Video|interia=Interia|youtube=YouTube|vimeo=Vimeo}}|VqNcksMfAjM|The Legend of Zelda: The Wind Waker Intro with title longer than box|br}}
{{{{#var:servicename}}|VqNcksMfAjM|The Legend of Zelda: The Wind Waker Intro with title longer than box|br}}


* Embed a video by specifying only video ID, so the 2nd parameter is null. We are embedding only one video, so we should add the <code>br</code> tag to the 3rd parameter. In this example, <code><nowiki>{{{{#switch:{{{1}}}|dailymotion=Dailymotion|divshare=DivShare|funnyordie=Funny or Die|googlevideo=Google Video|interia=Interia|youtube=YouTube|vimeo=Vimeo}}|VqNcksMfAjM||br}}</nowiki></code> make the template use URL as title since no title was entered:
* Embed a video by specifying only video ID, so the 2nd parameter is null. We are embedding only one video, so we should add the <code>br</code> tag to the 3rd parameter. In this example, <code><nowiki>{{{{#var:servicename}}|vimeo=Vimeo}}|VqNcksMfAjM||br}}</nowiki></code> make the template use URL as title since no title was entered:
{{{{#switch:{{{1}}}|dailymotion=Dailymotion|divshare=DivShare|funnyordie=Funny or Die|googlevideo=Google Video|interia=Interia|youtube=YouTube|vimeo=Vimeo}}|VqNcksMfAjM||br}}
{{{{#var:servicename}}|VqNcksMfAjM||br}}


* Return a hiperlink to watch the video on {{#switch:{{{1}}}|dailymotion=Dailymotion|divshare=DivShare|funnyordie=Funny or Die|googlevideo=Google Video|interia=Interia|youtube=YouTube|vimeo=Vimeo}} by specifying video ID and title. We want only the hiperlink, so we should add the <code>link</code> tag to the 3rd parameter. In this example, <code><nowiki>{{{{#switch:{{{1}}}|dailymotion=Dailymotion|divshare=DivShare|funnyordie=Funny or Die|googlevideo=Google Video|interia=Interia|youtube=YouTube|vimeo=Vimeo}}|VqNcksMfAjM|The Legend of Zelda: The Wind Waker Intro|link}}</nowiki></code> will produce this:
* Return a hiperlink to watch the video on {{#var:servicename}} by specifying video ID and title. We want only the hiperlink, so we should add the <code>link</code> tag to the 3rd parameter. In this example, <code><nowiki>{{{{#var:servicename}}|VqNcksMfAjM|The Legend of Zelda: The Wind Waker Intro|link}}</nowiki></code> will produce this:
:{{{{#switch:{{{1}}}|dailymotion=Dailymotion|divshare=DivShare|funnyordie=Funny or Die|googlevideo=Google Video|interia=Interia|youtube=YouTube|vimeo=Vimeo}}|VqNcksMfAjM|The Legend of Zelda: The Wind Waker Intro|link}}
:{{{{#var:servicename}}|VqNcksMfAjM|The Legend of Zelda: The Wind Waker Intro|link}}




* Return a hiperlink to watch the video on {{#switch:{{{1}}}|dailymotion=Dailymotion|divshare=DivShare|funnyordie=Funny or Die|googlevideo=Google Video|interia=Interia|youtube=YouTube|vimeo=Vimeo}} by specifying only video ID. We want only the hiperlink, so we should add the <code>link</code> tag to the 3rd parameter. In this example, <code><nowiki>{{{{#switch:{{{1}}}|dailymotion=Dailymotion|divshare=DivShare|funnyordie=Funny or Die|googlevideo=Google Video|interia=Interia|youtube=YouTube|vimeo=Vimeo}}|VqNcksMfAjM||link}}</nowiki></code> make the template use URL as title since no title was entered:
* Return a hiperlink to watch the video on {{#var:servicename}} by specifying only video ID. We want only the hiperlink, so we should add the <code>link</code> tag to the 3rd parameter. In this example, <code><nowiki>{{{{#var:servicename}}|VqNcksMfAjM||link}}</nowiki></code> make the template use URL as title since no title was entered:
:{{{{#switch:{{{1}}}|dailymotion=Dailymotion|divshare=DivShare|funnyordie=Funny or Die|googlevideo=Google Video|interia=Interia|youtube=YouTube|vimeo=Vimeo}}|VqNcksMfAjM||link}}
:{{{{#var:servicename}}|VqNcksMfAjM||link}}


==Notes==
==Notes==
* To use only video ID and an option, you must null the 2nd parameter by using ||, like this: <code><nowiki>{{YouTube|<videoID>||<options>}}</nowiki></code>
* To use only video ID and an option, you must null the 2nd parameter by using ||, like this: <code><nowiki>{{{{#var:servicename}}|<videoID>||<options>}}</nowiki></code>
* The 3rd parameter only accept one option. If you include more than one option, none of them will work.
* The 3rd parameter only accept one option. If you include more than one option, none of them will work.
* Using multiple calls will make the videos be side-by-side (the last video should ALWAYS include the <code>br</code> tag to the 3rd parameter):
* Using multiple calls will make the videos be side-by-side (the last video should ALWAYS include the <code>br</code> tag to the 3rd parameter):
{{{{#switch:{{{1}}}|dailymotion=Dailymotion|divshare=DivShare|funnyordie=Funny or Die|googlevideo=Google Video|interia=Interia|youtube=YouTube|vimeo=Vimeo}}|VqNcksMfAjM|The Legend of Zelda: The Wind Waker Intro}}
{{{{#var:servicename}}|VqNcksMfAjM|The Legend of Zelda: The Wind Waker Intro}}
{{{{#switch:{{{1}}}|dailymotion=Dailymotion|divshare=DivShare|funnyordie=Funny or Die|googlevideo=Google Video|interia=Interia|youtube=YouTube|vimeo=Vimeo}}|VqNcksMfAjM|The Legend of Zelda: The Wind Waker Intro}}
{{{{#var:servicename}}|VqNcksMfAjM|The Legend of Zelda: The Wind Waker Intro}}
{{{{#switch:{{{1}}}|dailymotion=Dailymotion|divshare=DivShare|funnyordie=Funny or Die|googlevideo=Google Video|interia=Interia|youtube=YouTube|vimeo=Vimeo}}|VqNcksMfAjM|The Legend of Zelda: The Wind Waker Intro|br}}
{{{{#var:servicename}}|VqNcksMfAjM|The Legend of Zelda: The Wind Waker Intro|br}}


* When you need one video in each row, you should add the <code>br</code> tag to the 3rd parameter of all videos, not just the last:
* When you need one video in each row, you should add the <code>br</code> tag to the 3rd parameter of all videos, not just the last:
{{{{#switch:{{{1}}}|dailymotion=Dailymotion|divshare=DivShare|funnyordie=Funny or Die|googlevideo=Google Video|interia=Interia|youtube=YouTube|vimeo=Vimeo}}|VqNcksMfAjM|The Legend of Zelda: The Wind Waker Intro|br}}
{{{{#var:servicename}}|VqNcksMfAjM|The Legend of Zelda: The Wind Waker Intro|br}}
{{{{#switch:{{{1}}}|dailymotion=Dailymotion|divshare=DivShare|funnyordie=Funny or Die|googlevideo=Google Video|interia=Interia|youtube=YouTube|vimeo=Vimeo}}|VqNcksMfAjM|The Legend of Zelda: The Wind Waker Intro|br}}
{{{{#var:servicename}}|VqNcksMfAjM|The Legend of Zelda: The Wind Waker Intro|br}}
{{{{#switch:{{{1}}}|dailymotion=Dailymotion|divshare=DivShare|funnyordie=Funny or Die|googlevideo=Google Video|interia=Interia|youtube=YouTube|vimeo=Vimeo}}|VqNcksMfAjM|The Legend of Zelda: The Wind Waker Intro}}
{{{{#var:servicename}}|VqNcksMfAjM|The Legend of Zelda: The Wind Waker Intro}}


* If you use this template and forget to add the <code>br</code> tag to the 3rd parameter after calling the last video, you'll get something weird, like this topic!</includeonly><noinclude>
* If you use this template and forget to add the <code>br</code> tag to the 3rd parameter after calling the last video, you'll get something weird, like this topic!</includeonly><noinclude>
{{documentation}}</noinclude>
{{documentation}}</noinclude>

Revision as of 14:47, 5 December 2012

[edit] [purge] Template documentation

The EmbedVideo Extension is a MediaWiki extension which adds a parser function called #ev for embedding video clips from over 24 popular video sharing services in multiple languages and countries.

Usage

Tags

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

#ev - Classic Parser Tag

  • {{#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}}

However, if needed optional arguments may be left blank by not putting anything between the pipes:

  • {{#ev:service|id|||description}}

#evt - Parser Tag for Templates

The #evt parser tag allows for key=value pairs which allows for easier templating and readability.

{{#evt:
service=youtube
|id=https://www.youtube.com/watch?v=pSsYTj9kCHE
|alignment=right
}}

<embedvideo> - Tag Hook

Videos can easily be embedded with the <embedvideo></embedvideo> tag hook. The ID/URL goes as the input between the tags and parameters can be added as the tag arguments.

<embedvideo service="youtube">https://www.youtube.com/watch?v=pSsYTj9kCHE</embedvideo>

Attributes for Parser Tags

Attribute Description
service="(See Supported Services below.)" Required: yes
The video service to call.
id="[id|url]" Required: yes
The raw ID of the video or URL from the player page.
dimensions="[WIDTH|WIDTHxHEIGHT|xHEIGHT]" Required: no, Default: 640
Dimensions in pixels to size the embed container. The standard format is width x height where either can be omitted, but the x must proceed height to indicate it as the height.
Examples: 480, 480x320, x320. 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. $wgEmbedVideoDefaultWidth can be set in LocalSettings.php to override the default width.
alignment="[left|center|right]" Required: no, Default: none
Align the placement of the video either to the left, centered, or to the right.
description="[wiki text]" Required: no, Default: none
Display a description under the embed container.
container="[frame]" Required: no, Default: none
Specifies the container type to use for the embed.
frame: Wrap the video player in a Mediawiki thumbnail box.
urlargs="modestbranding=1&version=3" Required: no, Default: none
Allows extra URL arguments to be appended to the generated embed URL. This is useful for obscure options only supported on one service.

Examples

For example, a video from YouTube use the 'youtube' service selector enter either the raw ID:

{{#ev:youtube|pSsYTj9kCHE}}

Or the full URL:

{{#ev:youtube|https://www.youtube.com/watch?v=pSsYTj9kCHE}}

To display the same video as a right aligned large thumbnail with a description:

{{#ev:youtube|https://www.youtube.com/watch?v=pSsYTj9kCHE|1000|right|Let eet GO|frame}}

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.

https://www.youtube.com/watch?v=pSsYTj9kCHE&start=76
{{#ev:youtube|https://www.youtube.com/watch?v=pSsYTj9kCHE|||||start=76}}

Supported Services

As of version 2.x, EmbedVideo supports embedding video content from the following services:

Site Service Name(s) ID Example URL Example(s)
Archive.org Videos archiveorg electricsheep-flock-244-80000-6 https://archive.org/details/electricsheep-flock-244-80000-6
 https://archive.org/embed/electricsheep-flock-244-80000-6
Bambuser bambuser - Broadcasts bambuser_channel - Channels 5262334 http://bambuser.com/v/5262334
Beam beam - Streams RocketBear https://beam.pro/RocketBear
Bing bing 31ncp9r7l http://www.bing.com/videos/watch/video/adorable-cats-attempt-to-eat-invisible-tuna/31ncp9r7l
Blip.tv blip - Blip requires the full URL to the video page and does not accept the raw ID. http://blip.tv/vinylrewind/review-6864612
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 - Obtain the URL or ID from the share menu URL. s9011HdLzYwpLwBodQzCHRB http://tvpot.daum.net/v/s9011HdLzYwpLwBodQzCHRB
Div Share divshare
Edutopia Edutopia content moved to YouTube. Please use the youtube service selector below.
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
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/
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
Tudou tudou mfQXfumwiew http://www.tudou.com/listplay/mfQXfumwiew.html
Twitch twitch - Live Streams twitchvod - Archived Videos on Demand twitchplayspokemon http://www.twitch.tv/twitchplayspokemon
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 - Single Videos youtubeplaylist - Playlists pSsYTj9kCHE https://www.youtube.com/watch?v=pSsYTj9kCHE
 https://www.youtube.com/watch?v=CW_PbErQ_c8&list=PL76E80C7F756A2047
Youku youku XODc3NDgzMTY4 http://v.youku.com/v_show/id_XODc3NDgzMTY4.html