Skip to content

Commit 729ea0a

Browse files
committed
Add a data-youtube-nocookie option
1 parent 5d5f9ec commit 729ea0a

7 files changed

Lines changed: 33 additions & 8 deletions

File tree

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,7 @@ The following attributes are supported on the `<video>` element only:
320320
- **data-allow-fullscreen** - optional; if set to "false" the player will not include a fullscreen button
321321
- **data-youtube-id** - optional; 11-character YouTube ID, to play the YouTube video using *Able Player*.
322322
- **data-youtube-desc-id** - optional; 11-character YouTube ID of the described version of a video. See the section below on *YouTube Support* for additional information.
323+
- **data-youtube-nocookie** - optional; if set to "true" the YouTube video will be embedded using the "youtube-nocookie.com" host.
323324
- **height** - height of the video in pixels. If not provided will
324325
default to 360.
325326
- **poster** - path to an image file. Will be displayed in the player

build/ableplayer.dist.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,13 @@
291291
this.youTubeDescId = $(media).data('youtube-desc-id');
292292
}
293293

294+
if ($(media).data('youtube-nocookie') !== undefined && $(media).data('youtube-nocookie')) {
295+
this.youTubeNoCookie = true;
296+
}
297+
else {
298+
this.youTubeNoCookie = false;
299+
}
300+
294301
// Icon type
295302
// By default, AblePlayer 3.0.33 and higher uses SVG icons for the player controls
296303
// Fallback for browsers that don't support SVG is scalable icomoon fonts
@@ -5239,6 +5246,7 @@
52395246
}
52405247
this.youTubePlayer = new YT.Player(containerId, {
52415248
videoId: this.activeYouTubeId,
5249+
host: this.youTubeNoCookie ? 'https://www.youtube-nocookie.com' : 'https://www.youtube.com',
52425250
width: this.ytWidth,
52435251
height: this.ytHeight,
52445252
playerVars: {

build/ableplayer.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,13 @@
291291
this.youTubeDescId = $(media).data('youtube-desc-id');
292292
}
293293

294+
if ($(media).data('youtube-nocookie') !== undefined && $(media).data('youtube-nocookie')) {
295+
this.youTubeNoCookie = true;
296+
}
297+
else {
298+
this.youTubeNoCookie = false;
299+
}
300+
294301
// Icon type
295302
// By default, AblePlayer 3.0.33 and higher uses SVG icons for the player controls
296303
// Fallback for browsers that don't support SVG is scalable icomoon fonts
@@ -5239,6 +5246,7 @@
52395246
}
52405247
this.youTubePlayer = new YT.Player(containerId, {
52415248
videoId: this.activeYouTubeId,
5249+
host: this.youTubeNoCookie ? 'https://www.youtube-nocookie.com' : 'https://www.youtube.com',
52425250
width: this.ytWidth,
52435251
height: this.ytHeight,
52445252
playerVars: {

build/ableplayer.min.js

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

scripts/ableplayer-base.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,13 @@
291291
this.youTubeDescId = $(media).data('youtube-desc-id');
292292
}
293293

294+
if ($(media).data('youtube-nocookie') !== undefined && $(media).data('youtube-nocookie')) {
295+
this.youTubeNoCookie = true;
296+
}
297+
else {
298+
this.youTubeNoCookie = false;
299+
}
300+
294301
// Icon type
295302
// By default, AblePlayer 3.0.33 and higher uses SVG icons for the player controls
296303
// Fallback for browsers that don't support SVG is scalable icomoon fonts

scripts/youtube.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@
9898
}
9999
this.youTubePlayer = new YT.Player(containerId, {
100100
videoId: this.activeYouTubeId,
101+
host: this.youTubeNoCookie ? 'https://www.youtube-nocookie.com' : 'https://www.youtube.com',
101102
width: this.ytWidth,
102103
height: this.ytHeight,
103104
playerVars: {

0 commit comments

Comments
 (0)