video player: support subtitles options update
This commit is contained in:
parent
c7b03030bd
commit
e533af5cff
1 changed files with 27 additions and 16 deletions
|
@ -219,6 +219,9 @@ Ox.VideoPlayer = function(options, self) {
|
|||
sizeIsLarge: function() {
|
||||
self.$sizeButton.toggle();
|
||||
},
|
||||
subtitles: function() {
|
||||
loadSubtitles();
|
||||
},
|
||||
timeline: function() {
|
||||
self.$timeline.options({imageURL: self.options.timeline});
|
||||
},
|
||||
|
@ -1203,22 +1206,8 @@ Ox.VideoPlayer = function(options, self) {
|
|||
self.options.type != 'play' && setPosition(self.options.position);
|
||||
|
||||
self.results = [];
|
||||
if (self.options.subtitles) {
|
||||
if (Ox.isArray(self.options.subtitles)) {
|
||||
loadedsubtitles();
|
||||
} else {
|
||||
if (self.options.subtitles.indexOf('\n') > -1) {
|
||||
self.options.subtitles = Ox.parseSRT(self.options.subtitles);
|
||||
loadedsubtitles();
|
||||
} else {
|
||||
Ox.get(self.options.subtitles, function(data) {
|
||||
self.options.subtitles = Ox.parseSRT(data);
|
||||
loadedsubtitles();
|
||||
});
|
||||
self.options.subtitles = [];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
loadSubtitles();
|
||||
|
||||
setSizes(false, function() {
|
||||
self.options.fullscreen && enterFullscreen();
|
||||
|
@ -1884,6 +1873,28 @@ Ox.VideoPlayer = function(options, self) {
|
|||
subtitles: self.options.subtitles
|
||||
});
|
||||
}
|
||||
} else {
|
||||
// needed on options change
|
||||
self.options.enableSubtitles && self.$subtitle && setSubtitle();
|
||||
}
|
||||
}
|
||||
|
||||
function loadSubtitles() {
|
||||
if (self.options.subtitles) {
|
||||
if (Ox.isArray(self.options.subtitles)) {
|
||||
loadedsubtitles();
|
||||
} else {
|
||||
if (self.options.subtitles.indexOf('\n') > -1) {
|
||||
self.options.subtitles = Ox.parseSRT(self.options.subtitles);
|
||||
loadedsubtitles();
|
||||
} else {
|
||||
Ox.get(self.options.subtitles, function(data) {
|
||||
self.options.subtitles = Ox.parseSRT(data);
|
||||
loadedsubtitles();
|
||||
});
|
||||
self.options.subtitles = [];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue