fix tv subtitles

This commit is contained in:
j 2014-09-16 13:30:53 +02:00
parent 8aa95d35f2
commit dbac45f7ac
3 changed files with 16 additions and 3 deletions

View file

@ -3,7 +3,6 @@
'use strict';
pandora.ui.editor = function(data) {
var ui = pandora.user.ui,
that = Ox.VideoAnnotationPanel({

View file

@ -38,6 +38,20 @@ pandora.ui.tv = function() {
});
}
function getSubtitles(options) {
return options.subtitlesLayer ? options.annotations.filter(function(layer) {
return layer.id == options.subtitlesLayer;
})[0].items.map(function(subtitle) {
return {
id: subtitle.id,
'in': subtitle['in'],
out: subtitle.out,
text: subtitle.value.replace(/\n/g, ' ').replace(/<br\/?>/g, '\n'),
tracks: subtitle.languages || [Ox.getLanguageNameByCode(pandora.site.language)]
};
}) : []
}
function play() {
var $loading = $('<img>')
.attr({src: Ox.UI.getImageURL('symbolLoadingAnimated')})
@ -75,7 +89,7 @@ pandora.ui.tv = function() {
position: result.data.position,
resolution: pandora.user.ui.videoResolution,
scaleToFill: pandora.user.ui.videoScale == 'fill',
subtitles: videoOptions.subtitles,
subtitles: getSubtitles(videoOptions),
subtitlesDefaultTrack: Ox.getLanguageNameByCode(pandora.site.language),
subtitlesLayer: videoOptions.subtitlesLayer,
subtitlesTrack: Ox.getLanguageNameByCode(pandora.site.language),

View file

@ -1741,7 +1741,7 @@ pandora.getSubtitlesLayer = function() {
}).map(function(layer) {
return layer.id;
})[0];
}
};
pandora.getMediaURL = function(url) {
return pandora.site.site.mediaprefix + url;