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)
 
(4 intermediate revisions by 2 users not shown)
Line 1: Line 1:
<noinclude>
<noinclude>
This widget allows you to add 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.


It was created by [http://www.mediawikiwidgets.org/User:Yaron_Koren Yaron Koren].
== Using this widget ==
To insert this widget, use the following code:


== Using this widget ==
  <nowiki>{{#widget:YouTube|id=DWef69ItVrU}}</nowiki>
For information on how to use this widget, see [http://www.mediawikiwidgets.org/YouTube widget description page on MediaWikiWidgets.org].


== Copy to your site ==
== Parameters ==
To use this widget on your site, just install [http://www.mediawiki.org/wiki/Extension:Widgets MediaWiki Widgets extension] and copy [{{fullurl:{{FULLPAGENAME}}|action=edit}} full source code] of this page to your wiki as '''{{FULLPAGENAME}}''' article.
* '''{{Para|id}}''' - video ID (from the URL)
</noinclude><includeonly><span style=float: left><iframe width="<!--{$width|escape:'html'|default:'569'}-->" height="<!--{$height|escape:'html'|default:320}-->" src="http://www.youtube.com/embed/<!--{$id|escape:'urlpathinfo'}-->" frameborder="0" allowfullscreen></iframe></embed></object></span></includeonly>
* '''{{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