For personal use, add the code snippet below to your global.js page (for use on all wikis) or your common.js page on your wiki (for use on a single wiki). Note that personal JS must be enabled for your account.
Note: In this example, pay close attention to the placement of commas and other punctuation. For people who aren't familiar with programming (and even those who are!), a common mistake when writing code is to accidentally delete, forget, or misplace critical symbols like commas or quotation marks. This can cause a syntax error that breaks the code. Carefully follow the convention shown here when using importArticles.
Create a template (e.g. Template:YoutubePlayer) and add the contents of this page into it. Then you can use the template with
|id = the ID of the video
|width = the width size (without -px)
|height = the height size (without -px)
|autoplay = 0 / 1 (determines if the video auto-plays or not)
|loop = 0 / 1 (determines whether or not the video replays)
|start = the start time of the video in seconds
|playlist = ID of a YouTube list
It is possible to restrict usage of the autoplay option completely. What you need is to insert the following code in your MediaWiki:Common.js: