fix: pause old video before switching to prevent stale timeupdate triggering wrong hotspot states

This commit is contained in:
2026-06-08 15:29:28 +08:00
parent 17c479525d
commit 6c0deea0e2

View File

@@ -85,6 +85,9 @@ export class Engine {
}
})
const activeEl = this.videoManager.getActiveVideoElement()
activeEl?.pause()
if (this.isInitialScene) {
this.isInitialScene = false
this.videoManager.playInitial(scene.videoUrl, preloadUrls)
@@ -276,13 +279,16 @@ export class Engine {
(conds) => conds ? this.stateManager.evaluate(conds) : true
)
this.videoManager.switchTo(scene.videoUrl, preloadUrls)
this.videoManager.onEnd(() => {
this.emit('videoEnd', scene)
this.onVideoEnd(scene)
})
const activeEl = this.videoManager.getActiveVideoElement()
activeEl?.pause()
this.videoManager.switchTo(scene.videoUrl, preloadUrls)
this.currentScene = scene
this.emit('sceneChange', scene)
}