让我解释一下我的场景。我想用Youtube IFrame API在我的网站上嵌入一些视频。 我测试了本页面上的视频ID wdGZBRAwW74(https://www.youtube.com/watch?v=wdGZBRAwW74):Youtube IFrame Player Demo。它工作正常。Youtube IFrame API onError错误代码为150,视频来自Vevo
我尝试这个例子代码:在我的本地
<!DOCTYPE html>
<html>
<body>
<!-- 1. The <iframe> (and video player) will replace this <div> tag. -->
<div id="player"></div>
<script>
// 2. This code loads the IFrame Player API code asynchronously.
var tag = document.createElement('script');
tag.src = "//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: 'wdGZBRAwW74',
events: {
'onReady': onPlayerReady,
'onStateChange': onPlayerStateChange,
'onError': onPlayerError
}
});
}
// 4. The API will call this function when the video player is ready.
function onPlayerReady(event) {
event.target.playVideo();
}
// 5. The API calls this function when the player's state changes.
// The function indicates that when playing a video (state=1),
// the player should play for six seconds and then stop.
var done = false;
function onPlayerStateChange(event) {
if (event.data == YT.PlayerState.PLAYING && !done) {
setTimeout(stopVideo, 6000);
done = true;
}
}
function onPlayerError(event){
console.log(event.data);
}
function stopVideo() {
player.stopVideo();
}
</script>
</body>
</html>
一些虚拟主机域名和我得到的结果:
- 与域app.centaur.com/YouTube的/索引。 htm:iframe API工作正常,视频播放没有问题。
- 与域app.music.com /youtube/index.html:IFrame的API工作正常,但视频不能播放,API火灾的onError,错误150和嵌入式播放器显示消息“这部影片含有内容。VEVO,谁已禁止在此网站中显示在Youtube“看
- 与域app.musiccentaur.com /youtube/index.htm:像第一种情况下,一切工作正常
- 与域应用.centaurmusic.com/youtube /:像第一种情况,一切正常
正如我所知错误150代表“请求的视频的所有者不允许它在嵌入式播放器中播放”。但是我发现它在1,3,4情况下仍然有效,那么它是什么意思?
看到Vevo所有关于这个问题的视频。我不确定Vevo是否定义了一些嵌入其视频的政策。
也许问题来自我的域名music.com,但我不确定是否有一些规则的域名嵌入在网站上的Vevo的视频。
如果我为我的网站购买域名,那么我得到错误150,这是如此糟糕。 :(
是否有任何人处理这之前,请给我一些解决方案,在此先感谢
注:。该错误只发生在VEVO的视频
我不不要以为你会能够对Vevo的嵌入策略进行逆向工程。即使你这样做,也不保证你的新域名也不会在晚些时候被列入黑名单。 –