-
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
Remove unused tracks from track list when changing source #3002
Remove unused tracks from track list when changing source #3002
Conversation
@@ -282,6 +293,33 @@ class Html5 extends Tech { | |||
this.textTracks().removeTrack_(e.track); | |||
} | |||
|
|||
removeOldTextTracks() { |
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.
Make sure you consistently call this removeOldTextTracks_
.
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.
Hmmm I kinda copied this from the handle...
functions. Why are they not postfixed with _
but this one should be? As far as I know they actually should all be underscored?
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.
Oh I see, I must've missed that, I guess carry on...
This needs to be rebased plus there's a few minor comments that need to be addressed. |
Totally, completely forgot about this PR. I'll add some replies above so we can tackle this one. |
f8e846f
to
fc91497
Compare
I assume we do not have to remove video/audio tracks, as these are never native? |
I think we might need to since we do listen to the addtrack on the native audio and video tracks as well. Thoughts, @brandonocasey? |
I think Safari has support for native audio and video tracks so I think we will want to. |
OK then I'll try to mimic your way of doing this for all three track kinds. |
OK I think this does the trick. I removed all the |
LGTM |
@@ -94,6 +94,9 @@ class Html5 extends Tech { | |||
tl.addEventListener('change', Fn.bind(this, this[`handle${capitalType}TrackChange_`])); | |||
tl.addEventListener('addtrack', Fn.bind(this, this[`handle${capitalType}TrackAdd_`])); | |||
tl.addEventListener('removetrack', Fn.bind(this, this[`handle${capitalType}TrackRemove_`])); | |||
|
|||
// Remove (native) trackts that are not used anymore |
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.
oops, just realized this comment has tracks
misspelt.
This should fix #3000 . When using native text tracks it removes unused ones on
loadstart
.@gkatsev suggested using
inbandmetadatatrack
but that seems to be""
for my HLS subtitle tracks so I guess we can not use it.