-
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
Updated player.ready to always be async #2188
Conversation
It probably has to do with the workarounds I've done previously to get around the fact that html5 is sync and flash is async. |
Also, code-wise, LGTM |
|
||
for (let i = 0; i < readyQueue.length; i++) { |
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.
kill those for-loops with extreme prejudice! :D
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.
➰ 🔫 🙀
Also, didn't someone say that text tracks are generally broken in master, currently? Possibly related to that as well. |
It's possible that we can remove the |
Ah, I know what the fix for the tests is. We need to actually trigger ready by ticking the clock forward. |
I have a PR against this that fixes the text track errors: heff#9 |
Thanks! Nice use of the PR PR. :) I tried that with one test but only ticked 1ms, which apparently isn't enough even though ready() waits 1ms. Guess it's safer to be more liberal with the time. Tests are passing now. Attempting to remove the ready listener now. |
Removed it and it's just the one test breaking now that tests specifically for that (like you said). Killing that test. |
@@ -730,22 +731,30 @@ class Component { | |||
* @return {Component} | |||
*/ | |||
triggerReady() { | |||
|
|||
// // Ready should only be fired once |
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.
@dmlap, I had this change in there but then decided to hold on it until we figured out how we wanted to handle tech changes. I forget where we landed, but also realized that the readyQueue does reset itself after ready is triggered, so ready listeners won't fire again on a tech change. That is, unless you listen for the ready event, not pass the function to ready(fn).
But basically the ready event was meant to let you add new ready listeners when the tech changes, it just may not be so clear that's the purpose. Maybe a techloaded
event is the answer.
da2d639
to
d3193f5
Compare
closes videojs#1667 Fix text track tests. Now that ready is async, we need to tick the clock so the ready handler fires. Remove unneeded ready test
For 5.0 we switched ready() to always execute listeners asynchronously, but for most internal use cases we would prefer the ready function to execute immediately if the component is already ready. Fixes videojs#2326 Related: videojs#2382, videojs#1667, videojs#2188
Addresses #1667
I've changed ready() and triggerReady() to always be async. However now a bunch of track tests are falling.
@gkatsev, can you provide any insight here? I would guess it has to do with the text track display.
video.js/src/js/tracks/text-track-display.js
Line 41 in 1ff361a
If I move the addRemoteTextTrack part out of the ready listener the tests actually pass, but then other tracks tests fail.