爆米花 webmaker 中的 Youtube 视频未加载,无限缓冲视频

Youtube video in popcorn webmaker is not loading, Infinitely buffering a video

我在 popcorn webmaker 中遇到这个错误

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 中的 you tube 视频。在 mozilla 和 safari 中它工作正常。

谁能帮我解决这个问题。

这是我的 iframe 的代码。我使用的是最新的 api youtube,即:

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&amp;rel=0&amp;modestbranding=1&amp;iv_load_policy=3&amp;disablekb=1&amp;showinfo=0&amp;origin=http%3A%2F%2Flocalhost%3A8888&amp;controls=0&amp;wmode=opaque&amp;html5=1&amp;enablejsapi=1" id="widget4"></iframe>

视频加载1、2秒后进入无限等待状态

更多详情您可以访问: 54.186.240.149:8888

请签到chrome。

这就是解决方案:-

// 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();
}