Widget:YouTube: Difference between revisions

From Official Kodi Wiki
Jump to navigation Jump to search
No edit summary
(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 your wiki page.
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 ==
For information on how to use this widget, see the [https://www.mediawikiwidgets.org/YouTube widget description page on MediaWikiWidgets.org].
To insert this widget, use the following code:


== Copy to your site ==
  <nowiki>{{#widget:YouTube|id=DWef69ItVrU}}</nowiki>
To use this widget on your site, just install the [https://www.mediawiki.org/wiki/Extension:Widgets MediaWiki Widgets extension] and the copy [{{fullurl:{{FULLPAGENAME}}|action=edit}} full source code] of this page to your wiki, as an article called '''{{FULLPAGENAME}}'''.
 
</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'}-->?rel=0<!--{/if}-->" style="border: none" allowfullscreen></iframe></includeonly>
== 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