Widget:YouTube: Difference between revisions

From SMO.wiki
Added widget from https://www.mediawikiwidgets.org/YouTube
 
Formatting fix attempt
 
(12 intermediate revisions by the same user not shown)
Line 2: Line 2:
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 your wiki page.


Created by [https://www.mediawikiwidgets.org/User:Yaron_Koren Yaron Koren] and extended by [https://www.mediawikiwidgets.org/User:Kghbln Karsten Hoffmeyer].
[https://www.mediawikiwidgets.org/YouTube Original version] created by [https://www.mediawikiwidgets.org/User:Yaron_Koren Yaron Koren] and extended by [https://www.mediawikiwidgets.org/User:Kghbln Karsten Hoffmeyer].


== 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 syntax:
<code><nowiki>{{#widget:</nowiki>{{PAGENAME}}<nowiki>|id = example}}</nowiki></code>


== Copy to your site ==
Replace <code>example</code> with the ID of the video found in the URL. You can also add the following optional parameters (separated using <code>|</code> symbols within the brackets):
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}}'''.
* <code>width = W</code> (replace <code>W</code> with the desired width in pixels)
</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>
* <code>aspect = W/H</code> (replace <code>W/H</code> with a fractional aspect ratio)
* <code>float</code> (places the video along the right side of the page, also changes the default width)
* <code>start = S</code> (replace <code>S</code> with the start time in seconds)
* <code>playlist = example</code> (replace <code>example</code> with the playlist ID found in the URL)
</noinclude><includeonly><iframe width="<!--{if isset($float)}--><!--{$width|escape:'html'|default:'400'}--><!--{else}--><!--{$width|escape:'html'|default:'600'}--><!--{/if}-->" style="max-width: 100%; aspect-ratio: <!--{$aspect|escape:'html'|default:16/9}-->;<!--{if isset($float)}--> float: right; clear: right; margin-bottom: 0.5em; margin-left: 1em;<!--{/if}-->" 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 04:50, 30 January 2023

This widget allows you to add a YouTube video player to your wiki page.

Original version created by Yaron Koren and extended by Karsten Hoffmeyer.

Using this widget

To insert this widget, use the following syntax: {{#widget:YouTube|id = example}}

Replace example with the ID of the video found in the URL. You can also add the following optional parameters (separated using | symbols within the brackets):

  • width = W (replace W with the desired width in pixels)
  • aspect = W/H (replace W/H with a fractional aspect ratio)
  • float (places the video along the right side of the page, also changes the default width)
  • start = S (replace S with the start time in seconds)
  • playlist = example (replace example with the playlist ID found in the URL)