Repository navigation
Fix: replay finished video after playback-speed change - #96919
Conversation
Co-authored-by: dmkt9 <dmkt9@users.noreply.github.com>
Codecov Report✅ Changes either increased or maintained existing code coverage, great job!
|
Co-authored-by: dmkt9 <dmkt9@users.noreply.github.com>
|
Fixed the failing spellcheck check and pushed to the branch. Root cause: cspell flagged the word Fix: Reworded the comment to "playback position" ( The only other failing check is |
|
I looked into the failing checks. The only failing one is PR Author Checklist / checklist — and it isn't a code issue, so there's nothing for me to push a fix for. It's failing because the checklist boxes in the PR description are unticked:
Every other check is passing or still running — the code itself is fine. To clear this check: tick the boxes in the PR Author Checklist section of the PR description (and fill in the empty |
|
@MelvinBot update your checklist:
|
|
✅ Updated the PR checklist:
|
|
@MelvinBot mark this as ready |
|
✅ Marked this PR as ready for review. |
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppandroid.hybrid.mp4Android: mWeb Chromeandroid.chrome.mp4iOS: HybridAppios.hybrid.mp4iOS: mWeb Safariios.safari.mp4MacOS: Chrome / Safarimac.safari.mp4 |
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🚧 cristipaval has triggered a test Expensify/App build. You can view the workflow run here. |
|
🧪🧪 Use the links below to test this adhoc build on Android, iOS, and Web. Happy testing! 🧪🧪
|
|
🚀 Deployed to staging by https://github.com/cristipaval in version: 9.4.45-0 🚀
|
|
🤖 Help site review: no changes required I reviewed the changes in this PR against Expensify's help site content under Conclusion: No help site (HelpDot) updates are needed, so I did not create a draft PR. Why:
Since there's no user-facing documented behavior affected, there's nothing to update on the help site for this change. @dmkt9, please review the linked help site PR and confirm it reflects the current behavior. Then mark the linked help site PR (Note: no help site PR was created because no documentation changes are required for this internal bug fix. If you believe a specific article should be updated, let me know which one and I'll draft the changes.) |
|
🚀 Deployed to production by https://github.com/marcaaron in version: 9.4.45-14 🚀
Bundle Size Analysis (Sentry): |
Explanation of Change
After a video plays to the end, the Play button decides between "resume" and "replay from the start" using the
isEndedReact state flag. Changing the playback speed writesplayer.playbackRate, which on iOS momentarily resumes playback; that resume fires theplayingChangelistener, which clearsisEndedback tofalseeven though the playhead never left the end. So a subsequent tap on Play skipped the replay branch and called a bareplayVideo()on a player already parked at its end — a no-op — and the video appeared stuck.This change bases the replay decision on the playhead position rather than the fragile
isEndedflag. IntogglePlayCurrentVideo(src/components/VideoPlayer/BaseVideoPlayer.tsx), the guard now replays whenever a loaded, paused video is at (or within a small tolerance of) its end:duration > 0 && currentTime >= duration - CONST.VIDEO_PLAYER.REPLAY_END_THRESHOLD_SECONDS. This branch only runs after the "player is playing" early-return, so a paused playhead neardurationunambiguously means "finished" and should replay, regardless of whetherisEndedwas spuriously cleared. Mid-video resume (currentTimewell belowduration) still falls through toplayVideo(), so no existing behavior changes.The
0.15stolerance (REPLAY_END_THRESHOLD_SECONDS) absorbs the gap left becausetimeUpdatesamples every ~0.1sand stops firing once the video pauses at the end, socurrentTimecan freeze just short ofduration. It is pulled out as a namedCONSTrather than a bare literal.Fixed Issues
$ #91224
PROPOSAL: #91224 (comment)
Tests
2).Offline tests
Same as Tests
QA Steps
Same as Tests
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectionAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari