如何让视频完整观看 (API Youtube PHP)

how to get the video fully viewed (API Youtube PHP)

我正在尝试获取视频的信息,只能看到最后。

如果我在我的申请中添加这个:

echo '<iframe id="ytplayer" type="text/html" width="640" height="360"
  src="http://www.youtube.com/embed/M7lc1UVf-VE?autoplay=1&origin=http://example.com"
  frameborder="0"/>'

有什么方法可以知道用户何时看完视频?

因此您必须为此使用 javascript API:

  function onPlayerStateChange(event) {
    if (event.data == YT.PlayerState.ENDED) {
      // video ended -- do something here...
    }
  }

希望对您有所帮助!