Quantcast
Channel: Active questions tagged youtube-api - Stack Overflow
Viewing all articles
Browse latest Browse all 3637

Youtube api and nocookie url

$
0
0

It seems that when I try to use www.youtube-nocookie.com url , api doesnt seem to work anymore . Here is the fiddle: https://jsfiddle.net/m2wrujy7/1/

If you remove host parameter then it works.

// 2. This code loads the IFrame Player API code asynchronously.var tag = document.createElement('script');tag.src = "https://www.youtube.com/iframe_api";var firstScriptTag = document.getElementsByTagName('script')[0];firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);// 3. This function creates an <iframe> (and YouTube player)//    after the API code downloads.var player;function onYouTubeIframeAPIReady() {    player = new YT.Player('player', {        height: '390',        width: '640',        videoId: 'M7lc1UVf-VE',        host:'//www.youtube-nocookie.com/',        events: {'onReady': onPlayerReady        }    });}// 4. The API will call this function when the video player is ready.function onPlayerReady(event) {    event.target.setVolume(0);    event.target.playVideo();}
<div id="player"></div>

Viewing all articles
Browse latest Browse all 3637

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>