Youtube视频在爆米花webmaker不加载,无限缓冲视频



我在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浏览器中播放youtube视频。在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&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

解决方案:-

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

相关内容

  • 没有找到相关文章

最新更新