fix: skip crossfade when switching to same video, replay from start

This commit is contained in:
2026-06-08 14:32:34 +08:00
parent fa7c333214
commit d81042174a

View File

@@ -78,6 +78,12 @@ export class VideoManager {
switchTo(src: string, preloadUrls: string[]) {
if (!this.elA || this.switching) return
if (src === this.currentSrc) {
this.active.currentTime = 0
this.active.play().catch(() => {})
return
}
const inKey = this.inactiveKey
const alreadyPreloaded = this.preloaded.get(inKey)