dont fail for subs without tracks

This commit is contained in:
j 2014-09-13 23:59:55 +02:00
parent 6a9b60ddca
commit 4bcb39e758
2 changed files with 3 additions and 2 deletions

View file

@ -1561,6 +1561,7 @@ Ox.VideoAnnotationPanel = function(options, self) {
}
function updateSubtitles() {
// FIXME: missing: re-render subtitles submenu
self.options.subtitles = parseSubtitles();
self.$player.forEach(function($player) {
$player.options({subtitles: Ox.clone(self.options.subtitles, true)});

View file

@ -1617,7 +1617,7 @@ Ox.VideoPlayer = function(options, self) {
if (
v['in'] <= self.options.position
&& v.out >= self.options.position
&& Ox.contains(v.tracks, self.options.subtitlesTrack)
&& (!v.tracks || Ox.contains(v.tracks, self.options.subtitlesTrack))
) {
subtitle = v.text;
return false; // break
@ -1630,7 +1630,7 @@ Ox.VideoPlayer = function(options, self) {
function getSubtitles() {
return self.options.enableSubtitles
? self.options.subtitles.filter(function(v) {
return Ox.contains(v.tracks, self.options.subtitlesTrack);
return !v.tracks || Ox.contains(v.tracks, self.options.subtitlesTrack);
})
: [];
}