Youtube 播放器 JS API seekTo 功能不起作用

问题描述:

我正在尝试通过 JS API 使用 Youtube chromeless 播放器,但在使用 seekto() 函数时遇到问题.

I'm trying to use Youtube chromeless player through the JS API and I'm having problems with seekto() function.

问题是有时(我不知道什么时候出现问题),向后调用seekTo()函数到视频中未加载的点不会返回,而是停留在当前时间.

The problem is that sometimes (I can't tell when the problem arises), calling seekTo() function backwards to a point in the video that is not loaded don't come back and instead stays in the current time.

这就是我所做的(假设视频长度为 240 秒):

This is what I do (imagine the video is 240 seconds length):

  1. 我开始播放视频 -> loadVideoById().
  2. 我前进到(比方说)视频的中间 -> seekTo(120)
  3. 视频正确跳转到我询问的位置.
  4. 我尝试向后移动到视频的 25% -> seekTo(60)
  5. 有时视频会跳回到 60,但更多时候只会跳回到 120.

那么,还有其他人遇到这个问题吗?

So, is anyone else having this issue?

发布一些代码将有助于我们为您提供帮助,但是您是否尝试过 player.seekTo(60, true); - 第二个参数很重要 - 将其设置为 true 将使播放器向服务器发送新的视频请求.

Posting some code will help us to help you, but have you tried player.seekTo(60, true); - the second parameter is important - setting it to true will make the player send a new request to the server for the video.