From 6c0deea0e279b76af7248a8df132e0bac73ae478 Mon Sep 17 00:00:00 2001 From: cocos02 Date: Mon, 8 Jun 2026 15:29:28 +0800 Subject: [PATCH] fix: pause old video before switching to prevent stale timeupdate triggering wrong hotspot states --- engine/core/Engine.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/engine/core/Engine.ts b/engine/core/Engine.ts index 2439d61..6e701a4 100644 --- a/engine/core/Engine.ts +++ b/engine/core/Engine.ts @@ -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) }