Skip to content

Commit

Permalink
fix(html5): exit early on emulated tracks in html5 (#3772)
Browse files Browse the repository at this point in the history
addRemoteTextTrack and removeRemoteTextTrack in Html5 tech assumed that
they are always called for native text tracks. However, Html5 tech can
have emulated text tracks. For those, we just exit early after the super
methods are called.
  • Loading branch information
gkatsev committed Nov 11, 2016
1 parent 6b477bb commit 252bcee
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/js/tech/html5.js
Original file line number Diff line number Diff line change
Expand Up @@ -657,7 +657,9 @@ class Html5 extends Tech {
addRemoteTextTrack(options, manualCleanup) {
const htmlTrackElement = super.addRemoteTextTrack(options, manualCleanup);

this.el().appendChild(htmlTrackElement);
if (this.featuresNativeTextTracks) {
this.el().appendChild(htmlTrackElement);
}

return htmlTrackElement;
}
Expand All @@ -670,13 +672,15 @@ class Html5 extends Tech {
removeRemoteTextTrack(track) {
super.removeRemoteTextTrack(track);

const tracks = this.$$('track');
if (this.featuresNativeTextTracks) {
const tracks = this.$$('track');

let i = tracks.length;
let i = tracks.length;

while (i--) {
if (track === tracks[i] || track === tracks[i].track) {
this.el().removeChild(tracks[i]);
while (i--) {
if (track === tracks[i] || track === tracks[i].track) {
this.el().removeChild(tracks[i]);
}
}
}
}
Expand Down

0 comments on commit 252bcee

Please sign in to comment.