From a603833d7e3f0df4288b533bcbce6be4a66ab83f Mon Sep 17 00:00:00 2001 From: cocos02 Date: Fri, 12 Jun 2026 22:58:59 +0800 Subject: [PATCH] fix: handle loop seek in video ended callback, prevent duplicate end events --- engine/core/Engine.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/engine/core/Engine.ts b/engine/core/Engine.ts index 89151f8..df79f52 100644 --- a/engine/core/Engine.ts +++ b/engine/core/Engine.ts @@ -117,6 +117,14 @@ export class Engine { .map(s => this.videoManager.resolveVideoUrl(s!, this.videoManager.streamingQuality)) this.videoManager.onEnd(() => { + if (this.loopActive && scene.loopEnd) { + this.videoManager.seekTo(scene.loopStart!) + return + } + if (scene.loopStart && !this.loopActive) { + this.checkLoop(scene.loopEnd || scene.loopStart) + return + } if (!this.qteTriggered || this.qteResolved) { this.emit('videoEnd', scene) this.onVideoEnd(scene)