forked from 0x2620/pandora
fix tv subtitles
This commit is contained in:
parent
8aa95d35f2
commit
dbac45f7ac
3 changed files with 16 additions and 3 deletions
|
@ -3,7 +3,6 @@
|
|||
'use strict';
|
||||
|
||||
pandora.ui.editor = function(data) {
|
||||
|
||||
var ui = pandora.user.ui,
|
||||
|
||||
that = Ox.VideoAnnotationPanel({
|
||||
|
|
|
@ -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),
|
||||
|
|
|
@ -1741,7 +1741,7 @@ pandora.getSubtitlesLayer = function() {
|
|||
}).map(function(layer) {
|
||||
return layer.id;
|
||||
})[0];
|
||||
}
|
||||
};
|
||||
|
||||
pandora.getMediaURL = function(url) {
|
||||
return pandora.site.site.mediaprefix + url;
|
||||
|
|
Loading…
Reference in a new issue