youtube api iframe loadvideobyid启动视频,最后一个停止 [英] youtube api iframe loadvideobyid starts video where last one left off

查看:342
本文介绍了youtube api iframe loadvideobyid启动视频,最后一个停止的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用youtube api iframe,只是使用示例代码。当我发出:
player.loadVideoById(ytidNo1)正确的视频开始时(ytidNo1是有效的YouTube视频ID)

I am using youtube api iframe and just getting going with the sample code. When I issue: player.loadVideoById("ytidNo1") the proper video starts ("ytidNo1" is a valid youtube id)

然后,比方说,10几秒钟之后,如果我发出另一个:
player.loadVideoById(ytidNo2),第二个视频开始播放,但它从最后一个视频播放的位置开始(例如10秒)。

Then, say, 10 seconds later, if I issue another: player.loadVideoById("ytidNo2") the 2nd video starts, but it starts at the point where the last one was playing at (eg 10 seconds in).

这是最近一天左右的新行为,我没有更改我的代码。

This is new behavior in the last day or so and I have not changed my code.

为了解决问题,我尝试过:
player.loadVideoById(ytidNo1,0)

To correct the problem, I tried: player.loadVideoById("ytidNo1",0)

然后

player.loadVideoById( ytidNo2,0)

player.loadVideoById("ytidNo2",0)

并且问题仍然存在。

其他人已经或者刚刚开始这样做问题?

Anyone else have or just starting to have this issue?

推荐答案

我也有同样的问题。在我身边玩耍最终让它发挥作用。
我不得不使用seekTo(0); (见Jim的评论)

I also had the same problem. Playing around I eventually got it to work. I had to use seekTo(0); (see Jim's comments)

关于这个问题的更多细节。

More details about the problem.


  • 如果视频实际播放到最后我不需要做任何事情。

  • 如果视频被中途跳过,我不得不拨打
    player.seekTo(0);在调用loadVideoByID(ytid,0)之前旧视频上的
    ;在下一个视频。

  • 我还必须处理调用loadVideoByID后出现错误的情况。 (例如150)如果我有错误,我就不能调用seekTo,因为它会导致下一个视频只播放音频。

希望这有助于

这篇关于youtube api iframe loadvideobyid启动视频,最后一个停止的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆