fix: pause old video before switching to prevent stale timeupdate triggering wrong hotspot states
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user