我试图将嵌入式播放器放入数据网址(粘贴到浏览器网址栏中),但每次到达广告部分时,请求都会收到400错误(错误请求)。我刚刚复制了此链接中的代码,将其缩小并将视频ID更改为包含广告的ID: https://developers.google.com/youtube/iframe_api_reference
data:text/html, <!DOCTYPE html><html> <body> <div id="player"></div><script>var tag=document.createElement("script");tag.src="https://www.youtube.com/iframe_api";var player,firstScriptTag=document.getElementsByTagName("script")[0];function onYouTubeIframeAPIReady(){player=new YT.Player("player",{height:"390",width:"640",videoId:"LnFsp6iM5dg",events:{onReady:onPlayerReady,onStateChange:onPlayerStateChange}})}function onPlayerReady(e){e.target.playVideo()}firstScriptTag.parentNode.insertBefore(tag,firstScriptTag);var done=!1;function onPlayerStateChange(e){e.data!=YT.PlayerState.PLAYING||done||(setTimeout(stopVideo,6e3),done=!0)}function stopVideo(){player.stopVideo()}</script> </body></html>
在节点服务器上运行时,我也会收到这些错误,因此无法播放广告:
http://jsfiddle.net/7gyxgaqj/1/
我该怎么办?我做错了吗?先感谢您。