Skip to content

fix: conditionally enable video skip on double click#989

Closed
xiaoxustudio wants to merge 1 commit into
OpenWebGAL:mainfrom
xiaoxustudio:fix/playVideo-skipOff-issue
Closed

fix: conditionally enable video skip on double click#989
xiaoxustudio wants to merge 1 commit into
OpenWebGAL:mainfrom
xiaoxustudio:fix/playVideo-skipOff-issue

Conversation

@xiaoxustudio

Copy link
Copy Markdown
Member

fixes: #985

双击是通过事件直接调用 skipVideo → endPerform(),绕过了场景控制器的判断,设置blockingNext无法阻止。

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request modifies the video playback script to conditionally register the double-click skip event handler based on the blockingNextFlag state. The review feedback points out a potential race condition where the event listener could be registered after the video component has already been unmounted, leading to memory leaks or unexpected errors. It is recommended to verify that the video element is still present in the DOM before registering the listener.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment on lines +79 to +81
if (!blockingNextFlag) {
WebGAL.events.fullscreenDbClick.on(skipVideo);
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

由于 playVideo 中的初始化逻辑是在 setTimeout(..., 1) 中异步执行的,如果视频在播放开始后的极短时间内(例如 1ms 内)被卸载或跳过,restoreVolumeAndUnmount 会先被调用。此时,setTimeout 回调仍会执行,并注册全局双击事件监听器 WebGAL.events.fullscreenDbClick.on(skipVideo)。这会导致内存泄漏,并且在后续双击时可能会触发已销毁实例的 endPerform,引发非预期错误。

建议在注册事件监听器前,先检查 VocalControl 是否仍存在于 DOM 树中(即未被卸载)。

Suggested change
if (!blockingNextFlag) {
WebGAL.events.fullscreenDbClick.on(skipVideo);
}
if (!blockingNextFlag && document.contains(VocalControl)) {
WebGAL.events.fullscreenDbClick.on(skipVideo);
}

@xiaoxustudio

Copy link
Copy Markdown
Member Author

不过我看之前改脚本这块的逻辑好像大致也是这样的,是改了演出系统的原因才导致失效的吗?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

播放视频功能的禁止跳过参数疑似失效

1 participant