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';
|
'use strict';
|
||||||
|
|
||||||
pandora.ui.editor = function(data) {
|
pandora.ui.editor = function(data) {
|
||||||
|
|
||||||
var ui = pandora.user.ui,
|
var ui = pandora.user.ui,
|
||||||
|
|
||||||
that = Ox.VideoAnnotationPanel({
|
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() {
|
function play() {
|
||||||
var $loading = $('<img>')
|
var $loading = $('<img>')
|
||||||
.attr({src: Ox.UI.getImageURL('symbolLoadingAnimated')})
|
.attr({src: Ox.UI.getImageURL('symbolLoadingAnimated')})
|
||||||
|
@ -75,7 +89,7 @@ pandora.ui.tv = function() {
|
||||||
position: result.data.position,
|
position: result.data.position,
|
||||||
resolution: pandora.user.ui.videoResolution,
|
resolution: pandora.user.ui.videoResolution,
|
||||||
scaleToFill: pandora.user.ui.videoScale == 'fill',
|
scaleToFill: pandora.user.ui.videoScale == 'fill',
|
||||||
subtitles: videoOptions.subtitles,
|
subtitles: getSubtitles(videoOptions),
|
||||||
subtitlesDefaultTrack: Ox.getLanguageNameByCode(pandora.site.language),
|
subtitlesDefaultTrack: Ox.getLanguageNameByCode(pandora.site.language),
|
||||||
subtitlesLayer: videoOptions.subtitlesLayer,
|
subtitlesLayer: videoOptions.subtitlesLayer,
|
||||||
subtitlesTrack: Ox.getLanguageNameByCode(pandora.site.language),
|
subtitlesTrack: Ox.getLanguageNameByCode(pandora.site.language),
|
||||||
|
|
|
@ -1741,7 +1741,7 @@ pandora.getSubtitlesLayer = function() {
|
||||||
}).map(function(layer) {
|
}).map(function(layer) {
|
||||||
return layer.id;
|
return layer.id;
|
||||||
})[0];
|
})[0];
|
||||||
}
|
};
|
||||||
|
|
||||||
pandora.getMediaURL = function(url) {
|
pandora.getMediaURL = function(url) {
|
||||||
return pandora.site.site.mediaprefix + url;
|
return pandora.site.site.mediaprefix + url;
|
||||||
|
|
Loading…
Reference in a new issue