mirror of
https://github.com/the1812/Bilibili-Evolved.git
synced 2025-11-04 21:22:45 +08:00
15 lines
322 B
TypeScript
15 lines
322 B
TypeScript
/**
|
|
* 设置视频的进度
|
|
* @param video 视频元素
|
|
* @param progress 目标进度
|
|
*/
|
|
export const setProgress = (video: HTMLVideoElement, progress: number) => {
|
|
let p = progress
|
|
if (p > video.duration) {
|
|
p = video.duration
|
|
} else if (p < 0) {
|
|
p = 0
|
|
}
|
|
unsafeWindow.player.seek(p, video.paused)
|
|
}
|