YouTube 视频到达某个点后停止

发布于 2024-08-09 15:06:21 字数 88 浏览 9 评论 0原文

YouTube API 似乎无法在视频到达某个点后停止播放。它有办法在某个点启动它,但不能在某个点停止它。我想知道是否有解决方法?或者也许我没有注意到就扫了一眼。

It looks like the YouTube API does not have a way to stop a video playing once it reaches a certain point. It has a way to start it at a certain point, but not to stop it at a certain point. I'm wondering if there's a workaround for this? or maybe I glanced over it without noticing.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

做个少女永远怀春 2024-08-16 15:06:21

您可以使用player.getCurrentTime()对经过的时间进行一些重复轮询,然后当它达到您想要的时间点时,调用player.stopVideo()。如果有点太忙,您可以使用计时器并仅在经过一定时间后才开始轮询。

You could do some repetitive polling of the time elapsed with player.getCurrentTime() and then when it reaches the point you want, call player.stopVideo(). If that's a little too busy, you could use a timer and only start polling after a certain time had elapsed.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文