diff options
author | Sam Potts <sam@potts.es> | 2019-04-12 12:40:12 +1000 |
---|---|---|
committer | Sam Potts <sam@potts.es> | 2019-04-12 12:40:12 +1000 |
commit | 9f30d54963df16d19bec0226f0c7d56f2a8d3774 (patch) | |
tree | a436b9b17a943d16a29bb1d31b7820fad86a37c4 /src/js | |
parent | b247093495c3402dbe7c14e3faeff8475f4e277c (diff) | |
parent | 0f3098040d8650a762067d1f1aa5ab520cb9b90c (diff) | |
download | plyr-9f30d54963df16d19bec0226f0c7d56f2a8d3774.tar.lz plyr-9f30d54963df16d19bec0226f0c7d56f2a8d3774.tar.xz plyr-9f30d54963df16d19bec0226f0c7d56f2a8d3774.zip |
Merge branch 'master' into develop
# Conflicts:
# readme.md
Diffstat (limited to 'src/js')
-rw-r--r-- | src/js/plugins/youtube.js | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/js/plugins/youtube.js b/src/js/plugins/youtube.js index 3e73a4d0..d862e4dd 100644 --- a/src/js/plugins/youtube.js +++ b/src/js/plugins/youtube.js @@ -34,6 +34,19 @@ function assurePlaybackState(play) { } } +function getHost(config) { + if (config.noCookie) { + return 'https://www.youtube-nocookie.com'; + } + + if (window.location.protocol === 'http:') { + return 'http://www.youtube.com'; + } + + // Use YouTube's default + return undefined; +} + const youtube = { setup() { // Add embed class for responsive @@ -151,7 +164,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: getHost(config), playerVars: extend( {}, { |