Skip to content

fix(h5): report actual Audio playback position - #19708

Merged
Single-Dancer merged 2 commits into
NervJS:mainfrom
Jarvis636431:codex/h5-audio-timeupdate
Nov 29, 2026
Merged

Single-Dancer merged 2 commits into
NervJS:mainfrom
Jarvis636431:codex/h5-audio-timeupdate

Conversation

@Jarvis636431

@Jarvis636431 Jarvis636431 commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

Closes #19707

这个 PR 做了什么?

Audio timeupdate 把 duration 同时用于 currentTime,120 秒音频播放到 12 秒时仍上报 120。

读取实际 currentTime,并补组件进度回归。

这个 PR 是什么类型?

  • 错误修复 (Bugfix)

这个 PR 涉及以下平台:

  • Web 端(H5)

Summary by CodeRabbit

  • Bug 修复
    • 修正音频播放进度事件中的当前播放时间,使其正确反映音频的实际播放位置。
    • 补充测试,验证播放时间和音频时长的事件数据正确。

验证结果

Stencil spec 全套 127 项测试、35 个快照通过。

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 28, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-28T08:21:47.057622Z 9ef9b0b PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@coderabbitai

coderabbitai Bot commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: f32c2091-2bf3-4c28-9fd0-aa9b7aa74153
Commits

Reviewing files that changed from the base of the PR and between 9ef9b0b and 81c8d1c.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review

No actionable comments were generated in the recent review.

Walkthrough

音频组件的 timeupdate 事件现在从音频元素读取实际播放时间。新增组件测试,验证当前播放时间与总时长分别上报。

Changes

音频播放时间上报

Layer / File(s) Summary
修正播放时间上报并添加回归测试
packages/taro-components/src/components/audio/audio.tsx, packages/taro-components/__tests__/audio-progress.spec.tsx
timeupdate 事件的 currentTime 改为读取音频元素的当前播放时间。新增测试验证当前播放时间为 12、总时长为 120。

Estimated code review effort: 2 (Simple) | ~8 minutes

Change: Bug fix · Severity of issue fixed: Low

Suggested reviewers: yuche, zakarycode, single-dancer

Merge Risk: Minimal · previous review 9ef9b

The change fixes H5 Audio timeupdate events so they report the actual playback position instead of the total duration. It is a small, localized fix with a regression test, and no merge-blocking risk was identified.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed 标题“fix(h5): report actual Audio playback position”描述了本 PR 的主要变更。变更将 H5 Audio 组件 timeupdate 事件中的 currentTime 从错误取值 duration 改为音频元素的实际 currentTime,并新增了进度回归测试。标题与关联 issue #19707 的目标一致。标题简洁、具体,未包含无关信息。
Linked Issues check Passed [#19707] 要求 H5 Audio 的 timeupdate 上报实际播放位置,而不是 duration,并补充组件进度回归测试。在 packages/taro-components/src/components/audio/audio.tsx 中,timeupdate 事件的 currentTime 现在取自 e.srcElement!.currentTime(基线版本取自 duratio…
Out of Scope Changes check Passed 整个 PR 相对合并基线只修改两个文件:audio.tsx 中的一行修复,以及新增的 audio-progress.spec.tsx 回归测试。两处改动都直接对应 #19707 的范围。未发现与该问题无关的改动。提交信息中提到的 Stencil mock 中的音频事件源,在本 PR 的文件变更中未出现独立的 mock 文件改动;测试通过 Object.defineProperty 设置 srcEl…
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Full details: Linked Issues check

Explanation

[#19707] 要求 H5 Audio 的 timeupdate 上报实际播放位置,而不是 duration,并补充组件进度回归测试。在 packages/taro-components/src/components/audio/audio.tsx 中,timeupdate 事件的 currentTime 现在取自 e.srcElement!.currentTime(基线版本取自 duration)。duration 仍取自 e.srcElement!.duration,符合要求。新增的 packages/taro-components/tests/audio-progress.spec.tsx 将 duration 设为 120、currentTime 设为 12,派发 timeupdate 事件,并断言事件详情为 { currentTime: 12, duration: 120 }。该测试覆盖问题中的回归场景。

Full details: Out of Scope Changes check

Explanation

整个 PR 相对合并基线只修改两个文件:audio.tsx 中的一行修复,以及新增的 audio-progress.spec.tsx 回归测试。两处改动都直接对应 #19707 的范围。未发现与该问题无关的改动。提交信息中提到的 Stencil mock 中的音频事件源,在本 PR 的文件变更中未出现独立的 mock 文件改动;测试通过 Object.defineProperty 设置 srcElement 完成所需设置,因此不构成超出范围的改动。

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

兔子听见时间更新,
播放位置如实呈现。
十二秒不再变成一百二十,
测试守住这条约定。
兔耳轻摇,音符向前。

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 5b57ffc0-8ec9-41c8-807b-c2ed355ad3ab
Commits

Reviewing files that changed from the base of the PR and between 033c823 and 9ef9b0b.

Files selected for processing: 2

  • packages/taro-components/__tests__/audio-progress.spec.tsx
  • packages/taro-components/src/components/audio/audio.tsx

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 5 remain after this review.

@codecov

codecov Bot commented Nov 28, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 59.53%. Comparing base (af39ab0) to head (81c8d1c).

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main   #19708   +/-   ##
=======================================
  Coverage   59.53%   59.53%           
=======================================
  Files         473      473           
  Lines       26651    26651           
  Branches     6648     6692   +44     
=======================================
  Hits        15867    15867           
+ Misses       8875     8870    -5     
- Partials     1909     1914    +5     
Flag Coverage Δ
taro-cli 59.69% <ø> (ø)
taro-runtime 66.45% <ø> (ø)
taro-web 75.56% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.
see 3 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@Single-Dancer

Copy link
Copy Markdown
Collaborator

LGTM

@Single-Dancer Single-Dancer added this to the 4.3.4 milestone Nov 28, 2026
@Single-Dancer
Single-Dancer force-pushed the codex/h5-audio-timeupdate branch from 9ef9b0b to 81c8d1c Compare November 28, 2026 15:07
@Single-Dancer
Single-Dancer merged commit 0519d03 into NervJS:main Nov 29, 2026
25 checks passed
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.

fix(h5): report actual Audio playback position

2 participants