-
Notifications
You must be signed in to change notification settings - Fork 7.5k
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/reset progress bar #8160
Fix/reset progress bar #8160
Conversation
Codecov Report
@@ Coverage Diff @@
## main #8160 +/- ##
==========================================
+ Coverage 82.02% 82.12% +0.09%
==========================================
Files 110 112 +2
Lines 7344 7405 +61
Branches 1773 1786 +13
==========================================
+ Hits 6024 6081 +57
- Misses 1320 1324 +4
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
I also tried to use a unit test to add the test coverage, but it seems that the test below does not do what it says it does 😅 video.js/test/unit/reset-ui.test.js Lines 5 to 20 in 54830cd
|
Definitely a good catch! It would be worth either rewriting this unit test or writing new tests for all the functionality you've added |
d38890b
to
19d3e74
Compare
@usmanonazim Thank you for taking the time to review this PR. I will try to add the test coverage this weekend. |
dca3f97
to
9d58ef7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! Just had a question about the test 😁
@@ -3521,7 +3521,17 @@ class Player extends Component { | |||
resetProgressBar_() { | |||
this.currentTime(0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do resetProgressBar_
really need to call this.currentTime(0);
since the call to el.load()
will reset everything ?
Lines 1356 to 1382 in 2a99a78
Html5.resetMediaElement = function(el) { | |
if (!el) { | |
return; | |
} | |
const sources = el.querySelectorAll('source'); | |
let i = sources.length; | |
while (i--) { | |
el.removeChild(sources[i]); | |
} | |
// remove any src reference. | |
// not setting `src=''` because that throws an error | |
el.removeAttribute('src'); | |
if (typeof el.load === 'function') { | |
// wrapping in an iife so it's not deoptimized (#1060#discussion_r10324473) | |
(function() { | |
try { | |
el.load(); | |
} catch (e) { | |
// satisfy linter | |
} | |
}()); | |
} | |
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might not be necessary to call this.currentTime(0)
but I'm not 100% sure about that so I'd be happy still keeping that in the resetProgressBar_
fn
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me! 🥳
@usmanonazim thanks again for your review. 👍🏽 |
Description
When
player.reset
is called theload-progress-bar
,seek-bar
andcurrent-time-display
components are not correctly reset.Specific Changes proposed
Adds the missing UI components to the
resetProgressBar_
method so that they are properly reset.Requirements Checklist