Youtube js API

编程入门 行业动态 更新时间:2024-10-12 14:16:53
Youtube js API - 及时向后寻找不工作(Youtube js API - seek backward in time not working)

寻求及时工作。例如,如果我寻求(160),它就有效。 但是,如果我试图向后寻求(30),它会回到160.这发生在歌剧,铬; 在Firefox中应该像它应该的工作。

Seeking forward in time works.If I seekTo(160), for example, it works. But, if I try to seek backwards seekTo(30), it sets back to 160. This happens in opera,chrome; works like it should in firefox.

最满意答案

我有同样的问题你有描述。 我不知道它是否可以提供帮助,但我发现在查询视频持续时间的API后,寻找以前的位置似乎有效...

我需要做一个“重播”的事情所以我所做的是:

var duration = player.getDuration(); player.seekTo(duration-duration, false); // equals to video exact start time which should be the same as 0 player.playVideo();

我的测试表明这样做

player.seekTo(0, false);

在被查询的持续时间之后工作但是我不想冒任何机会:-)

I had the same problem has you described. I don't know if it can help but I found out that after you query the API for the video duration, seek to previous location seemed to work...

I needed to do a "replay" kind of thing so what I've done is :

var duration = player.getDuration(); player.seekTo(duration-duration, false); // equals to video exact start time which should be the same as 0 player.playVideo();

My tests showed that doing

player.seekTo(0, false);

was working after the duration has beed queried but I didn't wanted to take any chances :-)

更多推荐

本文发布于:2023-08-08 00:15:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1466643.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:Youtube   js   API

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!