我想为存档的 twitch 视频设置当前时间(例如 https://www.twitch.tv/videos/319946452)。我试过使用 video.currentTime 或模拟点击坐标但都没有用。有可能吗?
最佳答案
你需要使用fastSeek方法,在 HTMLMediaElements 上可用
const time = 60; // time in seconds.
const vidPlayer = document.querySelector('video');
vidPlayer.fastSeek(time);
对于广泛支持的搜索方法,您可以使用 currentTime , 它适用于设置和获取当前时间。
const time = 60; // time in seconds.
const vidPlayer = document.querySelector('video');
vidPlayer.currentTime = time;
关于javascript - 如何以编程方式设置 Twitch 视频播放器的当前时间?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52797952/