Skip to content

Commit

Permalink
youtube: support loop parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
iparamonau committed Nov 1, 2024
1 parent c42334e commit 0b71da8
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions plugins/domains/youtube.com/youtube.video.js
Original file line number Diff line number Diff line change
Expand Up @@ -204,19 +204,31 @@ export default {
// https://developers.google.com/youtube/player_parameters#cc_load_policy
var cc_load_policy = options.getRequestOptions('youtube.cc_load_policy', params.cc_load_policy);
if (cc_load_policy) {
params.cc_load_policy = '1';
params.cc_load_policy = 1;
} else if (params.cc_load_policy) {
delete params.cc_load_policy;
}

// https://developers.google.com/youtube/player_parameters#controls
var controls = options.getRequestOptions('youtube.controls', params.controls);
if (controls == 0) {
params.controls = '0';
params.controls = 0;
} else if (params.controls) {
delete params.controls;
}

// https://developers.google.com/youtube/player_parameters#loop
var loop = options.getRequestOptions('youtube.loop', params.loop);
if (loop) {
params.loop = 1;
// 'To loop a single video, set the loop parameter value to 1 and set the playlist parameter value to the same video ID'
if (!params.playlist) {
params.playlist = youtube_video_gdata.id;
}
} else if (params.loop) {
delete params.loop;
}

// Support for direct links to YouTube clip embeds
if (/\/embed\/[^\?]+\?.*clip=.+clipt=.+/i.test(url)) {
var uri = url;
Expand Down

0 comments on commit 0b71da8

Please sign in to comment.