Template:YouTube: Difference between revisions
Appearance
| [checked revision] | [checked revision] |
Update |
Update Tag: Reverted |
||
| Line 2: | Line 2: | ||
== YouTube Embed Template == | == YouTube Embed Template == | ||
Embed YouTube video. | Embed YouTube video with autoplay (muted) + no loop. User can manually replay via player controls. | ||
'''Usage:''' <code><nowiki>{{YouTube|id=VIDEO_ID|width=640|align=center|caption=Description}}</nowiki></code> | '''Usage:''' <code><nowiki>{{YouTube|id=VIDEO_ID|width=640|align=center|caption=Description}}</nowiki></code> | ||
'''Features:''' | |||
* Auto-plays when page loads (muted — browser policy) | |||
* Stops at end (no loop) | |||
* User can click play button to replay | |||
* Show controls for replay/seek/volume | |||
{{TemplateData | {{TemplateData | ||
|description=Embed a YouTube video. | |description=Embed a YouTube video with autoplay. Video plays automatically (muted), stops at end, user can replay. | ||
|params={ | |params={ | ||
"id": { | "id": { | ||
| Line 23: | Line 29: | ||
"label": "Alignment", | "label": "Alignment", | ||
"type": "string", | "type": "string", | ||
"default": "center | "default": "center" | ||
}, | }, | ||
"caption": { | "caption": { | ||
| Line 30: | Line 35: | ||
"type": "string", | "type": "string", | ||
"required": false | "required": false | ||
}, | |||
"autoplay": { | |||
"label": "Autoplay (0 or 1)", | |||
"type": "number", | |||
"default": "1", | |||
"description": "Set to 0 to disable autoplay" | |||
} | } | ||
} | } | ||
| Line 35: | Line 46: | ||
[[Category:Templates]] | [[Category:Templates]] | ||
</noinclude><includeonly><div style="text-align:{{{align|center}}}; margin:10px 0;"><youtube width=" | </noinclude><includeonly><div style="text-align:{{{align|center}}}; margin:10px 0;"><html><iframe src="https://www.youtube.com/embed/PLACEHOLDER_ID?autoplay=PLACEHOLDER_AUTOPLAY&mute=1&rel=0&modestbranding=1" width="PLACEHOLDER_WIDTH" height="PLACEHOLDER_HEIGHT" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen style="max-width:100%;"></iframe></html>{{#if:{{{caption|}}}|<br><em style="color:#666">{{{caption}}}</em>|}}</div></includeonly> | ||
Revision as of 03:17, 20 May 2026
YouTube Embed Template
Embed YouTube video with autoplay (muted) + no loop. User can manually replay via player controls.
Usage: {{YouTube|id=VIDEO_ID|width=640|align=center|caption=Description}}
Features:
- Auto-plays when page loads (muted — browser policy)
- Stops at end (no loop)
- User can click play button to replay
- Show controls for replay/seek/volume