Difference between revisions of "Help:Embed Videos"
SamSteiner (talk | contribs) |
SamSteiner (talk | contribs) |
||
Line 1: | Line 1: | ||
__TOC__ | __TOC__ | ||
− | + | The '''EmbedVideo''' extension adds a parser function called <code>#ev</code> for embedding video clips from over 24 popular video sharing services in multiple languages and countries. It also adds video and audio media handlers to support transforming standard <nowiki>[[File:Example.mp4]]</nowiki> file links into embedded HTML5 <nowiki><video></nowiki> and <nowiki><audio></nowiki> tags. | |
− | The EmbedVideo | + | ;Project Homepage: [https://github.com/HydraWiki/mediawiki-embedvideo Documentation at Github] |
+ | ;Source Code: [https://github.com/HydraWiki/mediawiki-embedvideo Source code at Github] | ||
+ | ;Bugs:[https://github.com/HydraWiki/mediawiki-embedvideo/issues issues at Github] | ||
+ | ;Licensing: EmbedVideo is released under [http://www.opensource.org/licenses/mit-license.php The MIT License]. | ||
+ | |||
+ | <span style="font-weight: bold; color: darkred;">Notice:</span> As of the 2.x series the EmbedVideo extension has a new maintainer and an entirely rewritten code base. It retains backwards compatibility with EmbedVideo 1.0 and EmbedVideoPlus. | ||
+ | |||
+ | ==Installation== | ||
+ | |||
+ | {{TNT|ExtensionInstall | ||
+ | |registration=required | ||
+ | |download-link=[https://github.com/HydraWiki/mediawiki-embedvideo/archive/v2.7.0.zip Download] | ||
+ | |custom-steps=* [[#Configuration|Configure as required]] | ||
+ | }} | ||
+ | |||
+ | ==Usage== | ||
+ | |||
+ | === Media Handler === | ||
+ | For locally uploaded content the process for displaying it on a page is the same as an image. [https://www.mediawiki.org/wiki/Help:Images#Syntax See the image syntax documentation] on MediaWiki.org for complete reference on this feature. | ||
+ | |||
+ | This example would display a video in page using a HTML5 `<video>` tag. | ||
+ | |||
+ | <pre><nowiki>[[File:Example.mp4]]</nowiki></pre> | ||
+ | |||
+ | To specify the start and end timestamps in the media use the start and end parameters. The timestamp can be formatted as one of: ss, :ss, mm:ss, hh:mm:ss, or dd:hh:mm:ss. | ||
+ | |||
+ | <pre><nowiki>[[File:Example.mp4|start=2|end=6]]</nowiki></pre> | ||
+ | |||
+ | === 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: | ||
− | * <nowiki>{{#ev:service|id}}</nowiki> | + | ====<code>#ev</code> - Classic Parser Tag==== |
− | * <nowiki>{{#ev:service|id| | + | * <code><nowiki>{{#ev:service|id}}</nowiki></code> |
− | * <nowiki>{{#ev:service|id| | + | * <code><nowiki>{{#ev:service|id|dimensions}}</nowiki></code> |
− | * <nowiki>{{#ev:service|id| | + | * <code><nowiki>{{#ev:service|id|dimensions|alignment}}</nowiki></code> |
− | * <nowiki>{{# | + | * <code><nowiki>{{#ev:service|id|dimensions|alignment|description}}</nowiki></code> |
− | * <nowiki>{{# | + | * <code><nowiki>{{#ev:service|id|dimensions|alignment|description|container}}</nowiki></code> |
− | * <nowiki>{{# | + | * <code><nowiki>{{#ev:service|id|dimensions|alignment|description|container|urlargs}}</nowiki></code> |
+ | * <code><nowiki>{{#ev:service|id|dimensions|alignment|description|container|urlargs|autoresize}}</nowiki></code> | ||
+ | * <code><nowiki>{{#ev:service|id|dimensions|alignment|description|container|urlargs|autoresize|valignment}}</nowiki></code> | ||
+ | |||
+ | However, if needed optional arguments may be left blank by not putting anything between the pipes: | ||
+ | * <code><nowiki>{{#ev:service|id|||description}}</nowiki></code> | ||
+ | |||
+ | ====<code>#evt</code> - Parser Tag for Templates==== | ||
+ | The <nowiki>#evt</nowiki> parser tag allows for key=value pairs which allows for easier templating and readability. | ||
+ | |||
+ | <pre><nowiki>{{#evt: | ||
+ | service=youtube | ||
+ | |id=https://www.youtube.com/watch?v=pSsYTj9kCHE | ||
+ | |alignment=right | ||
+ | }}</nowiki></pre> | ||
+ | |||
+ | ====<code>#evu</code> - Parser Tag for URLs==== | ||
+ | The <nowiki>#evu</nowiki> parser tag is like the <nowiki>#evt</nowiki> tag, but its first parameter is a URL that will be parsed to determine the service automatically. | ||
+ | |||
+ | <pre><nowiki>{{#evu:https://www.youtube.com/watch?v=pSsYTj9kCHE | ||
+ | |alignment=right | ||
+ | }}</nowiki></pre> | ||
+ | |||
+ | ====<code><embedvideo></code> - 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. | ||
− | + | <pre><nowiki><embedvideo service="youtube">https://www.youtube.com/watch?v=pSsYTj9kCHE</embedvideo></nowiki></pre> | |
− | + | Alternativly, you can also use the service id as the tag (assuming another extension isn't already using this tag). | |
− | |||
− | |||
− | |||
− | |||
− | + | <pre><nowiki><youtube>https://www.youtube.com/watch?v=pSsYTj9kCHE</youtube></nowiki></pre> | |
− | <pre> | ||
− | <nowiki> | ||
− | </ | ||
− | |||
− | |||
− | |||
− | </pre> | ||
− | |||
− | |||
− | + | === Attributes for Parser Tags === | |
{| class="wikitable" | {| 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:''' <code>640</code> | ||
+ | :Dimensions in pixels to size the embed container. The standard format is width x height where either can be omitted, but the <code>x</code> must proceed height to indicate it as the height. | ||
+ | :Examples: <code>480</code>, <code>480x320</code>, <code>x320</code>. 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. <code>$wgEmbedVideoDefaultWidth</code> can be set in <code>LocalSettings.php</code> to override the default width. | ||
|- | |- | ||
− | | [ | + | | <code>alignment="<nowiki>[left|center|right|inline]</nowiki>"</code> |
+ | | '''Required:''' no, '''Default:''' <code>none</code> | ||
+ | :Align the placement of the video either to the left, centered, or to the right. Inline will allow multiple videos to display side by side without forced line breaks. | ||
|- | |- | ||
− | | [ | + | | <code>description="<nowiki>[wiki text]</nowiki>"</code> |
+ | | '''Required:''' no, '''Default:''' <code>none</code> | ||
+ | :Display a description under the embed container. | ||
|- | |- | ||
− | | [ | + | | <code>container="<nowiki>[frame]</nowiki>"</code> |
+ | | '''Required:''' no, '''Default:''' <code>none</code> | ||
+ | :Specifies the container type to use for the embed. | ||
+ | ::<code>frame</code>: Wrap the video player in a Mediawiki thumbnail box. | ||
|- | |- | ||
− | | | + | | <code>urlargs="<nowiki>modestbranding=1&version=3</nowiki>"</code> |
+ | | '''Required:''' no, '''Default:''' <code>none</code> | ||
+ | :Allows extra URL arguments to be appended to the generated embed URL. This is useful for obscure options only supported on one service. | ||
|- | |- | ||
− | | | + | | <code>autoresize="<nowiki>false</nowiki>"</code> |
+ | | '''Required:''' no, '''Default:''' <code>true</code> | ||
+ | :Automatically resize videos when their size will cause them to break outside of their container element. | ||
|- | |- | ||
− | | [ | + | | <code>valignment="<nowiki>[top|middle|bottom|baseline]</nowiki>"</code> |
+ | | '''Required:''' no, '''Default:''' <code>none</code> | ||
+ | :Align the vertical placement of the video either to the top, middle, bottom, or baseline of the parent element. Using this parameter forces the alignment parameter to be inline. | ||
|} | |} |
Revision as of 20:46, 1 February 2018
The EmbedVideo extension adds a parser function called #ev
for embedding video clips from over 24 popular video sharing services in multiple languages and countries. It also adds video and audio media handlers to support transforming standard [[File:Example.mp4]] file links into embedded HTML5 <video> and <audio> tags.
- Project Homepage
- Documentation at Github
- Source Code
- Source code at Github
- Bugs
- issues at Github
- Licensing
- EmbedVideo is released under The MIT License.
Notice: As of the 2.x series the EmbedVideo extension has a new maintainer and an entirely rewritten code base. It retains backwards compatibility with EmbedVideo 1.0 and EmbedVideoPlus.
Installation
{{ ExtensionInstall
/en }}
Usage
Media Handler
For locally uploaded content the process for displaying it on a page is the same as an image. See the image syntax documentation on MediaWiki.org for complete reference on this feature.
This example would display a video in page using a HTML5 `<video>` tag.
[[File:Example.mp4]]
To specify the start and end timestamps in the media use the start and end parameters. The timestamp can be formatted as one of: ss, :ss, mm:ss, hh:mm:ss, or dd:hh:mm:ss.
[[File:Example.mp4|start=2|end=6]]
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}}
{{#ev:service|id|dimensions|alignment|description|container|urlargs|autoresize}}
{{#ev:service|id|dimensions|alignment|description|container|urlargs|autoresize|valignment}}
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 }}
#evu
- Parser Tag for URLs
The #evu parser tag is like the #evt tag, but its first parameter is a URL that will be parsed to determine the service automatically.
{{#evu:https://www.youtube.com/watch?v=pSsYTj9kCHE |alignment=right }}
====
EmbedVideo is missing a required parameter.
</nowiki> 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>
Alternativly, you can also use the service id as the tag (assuming another extension isn't already using this tag).
<youtube>https://www.youtube.com/watch?v=pSsYTj9kCHE</youtube>
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|inline]"
Required: no, Default: none
- Align the placement of the video either to the left, centered, or to the right. Inline will allow multiple videos to display side by side without forced line breaks.
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.
autoresize="false"
Required: no, Default: true
- Automatically resize videos when their size will cause them to break outside of their container element.
valignment="[top|middle|bottom|baseline]"
Required: no, Default: none
- Align the vertical placement of the video either to the top, middle, bottom, or baseline of the parent element. Using this parameter forces the alignment parameter to be inline.