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) }