« Widget:YouTube » : différence entre les versions

De Wiki des possibles
Aller à :navigation, rechercher
Aucun résumé des modifications
(ajouter les exemples)
 
Ligne 10 : Ligne 10 :
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}}'''.
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}}'''.


== 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, 420x350 is default
== Sample results ==
=== Single clip ===
; Syntax
<pre>{{#widget:YouTube|id=Ukytqe9pwDM}}</pre>
; Result
{{#widget:YouTube|id=Ukytqe9pwDM}}
{{#widget:YouTube|id=Ukytqe9pwDM}}
=== Single clip starting at 300 seconds ===
; Syntax
<pre>{{#widget:YouTube|id=Ukytqe9pwDM|start=300}}</pre>
; Result
{{#widget:YouTube|id=Ukytqe9pwDM|start=300}}
=== Playlist ===
; Syntax
<pre>{{#widget:YouTube|playlist=PL6FD8256CD24CFF1F}}</pre>
; Result
{{#widget:YouTube|playlist=PL6FD8256CD24CFF1F}}
=== Playlist with different dimensions ===
; Syntax
<pre>{{#widget:YouTube|playlist=PL6FD8256CD24CFF1F|height=525|width=630}}</pre>
; Result
{{#widget:YouTube|playlist=PL6FD8256CD24CFF1F|height=525|width=630}}


</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>
</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>

Version actuelle datée du 15 février 2022 à 10:03

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

Created by Yaron Koren and extended by Karsten Hoffmeyer.

Using this widget

For information on how to use this widget, see the widget description page on MediaWikiWidgets.org.

Copy to your site

To use this widget on your site, just install the MediaWiki Widgets extension and the copy full source code of this page to your wiki, as an article called Widget:YouTube.

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, 420x350 is default

Sample results

Single clip

Syntax
{{#widget:YouTube|id=Ukytqe9pwDM}}
Result

Single clip starting at 300 seconds

Syntax
{{#widget:YouTube|id=Ukytqe9pwDM|start=300}}
Result

Playlist

Syntax
{{#widget:YouTube|playlist=PL6FD8256CD24CFF1F}}
Result

Playlist with different dimensions

Syntax
{{#widget:YouTube|playlist=PL6FD8256CD24CFF1F|height=525|width=630}}
Result