-
Notifications
You must be signed in to change notification settings - Fork 793
Fix qualityLevels setup for video with source #979
Conversation
with a source. videojs.players[playerId] is not set yet when setupQualityLevels_ is called, but the player is already associated with the tag.
Thanks for catching this bug and submitting a fix for it! After some conversation with @gkatsev, |
…a video" This reverts commit a9541ac.
with a source. Defer setQualityLevels_ until tech is ready.
2cfd7eb
to
8aded32
Compare
@@ -547,7 +547,7 @@ class HlsHandler extends Component { | |||
this.ignoreNextSeekingEvent_ = true; | |||
}); | |||
|
|||
this.setupQualityLevels_(); | |||
this.tech_.ready(this.setupQualityLevels_.bind(this)); |
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.
I don't think you need .bind(this)
. Video.js takes care of that for you.
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.
er, wait, never mind. Ignore me. However, we shouldn't use .bind
because it's slow and doesn't run everywhere where we want to run.
You should be able to use an arrow function instead.
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.
Ha, I used an arrow function then changed it to bind
because I saw it used elsewhere.
There's a call to
Is that also problematic for the reasons above? |
I do believe for the same reasons that call could also be problematic, but for the purposes of this PR let's not worry about it. It'll be better to investigate that separately. This looks good to me |
@gkatsev I made the requested changes. Does it look good? |
Description
If a player is created from a
<video>
with a<source>
, qualityLevels integration is not set up.Specific Changes proposed
videojs.players[playerId]
is not set yet whensetupQualityLevels_
is called, but the player is already associated with the tag. Use thevideojs
function to get the player instead.Requirements Checklist