diff --git a/source/UI/js/Video/VideoPlayer.js b/source/UI/js/Video/VideoPlayer.js index 958acd00..9a54b681 100644 --- a/source/UI/js/Video/VideoPlayer.js +++ b/source/UI/js/Video/VideoPlayer.js @@ -2110,7 +2110,7 @@ Ox.VideoPlayer = function(options, self) { self.options.enableDownload ? [{}, {id: 'download', title: Ox._('Download')}] : [] - ) + ) }) .addClass('OxControls OxSettings') .bindEvent({ @@ -2128,6 +2128,7 @@ Ox.VideoPlayer = function(options, self) { } else if (data.group == 'subtitlesTrack') { self.options.subtitlesTrack = data.id == 'None' ? '' : data.id; + self.options.enableSubtitles = !!self.options.subtitlesTrack; setSubtitlesTrack(); } else if (data.group == 'timeline') { type = self.options.timelineTypes[ @@ -2343,23 +2344,20 @@ Ox.VideoPlayer = function(options, self) { } function setSubtitlesTrack() { - var enableSubtitles = self.options.enableSubtitles && !!self.options.subtitlesTrack, - toggleSubtitles = enableSubtitles != self.options.enableSubtitles; + var enableSubtitles = self.options.enableSubtitles && !!self.options.subtitlesTrack; self.options.enableSubtitles = enableSubtitles; setSubtitle(); self.$timeline && self.$timeline.options({ subtitles: getSubtitles() }); - if (toggleSubtitles) { - self.options.enableSubtitles = enableSubtitles; - that.triggerEvent('subtitles', { - subtitles: self.options.enableSubtitles - }); - } - if (enableSubtitles) { + if (enableSubtitles && !!self.options.subtitlesTrack) { that.triggerEvent('subtitlestrack', { track: self.options.subtitlesTrack }); + } else { + that.triggerEvent('subtitles', { + subtitles: self.options.enableSubtitles + }); } } diff --git a/source/UI/js/Video/VideoPlayerPanel.js b/source/UI/js/Video/VideoPlayerPanel.js index dc133792..64d88182 100644 --- a/source/UI/js/Video/VideoPlayerPanel.js +++ b/source/UI/js/Video/VideoPlayerPanel.js @@ -292,6 +292,11 @@ Ox.VideoPlayerPanel = function(options, self) { that.triggerEvent('subtitles', data); }, subtitlestrack: function(data) { + var enableSubtitles = !!data.track; + if (enableSubtitles != self.options.enableSubtitles) { + self.options.enableSubtitles = enableSubtitles; + that.triggerEvent('subtitles', {subtitles: enableSubtitles}); + } self.options.subtitlesTrack = data.track; self.$timeline.options({subtitles: getSubtitles()}); },