fix subtitle selection in player menu
This commit is contained in:
parent
07ec93179c
commit
ab21bdbe25
2 changed files with 13 additions and 10 deletions
|
@ -2128,6 +2128,7 @@ Ox.VideoPlayer = function(options, self) {
|
||||||
} else if (data.group == 'subtitlesTrack') {
|
} else if (data.group == 'subtitlesTrack') {
|
||||||
self.options.subtitlesTrack = data.id == 'None'
|
self.options.subtitlesTrack = data.id == 'None'
|
||||||
? '' : data.id;
|
? '' : data.id;
|
||||||
|
self.options.enableSubtitles = !!self.options.subtitlesTrack;
|
||||||
setSubtitlesTrack();
|
setSubtitlesTrack();
|
||||||
} else if (data.group == 'timeline') {
|
} else if (data.group == 'timeline') {
|
||||||
type = self.options.timelineTypes[
|
type = self.options.timelineTypes[
|
||||||
|
@ -2343,23 +2344,20 @@ Ox.VideoPlayer = function(options, self) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function setSubtitlesTrack() {
|
function setSubtitlesTrack() {
|
||||||
var enableSubtitles = self.options.enableSubtitles && !!self.options.subtitlesTrack,
|
var enableSubtitles = self.options.enableSubtitles && !!self.options.subtitlesTrack;
|
||||||
toggleSubtitles = enableSubtitles != self.options.enableSubtitles;
|
|
||||||
self.options.enableSubtitles = enableSubtitles;
|
self.options.enableSubtitles = enableSubtitles;
|
||||||
setSubtitle();
|
setSubtitle();
|
||||||
self.$timeline && self.$timeline.options({
|
self.$timeline && self.$timeline.options({
|
||||||
subtitles: getSubtitles()
|
subtitles: getSubtitles()
|
||||||
});
|
});
|
||||||
if (toggleSubtitles) {
|
if (enableSubtitles && !!self.options.subtitlesTrack) {
|
||||||
self.options.enableSubtitles = enableSubtitles;
|
|
||||||
that.triggerEvent('subtitles', {
|
|
||||||
subtitles: self.options.enableSubtitles
|
|
||||||
});
|
|
||||||
}
|
|
||||||
if (enableSubtitles) {
|
|
||||||
that.triggerEvent('subtitlestrack', {
|
that.triggerEvent('subtitlestrack', {
|
||||||
track: self.options.subtitlesTrack
|
track: self.options.subtitlesTrack
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
that.triggerEvent('subtitles', {
|
||||||
|
subtitles: self.options.enableSubtitles
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -292,6 +292,11 @@ Ox.VideoPlayerPanel = function(options, self) {
|
||||||
that.triggerEvent('subtitles', data);
|
that.triggerEvent('subtitles', data);
|
||||||
},
|
},
|
||||||
subtitlestrack: function(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.options.subtitlesTrack = data.track;
|
||||||
self.$timeline.options({subtitles: getSubtitles()});
|
self.$timeline.options({subtitles: getSubtitles()});
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue