mirror of
https://github.com/the1812/Bilibili-Evolved.git
synced 2025-11-04 21:22:45 +08:00
16 lines
420 B
TypeScript
16 lines
420 B
TypeScript
const setPlaybackRate = (video: HTMLVideoElement) => {
|
|
const speed = parseFloat(settings.defaultVideoSpeed)
|
|
video.playbackRate = speed
|
|
SpinQuery.condition(
|
|
() => video,
|
|
() => video.playbackRate !== speed,
|
|
() => video.playbackRate = speed
|
|
)
|
|
}
|
|
Observer.videoChange(() => {
|
|
const video = dq('.bilibili-player-video video') as HTMLVideoElement
|
|
if (!video) {
|
|
return
|
|
}
|
|
setPlaybackRate(video)
|
|
}) |