YouTube

There are two types of youtube links:

Try opening both to understand the difference between the two.

The first one is a standard page with comments, search and so on. The second one is only the video.

When in the redaction, you usually use the first type of the link and paste it in an editor. Wordpress takes this link and presents you with a video inside the editor. What happened? The wordpress looked at the address and found out it is a youtube link. Then it asked YouTube if it can convert the link into a video embed. YouTube responded and gave wordpress the address to the video embed and replaced it in the editor.

So lets take a closer look at the links above. First is the domain, youtube.com, after the first slash it says either watch or embed - this is the main difference between the two.

Then there is a video ID. In case of watch it is used as a parameter. The parameter is v=XXXX where XXXX is the ID of the video. When inserting an embed, it has no parameter and the ID follows right after a slash.

Parameters

You can specify your own parameters besides the video ID to alter the behaviour of the video. These include parameters to turn on subtitles or to start the video at a given time or to autoplay the video when the user opens the page.

Unofortunately most of the parameters only work with video embeds, but wordpress will pass them through so no need to worry about this. However, the parameters with links below will not work for Video Pages

The most important thing to remember: First parameter has to be preceeded by a ? (Question mark). All following parameters are preceeded by an & (Ampersand).

So if we want to add our own parameter t=5 (which means: start the video at 0:05) we would add it as follows:

Some of the common parameters

  • start - start video at a given time in seconds (i.e. t=350)
  • end - stop video at a given time in seconds (i.e. end=100)
  • autoplay - autoplay video when the user opens the page (i.e. autoplay=1)

Force closed captions on a YouTube video

To force subtitles, you will need to use the following parameters: cc_lang_pref and cc_load_policy

cc_lang_pref defines the subtitle language, so for example video with french subtitles should look like this:

While video with english subtitles will look like this: