From c24a3a8173aeb855e9ca654c331e480e1af45213 Mon Sep 17 00:00:00 2001 From: Erik Straub Date: Wed, 28 Oct 2015 18:01:15 -0400 Subject: [PATCH] @brkattk updated emulateTextTrack to exit early if no textTracks. closes #2426 --- CHANGELOG.md | 1 + src/js/tech/tech.js | 10 +++++----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 28e5735c3..451a912bd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ CHANGELOG * @forbesjo Added Microsoft Caption Maker link ([view](https://github.com/videojs/video.js/pull/2618)) * @misteroneill updated modal dialog CSS ([view](https://github.com/videojs/video.js/pull/2756)) * @misteroneill Add browserify +* @brkattk updated emulateTextTrack to exit early if no textTracks ([view](https://github.com/videojs/video.js/pull/2426)) -------------------- diff --git a/src/js/tech/tech.js b/src/js/tech/tech.js index 895ff60fc..b9c896d6e 100644 --- a/src/js/tech/tech.js +++ b/src/js/tech/tech.js @@ -309,6 +309,11 @@ class Tech extends Component { * @method emulateTextTracks */ emulateTextTracks() { + let tracks = this.textTracks(); + if (!tracks) { + return; + } + if (!window['WebVTT'] && this.el().parentNode != null) { let script = document.createElement('script'); script.src = this.options_['vtt.js'] || '../node_modules/vtt.js/dist/vtt.js'; @@ -316,11 +321,6 @@ class Tech extends Component { window['WebVTT'] = true; } - let tracks = this.textTracks(); - if (!tracks) { - return; - } - let textTracksChanges = Fn.bind(this, function() { let updateDisplay = () => this.trigger('texttrackchange');