我在爆米花网络制作者中遇到此错误
Failed to execute 'postMessage' on 'DOMWindow': The target origin provided ('https://www.youtube.com') does not match the recipient window's origin ('http://localhost:8888').
我无法在Chrome中播放你管视频。在mozilla和safari中它运行良好。
任何人都可以帮我解决这个问题。
这是我的iframe的代码。我正在使用youtube的最新api:
https://www.youtube.com/iframe_api
我的iframe代码如下: -
<iframe frameborder="0" allowfullscreen="1" title="YouTube video player" width="100%" height="100%" src="https://www.youtube.com/embed/0Fegb4Ew8SM?butteruid=1437727498131&rel=0&modestbranding=1&iv_load_policy=3&disablekb=1&showinfo=0&origin=http%3A%2F%2Flocalhost%3A8888&controls=0&wmode=opaque&html5=1&enablejsapi=1" id="widget4"></iframe>
视频加载1或2秒然后进入无限等待状态。
您可以访问更多详细信息: 54.186.240.149:8888
请检查chrome。
答案 0 :(得分:0)
解决方案: -
// This function needs duration and first play to be ready.
function onFirstPlay() {
removeYouTubeEvent( "play", onFirstPlay );
if ( player.getCurrentTime() === 0 ) {
setTimeout( onFirstPlay, 0 );
return;
}
addYouTubeEvent( "pause", onFirstPause );
player.pauseVideo();
player.seekTo( 0 );
}
最初是
// This function needs duration and first play to be ready.
function onFirstPlay() {
removeYouTubeEvent( "play", onFirstPlay );
if ( player.getCurrentTime() === 0 ) {
setTimeout( onFirstPlay, 0 );
return;
}
addYouTubeEvent( "pause", onFirstPause );
player.seekTo( 0 );
player.pauseVideo();
}