Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Improve SmartTV scrubbing behavior #8988

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

bzizmo
Copy link
Contributor

@bzizmo bzizmo commented Feb 24, 2025

Description

This PR refactors the handling of pendingSeekTime to improve scrubbing behavior on SmartTVs. It introduces a more structured approach for handling seek updates, ensuring better UX for SmartTV users who navigate via remote controls.

Specific Changes proposed

  • Refactored pendingSeekTime handling in SeekBar, replacing direct property access with a getter/setter method.
  • Introduced disableSeekWhileScrubbingOnSTV option to prevent immediate seeks while scrubbing on SmartTVs.
  • Updated PlayProgressBar and CurrentTimeDisplay to respect pendingSeekTime.
  • Adjusted stepForward and stepBack to modify pendingSeekTime without immediately seeking, unless explicitly triggered.
  • Ensured seek confirmation occurs when the user presses Enter or completes scrubbing.
  • Added unit tests covering new SmartTV scrubbing behavior.

Requirements Checklist

  • Feature implemented / Bug fixed
  • If necessary, more likely in a feature request than a bug fix
    • Change has been verified in an actual browser (Chrome, Firefox, IE)
    • Unit Tests updated or fixed
    • Docs/guides updated
    • Example created (starter template on JSBin)
    • Has no DOM changes which impact accessiblilty or trigger warnings (e.g. Chrome issues tab)
    • Has no changes to JSDoc which cause npm run docs:api to error
  • Reviewed by Two Core Contributors

Borut Zizmond added 5 commits February 18, 2025 15:46
- Replace direct access to `this.pendingSeekTime_` with a public getter/setter (`pendingSeekTime()`).
- Update scrubbing logic in methods (getPercent, handleMouseMove, handleMouseUp, stepForward, stepBack, and handleAction)
- Add support for SmartTV devices by integrating the new `disableSeekWhileScrubbingOnSTV` option.
- Pass the event parameter to `bar.update()` in the update method.
- Added tests in `controls.test.js` to verify UI updates (progress bar & current-time display)
- Added tests in `player.test.js` to validate SmartTV seek logic
- Ensured `stepForward()` and `stepBack()` correctly update `pendingSeekTime`
- Verified `handleAction()` finalizes the seek and resets `pendingSeekTime`
- Fixed test for `disableSeekWhileScrubbingOnSTV = false` by recreating `SeekBar` instance
@bzizmo bzizmo requested a review from alex-barstow February 24, 2025 09:28
Copy link

codecov bot commented Feb 24, 2025

Codecov Report

Attention: Patch coverage is 88.00000% with 6 lines in your changes missing coverage. Please review.

Project coverage is 84.26%. Comparing base (8842d37) to head (26fcc0c).

Files with missing lines Patch % Lines
src/js/control-bar/progress-control/seek-bar.js 89.18% 4 Missing ⚠️
.../control-bar/progress-control/play-progress-bar.js 75.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8988      +/-   ##
==========================================
+ Coverage   84.13%   84.26%   +0.13%     
==========================================
  Files         120      120              
  Lines        8117     8149      +32     
  Branches     1948     1965      +17     
==========================================
+ Hits         6829     6867      +38     
+ Misses       1288     1282       -6     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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