From 6e68ad6d1585e811c7f0624b71633d0c0bbce48d Mon Sep 17 00:00:00 2001 From: Sam Potts Date: Tue, 26 Mar 2019 21:43:59 +1100 Subject: [PATCH 1/4] Update readme.md --- readme.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/readme.md b/readme.md index c6e3d745..b603f2d4 100644 --- a/readme.md +++ b/readme.md @@ -404,10 +404,9 @@ player.fullscreen.active; // false; | `language` | ✓ | ✓ | Gets or sets the preferred captions language for the player. The setter accepts an ISO two-letter language code. Support for the languages is dependent on the captions you include. If your captions don't have any language data, or if you have multiple tracks with the same language, you may want to use `currentTrack` instead. | | `fullscreen.active` | ✓ | - | Returns a boolean indicating if the current player is in fullscreen mode. | | `fullscreen.enabled` | ✓ | - | Returns a boolean indicating if the current player has fullscreen enabled. | -| `pip`² | ✓ | ✓ | Gets or sets the picture-in-picture state of the player. The setter accepts a boolean. This currently only supported on Safari 10+ (on MacOS Sierra+ and iOS 10+) and Chrome 70+. | +| `pip`¹ | ✓ | ✓ | Gets or sets the picture-in-picture state of the player. The setter accepts a boolean. This currently only supported on Safari 10+ (on MacOS Sierra+ and iOS 10+) and Chrome 70+. | -1. YouTube only. HTML5 will follow. -2. HTML5 only +1. HTML5 only ### The `.source` setter From f4b47a9275d597f7f3eb47dbc89603859be166f9 Mon Sep 17 00:00:00 2001 From: Vladimir Morozov Date: Thu, 4 Apr 2019 08:51:20 +0300 Subject: [PATCH 2/4] fixed setting youtube host for non-https case --- src/js/plugins/youtube.js | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/js/plugins/youtube.js b/src/js/plugins/youtube.js index d5972c80..cac1a90f 100644 --- a/src/js/plugins/youtube.js +++ b/src/js/plugins/youtube.js @@ -34,6 +34,22 @@ function assurePlaybackState(play) { } } +function useHttp() { + return !window.location.href.includes('https://'); +} + +function getYoutubeHost(config) { + let host; + + if (config.noCookie) { + host = 'https://www.youtube-nocookie.com'; + } else { + host = useHttp() ? 'http://www.youtube.com' : undefined; + } + + return host; +} + const youtube = { setup() { // Add embed class for responsive @@ -151,7 +167,7 @@ const youtube = { // https://developers.google.com/youtube/iframe_api_reference player.embed = new window.YT.Player(id, { videoId, - host: config.noCookie ? 'https://www.youtube-nocookie.com' : undefined, + host: getYoutubeHost(config), playerVars: extend( {}, { From c22f5c4b39ba545508392343fc0ffcfa4775dfdb Mon Sep 17 00:00:00 2001 From: Vladimir Morozov Date: Thu, 4 Apr 2019 08:56:46 +0300 Subject: [PATCH 3/4] code cleanup --- src/js/plugins/youtube.js | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/src/js/plugins/youtube.js b/src/js/plugins/youtube.js index cac1a90f..1f827776 100644 --- a/src/js/plugins/youtube.js +++ b/src/js/plugins/youtube.js @@ -34,20 +34,12 @@ function assurePlaybackState(play) { } } -function useHttp() { - return !window.location.href.includes('https://'); -} - function getYoutubeHost(config) { - let host; - if (config.noCookie) { - host = 'https://www.youtube-nocookie.com'; - } else { - host = useHttp() ? 'http://www.youtube.com' : undefined; + return 'https://www.youtube-nocookie.com'; } - return host; + return `${window.location.protocol}//www.youtube.com`; } const youtube = { From 21539be3f2b01a549c920ee683c2121f53929d96 Mon Sep 17 00:00:00 2001 From: Vladimir Morozov Date: Thu, 4 Apr 2019 09:32:38 +0300 Subject: [PATCH 4/4] code cleanup --- src/js/plugins/youtube.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/js/plugins/youtube.js b/src/js/plugins/youtube.js index 1f827776..9c447f7d 100644 --- a/src/js/plugins/youtube.js +++ b/src/js/plugins/youtube.js @@ -34,7 +34,7 @@ function assurePlaybackState(play) { } } -function getYoutubeHost(config) { +function getHost(config) { if (config.noCookie) { return 'https://www.youtube-nocookie.com'; } @@ -159,7 +159,7 @@ const youtube = { // https://developers.google.com/youtube/iframe_api_reference player.embed = new window.YT.Player(id, { videoId, - host: getYoutubeHost(config), + host: getHost(config), playerVars: extend( {}, {