Youtube API seekTo() 浮点秒数 [英] Youtube API seekTo() in float seconds
问题描述
Youtube API seekTo 函数接受浮点时间还是帧时间?你能向下钻取到小数点后两位吗?
Does the Youtube API seekTo function accept time in float or in frames? Can you drill down up to two decimal places?
推荐答案
是的,API 完美地接受了浮动中的 seekTo 时间;无论是什么,它都会前进到浮动之前最近的关键帧.这是一个演示:
Yes, the API accepts seekTo time in float perfectly; it will advance to the closest keyframe before your float, whatever that may be. Here's a demonstration:
寻找一个帧有点棘手,因为不同的视频具有不同的 fps 速率.由于您无法通过 API 获得 fps(除非有一种我不知道的方法?),因此尝试编写一个包装器来将您想要寻找的帧转换为浮点数就太困难了.但是,如果它们是您的视频,并且您知道 fps 速率,那将是微不足道的.
Seeking to a frame is a little trickier of a beast, as different videos have different fps rates. Since you can't get the fps via the API (unless there's a method I don't know?), it would be too difficult to try to write a wrapper that could convert the frame you want to seek to into a float. If they are your videos, though, and you know the fps rate, it would be pretty trivial.
这篇关于Youtube API seekTo() 浮点秒数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!