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

fix(player): cache_.currentTime is not updated when the current time is set #8285

Merged
merged 2 commits into from
Jun 1, 2023

Conversation

amtins
Copy link
Contributor

@amtins amtins commented May 20, 2023

Description

This PR fixes the delay in the update of cache_.currentTime. Updating cache_.currentTime as soon as the currentTime is set avoids having to wait for the timeupdate event, which results in:

  • making cache_.currentTime more reliable
  • updating the progress bar on mouse up after dragging when the media is paused.

See also: #6232, #6234, #6370, #6372, partially covers #8283

Specific Changes proposed

  • Refactor currentTime method to decrease the indentation level
  • Updates cache_.currentTime when currentTime is used as a setter and the seconds parameter has a value that can be converted to a Number

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)
  • Reviewed by Two Core Contributors

…is set

Updating cache_.currentTime as soon as the currentTime is set avoids having to wait for the timeupdate event, which results in:

- making cache_.currentTime more reliable
- updating the progress bar on mouse up after dragging when the media is paused.

See also: videojs#6232, videojs#6234, videojs#6370, videojs#6372
@codecov
Copy link

codecov bot commented May 20, 2023

Codecov Report

Merging #8285 (7fa7336) into main (f1558c6) will increase coverage by 0.00%.
The diff coverage is 92.30%.

@@           Coverage Diff           @@
##             main    #8285   +/-   ##
=======================================
  Coverage   82.36%   82.36%           
=======================================
  Files         112      112           
  Lines        7483     7484    +1     
  Branches     1804     1805    +1     
=======================================
+ Hits         6163     6164    +1     
  Misses       1320     1320           
Impacted Files Coverage Δ
src/js/player.js 90.28% <92.30%> (+<0.01%) ⬆️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@amtins amtins mentioned this pull request May 21, 2023
7 tasks
@mister-ben mister-ben added the needs: LGTM Needs one or more additional approvals label May 22, 2023
@misteroneill misteroneill merged commit b782cb0 into videojs:main Jun 1, 2023
edirub pushed a commit to edirub/video.js that referenced this pull request Jun 8, 2023
…is set (videojs#8285)

Updating cache_.currentTime as soon as the currentTime is set avoids having to wait for the timeupdate event, which results in:

- making cache_.currentTime more reliable
- updating the progress bar on mouse up after dragging when the media is paused.

See also: videojs#6232, videojs#6234, videojs#6370, videojs#6372
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs: LGTM Needs one or more additional approvals
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants