11/2022 See update at bottom.
If you’re like me you do a little bit of everything. My main business is video production but I also do web design and programming as well as a host of other things just to make ends meet (or just enjoy). So, even though I do programming, I always need to refer to documentation to refresh my memory on the proper format or syntax (unlike those who are writing code day in and day out). One of those things is the multiple options for displaying Youtube videos and how you can control this display with parameters. I’ve written about those before on this blog (here and here), but I thought it would be a good idea to layout all the parameters in one place. I’ve learned that sometimes the WordPress CMS (which this site is using) possibly interferes or disables these parameters, so be aware. Also this is not an exhaustive list of all possible parameters, just the ones I think are most important. Full list here. BTW, the embed function has greatly improved and most of these parameters are selectable on the share function.
Youtube Video Embed Parameters
The Basic embed (no parameters)
<iframe width="640" height="360" src="https://www.youtube.com/embed/9VXal4r3UwM" frameborder="0"></iframe>
Now the add-ons
These are added to the end of the ID before the end quote mark with an question mark then others connected with a ampersand (&, preferrably using &)
AUTOPLAY – Video starts when page loads – autoplay=1
<iframe width="640" height="360" src="https://www.youtube.com/embed/9VXal4r3UwM?autoplay=1" frameborder="0"></iframe>
NO RELATED VIDEOS – No related videos display at the end of the video and no related video display when the video is paused – rel=0
<iframe width="640" height="360" src="https://www.youtube.com/embed/9VXal4r3UwM?rel=0" frameborder="0"></iframe>
LOOP VIDEO – Causes the video to repeat until stopped – loop=1
Turning off player elements
The items in the graphic above can be turned off if you wish with one exception. You cannot turn off both the Video title (showinfo) and the Youtube logo (modestbranding). e.g. If you turn off the video title you will have a Youtube logo. If you turn off the logo you must have a video title. If you try to put in both parameters, you will only disable the title.
NO CONTROLS – Turn off control display– play, pause, volume, etc – controls=0
DISABLE FULLSCREEN – Turn off fullscreen button (unnecessary if you turn off the controls) – fs=0
TURN OFF VIDEO TITLE – Disables the display of the video title and uploader – showinfo=0
TURN OFF YOUTUBE LOGO IN BOTTOM RIGHT CORNER – Turns off the large Youtube logo with caveats, see above – modestbranding=1
START VIDEO AT CERTAIN TIME – Instead of the video playing from the beginning, you can determine the point in the video that the video will start to play. Use seconds from start of video, e.g. start at 3 minutes and 15 seconds would be 60*3+15 = 195 – start=[seconds from start of video]
END PLAYBACK AT A CERTAIN TIME – Stop playing the video at a certain point in the video instead of the end. This can be used in conjunction with the START function to only play a portion of a longer video – end=[seconds from the start of video]
PLAYLIST – Load a playlist, a search query, or user uploads into the player as a playlist. The format on this is a bit different than the basic embed. You will use “embed?” followed by the listType and either the playlist id, search query, or user id.
The example below will load a playlist
<iframe width="640" height="360" src="https://www.youtube.com/embed?listType=playlist&list=PLmWfwH4iXbeE-yktKJYF-mwS14eMvB_v1" frameborder="0"></iframe>
A playlist – listType=playlist&list=PLAYLIST ID
A search query – listType=search&list=SEARCH QUERY 11/2022 See update at bottom.
A User’s uploads – listType=user_uploads&list=USER ID 11/2022 See update at bottom.
I just noticed the User uploads function stopped working the other day. I have a website for a channel that shows the most recent video on the homepage and worked delightfully well, never had to touch it. I have to manually set it now.
After some testing, my theory is that the roll out of handles has something to do with it.
Channel IDs that are a long string of text and numbers do not work anymore.
Custom URLs (some) and Legacy username URLs seem to still work.
I have Custom URLs for Davetaylormp that works but MilitaryCollectors and bobredferntv do not. It may have to do with when they were set up.
Hopefully they will fix this so that the new handles will work for this. Otherwise, you’ll just have to do it manually or make a playlist. (groan…)
btw, searches no longer work, but that is documented.
It appears that the API can still do searches (and it includes one for channels), but setting that up is a little over my head.
OLDER UPDATE some of these parameters have changed.