How to change the default YouTube settings in the Content Slider

The theme loads the YouTube videos in the Content Slider with their default options, and if you would like to modify the default options, such as remove the related videos or hide the play controls, you can accomplish this in two different ways.

Use the video embed code

What you can do is choose the centred layout for the slide and add the video embed code directly into the  Description field of the slide, as YouTube lets you modify the default embed settings when it generates the embed code.

In order to generate an embed code, click on the “Share” link of the video, then select “Embed”. This will show you the embed code with the default settings. To modify those settings, click on the “Show more” link.

After you have configured the embed options, just copy the embed code and paste it into the Description field of the slide.

Or apply a code tweak

You can modify the JavaScript code that loads the video to include additional options. You can visit this page to see the list with available options.

Open the theme’s js/content-slider.js file and find the following line:

videoId: slide.video,

You can add your code with custom options just above this line, by using the playerVars property. For example, if you would like to disable the related videos, you can add this code:

playerVars: {rel: 0},

or if you would like to disable related videos and hide the controls, you can use this code:

playerVars: {rel: 0, controls: 0},

or, if you would like to enable autoplay, you can use the following code:

playerVars: {autoplay: 1},

 

Was this useful? 0