Repository navigation
fix(video): 缩略图等真帧就绪才亮出,消除空白闪切(#1953 复测③) - #1967
Merged
Merged
Conversation
根因:弹层 {thumb && (...)} 每次重悬停重挂空白 canvas(仅底色盒),setThumb 立即亮弹层,真帧等异步 seek 的 onSeeked 才绘入(~50-300ms)→ 空白盒→真帧闪切。修法:thumbReady 门控——onSeeked 绘帧成功才置真(先绘后置真,构造上无「可见且空白」窗口);弹层 opacity 门控,会话起始 useLayoutEffect 复位(paint 前完成);vp-thumb-show 改 thumbActive && thumbReady,等待期保留 Artplayer 时间气泡作即时反馈、就绪与气泡隐藏同帧原子切换。音频文件顺带不再亮空盒。测试:新增「等真帧就绪才亮出」正向(像素级非空画布 + opacity 1 + 贴轨道)+ 反向(源卸载→弹层在 DOM 但不亮、气泡保留);摘门控突变时用例失败(已自查)。e2e 夹具补 withRealThumbVideo(缩略图源独立于主视频)。fixes #1953
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
问题(#1953 复测第三轮)
用户复测:间距 / 横向按钮降档均 OK(#1965/#1966 有效);缩略图显示时从「无画面」到「真图」有闪切。
根因
{thumb && (...)}:移开即卸载、重悬停重挂空白 canvas(仅--app-surface底色盒)。setThumb立即亮弹层,真帧要等thumbVideo.currentTime = t异步 seek 完成后的onSeeked→drawImage(~50-300ms)→ 空白盒被真帧瞬间替换 = 闪切;首次悬停与每次重入均复现。修法
thumbReady就绪门控:onSeeked先绘后置真(构造上不存在「可见且空白」窗口)。opacity: thumbReady ? 1 : 0;会话起始useLayoutEffect复位(paint 前完成,旧会话残留不会亮空画布)。vp-thumb-show改为thumbActive && thumbReady:等待期保留 Artplayer 时间气泡作即时反馈,真帧就绪与气泡隐藏同帧原子切换(layout effect)。测试
opacity:1+ 贴轨道间距 (0,12];反向——源卸载后弹层在 DOM 但opacity:0、时间气泡保留(旧实现在此失败)。withRealThumbVideo(缩略图源独立于主视频;纯色测试片绘帧后 PNG 极小压缩,故用像素判定而非 dataURL 长度)。tsc✓、vitest run2499 ✓、playwright test e2e/video-controls.spec.ts e2e/video-fit.spec.ts e2e/video-compact.spec.ts25 ✓风险
低——门控只影响悬停缩略图显隐时机;真机(WKWebView)用户已实测无闪切。
fixes #1953