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

Remove unused tracks from track list when changing source #3002

Closed

Conversation

nickygerritsen
Copy link
Contributor

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.

@@ -282,6 +293,33 @@ class Html5 extends Tech {
this.textTracks().removeTrack_(e.track);
}

removeOldTextTracks() {
Copy link
Member

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_.

Copy link
Contributor Author

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?

Copy link
Member

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...

@gkatsev gkatsev added minor This PR can be added to a minor release. It should not be added to a patch release. in progress labels Feb 3, 2016
@gkatsev
Copy link
Member

gkatsev commented Apr 29, 2016

This needs to be rebased plus there's a few minor comments that need to be addressed.

@nickygerritsen
Copy link
Contributor Author

Totally, completely forgot about this PR. I'll add some replies above so we can tackle this one.

@nickygerritsen nickygerritsen force-pushed the remove-tracks-on-loadstart branch from f8e846f to fc91497 Compare May 4, 2016 08:00
@nickygerritsen
Copy link
Contributor Author

I assume we do not have to remove video/audio tracks, as these are never native?

@gkatsev
Copy link
Member

gkatsev commented May 4, 2016

I think we might need to since we do listen to the addtrack on the native audio and video tracks as well. Thoughts, @brandonocasey?

@brandonocasey
Copy link
Contributor

I think Safari has support for native audio and video tracks so I think we will want to.

@nickygerritsen
Copy link
Contributor Author

OK then I'll try to mimic your way of doing this for all three track kinds.

@nickygerritsen
Copy link
Contributor Author

OK I think this does the trick. I removed all the Fn.bind goodness, as Events.on already does this. this also gets rid of a "strange" dance with the underscored and non-underscored version of the function.

@gkatsev
Copy link
Member

gkatsev commented May 11, 2016

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
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
confirmed minor This PR can be added to a minor release. It should not be added to a patch release.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Changing source does not clear tracks
3 participants