Skip to content

Commit

Permalink
Add a data-youtube-nocookie option
Browse files Browse the repository at this point in the history
  • Loading branch information
laurefrog committed Sep 29, 2018
1 parent 5d5f9ec commit 729ea0a
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 8 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,7 @@ The following attributes are supported on the `<video>` element only:
- **data-allow-fullscreen** - optional; if set to "false" the player will not include a fullscreen button
- **data-youtube-id** - optional; 11-character YouTube ID, to play the YouTube video using *Able Player*.
- **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.
- **data-youtube-nocookie** - optional; if set to "true" the YouTube video will be embedded using the "youtube-nocookie.com" host.
- **height** - height of the video in pixels. If not provided will
default to 360.
- **poster** - path to an image file. Will be displayed in the player
Expand Down
8 changes: 8 additions & 0 deletions build/ableplayer.dist.js
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,13 @@
this.youTubeDescId = $(media).data('youtube-desc-id');
}

if ($(media).data('youtube-nocookie') !== undefined && $(media).data('youtube-nocookie')) {
this.youTubeNoCookie = true;
}
else {
this.youTubeNoCookie = false;
}

// Icon type
// By default, AblePlayer 3.0.33 and higher uses SVG icons for the player controls
// Fallback for browsers that don't support SVG is scalable icomoon fonts
Expand Down Expand Up @@ -5239,6 +5246,7 @@
}
this.youTubePlayer = new YT.Player(containerId, {
videoId: this.activeYouTubeId,
host: this.youTubeNoCookie ? 'https://www.youtube-nocookie.com' : 'https://www.youtube.com',
width: this.ytWidth,
height: this.ytHeight,
playerVars: {
Expand Down
8 changes: 8 additions & 0 deletions build/ableplayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,13 @@
this.youTubeDescId = $(media).data('youtube-desc-id');
}

if ($(media).data('youtube-nocookie') !== undefined && $(media).data('youtube-nocookie')) {
this.youTubeNoCookie = true;
}
else {
this.youTubeNoCookie = false;
}

// Icon type
// By default, AblePlayer 3.0.33 and higher uses SVG icons for the player controls
// Fallback for browsers that don't support SVG is scalable icomoon fonts
Expand Down Expand Up @@ -5239,6 +5246,7 @@
}
this.youTubePlayer = new YT.Player(containerId, {
videoId: this.activeYouTubeId,
host: this.youTubeNoCookie ? 'https://www.youtube-nocookie.com' : 'https://www.youtube.com',
width: this.ytWidth,
height: this.ytHeight,
playerVars: {
Expand Down
14 changes: 7 additions & 7 deletions build/ableplayer.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions scripts/ableplayer-base.js
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,13 @@
this.youTubeDescId = $(media).data('youtube-desc-id');
}

if ($(media).data('youtube-nocookie') !== undefined && $(media).data('youtube-nocookie')) {
this.youTubeNoCookie = true;
}
else {
this.youTubeNoCookie = false;
}

// Icon type
// By default, AblePlayer 3.0.33 and higher uses SVG icons for the player controls
// Fallback for browsers that don't support SVG is scalable icomoon fonts
Expand Down
1 change: 1 addition & 0 deletions scripts/youtube.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@
}
this.youTubePlayer = new YT.Player(containerId, {
videoId: this.activeYouTubeId,
host: this.youTubeNoCookie ? 'https://www.youtube-nocookie.com' : 'https://www.youtube.com',
width: this.ytWidth,
height: this.ytHeight,
playerVars: {
Expand Down

0 comments on commit 729ea0a

Please sign in to comment.