From 904bf0cabf3a57b673661dbee837226998916cc9 Mon Sep 17 00:00:00 2001 From: Gary Katsevman Date: Wed, 19 Aug 2015 19:35:53 -0400 Subject: [PATCH] @gkatsev deep clone el for iOS to preserve tracks. closes #2494 --- CHANGELOG.md | 1 + src/js/tech/html5.js | 17 +---------------- 2 files changed, 2 insertions(+), 16 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f4e392dac7..3a1287c663 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -104,6 +104,7 @@ CHANGELOG * @gkatsev removed non-default track auto-disabling ([view](https://github.com/videojs/video.js/pull/2475)) * @gkatsev exported event helpers on videojs object ([view](https://github.com/videojs/video.js/pull/2491)) * @nickygerritsen fixed texttrack handling in IE10 ([view](https://github.com/videojs/video.js/pull/2481)) +* @gkatsev deep clone el for iOS to preserve tracks ([view](https://github.com/videojs/video.js/pull/2494)) -------------------- diff --git a/src/js/tech/html5.js b/src/js/tech/html5.js index 063e349d60..685c3b1af0 100644 --- a/src/js/tech/html5.js +++ b/src/js/tech/html5.js @@ -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; @@ -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