Skip to content

Commit

Permalink
Do a deep clone of the element to get the built-in tracks. This allow…
Browse files Browse the repository at this point in the history
…s us to not care about the 'tracks' option
  • Loading branch information
gkatsev committed Aug 19, 2015
1 parent afcdf5d commit 91d71c0
Showing 1 changed file with 1 addition and 16 deletions.
17 changes: 1 addition & 16 deletions src/js/tech/html5.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ class Html5 extends Tech {

// If the original tag is still there, clone and remove it.
if (el) {
const clone = el.cloneNode(false);
const clone = el.cloneNode(true);
el.parentNode.insertBefore(clone, el);
Html5.disposeMediaElement(el);
el = clone;
Expand All @@ -148,21 +148,6 @@ class Html5 extends Tech {
})
);
}

if (this.options_.tracks) {
for (let i = 0; i < this.options_.tracks.length; i++) {
const track = this.options_.tracks[i];
let trackEl = document.createElement('track');
trackEl.kind = track.kind;
trackEl.label = track.label;
trackEl.srclang = track.srclang;
trackEl.src = track.src;
if ('default' in track) {
trackEl.setAttribute('default', 'default');
}
el.appendChild(trackEl);
}
}
}

// Update specific tag settings, in case they were overridden
Expand Down

0 comments on commit 91d71c0

Please sign in to comment.