Widget:YouTube: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
RogueScholar (talk | contribs) (Using aforementioned cosmic powers to make this widget comply with best practices and always load via HTTPS and support the 'start' parameter for defining a timestamp to begin playing at, plus add documentation) |
||
Line 1: | Line 1: | ||
<noinclude> | <noinclude> | ||
This widget allows you to add a [https://developers.google.com/youtube/player_parameters YouTube video player] to | This widget allows you to add a [https://developers.google.com/youtube/player_parameters YouTube video player] to wiki pages. | ||
== Using this widget == | == Using this widget == | ||
To insert this widget, use the following code: | |||
== | <nowiki>{{#widget:YouTube|id=DWef69ItVrU}}</nowiki> | ||
</noinclude><includeonly><iframe width="<!--{$width|escape:'html'|default:'425'}-->" height="<!--{$height|escape:'html'|default:355}-->" src="//www.youtube.com/embed/<!--{if isset($playlist)}-->?listType=playlist&list=<!--{$playlist|escape:'urlpathinfo'}--><!--{else}--><!--{$id|escape:'urlpathinfo'}-->? | == Parameters == | ||
* '''{{Para|id}}''' - video ID (from the URL) | |||
* '''{{Para|start}}''' - timestamp of starting point within the video in seconds | |||
* '''{{Para|playlist}}''' - playlist name (starts with PL) - first clip is played ({{Para|id}} and {{Para|start}} are ignored) | |||
* '''{{Para|height}}''' and '''{{Para|width}}''' define view dimensions, 425x355 are the defaults</noinclude> | |||
<includeonly><iframe width="<!--{$width|escape:'html'|default:'425'}-->" height="<!--{$height|escape:'html'|default:355}-->" src="https://www.youtube.com/embed/<!--{if isset($playlist)}-->?listType=playlist&list=<!--{$playlist|escape:'urlpathinfo'}--><!--{else}--><!--{$id|escape:'urlpathinfo'}--><!--{if isset($start)}-->?start=<!--{$start|escape:'urlpathinfo'}--><!--{/if}--><!--{/if}-->" style="border: none" allowfullscreen></iframe></includeonly> |
Latest revision as of 06:59, 7 November 2022
This widget allows you to add a YouTube video player to wiki pages.
Using this widget
To insert this widget, use the following code:
{{#widget:YouTube|id=DWef69ItVrU}}
Parameters
|id=
- video ID (from the URL)|start=
- timestamp of starting point within the video in seconds|playlist=
- playlist name (starts with PL) - first clip is played (|id=
and|start=
are ignored)|height=
and|width=
define view dimensions, 425x355 are the defaults