fix tv, fix censored

This commit is contained in:
j 2014-09-13 22:18:46 +01:00
parent 35c9ce73cc
commit 0af1b545d1
2 changed files with 8 additions and 17 deletions

View file

@ -76,6 +76,9 @@ pandora.ui.tv = function() {
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: videoOptions.subtitles,
subtitlesDefaultTrack: Ox.getLanguageNameByCode(pandora.site.language),
subtitlesLayer: videoOptions.subtitlesLayer,
subtitlesTrack: Ox.getLanguageNameByCode(pandora.site.language),
tooltips: true, tooltips: true,
timeline: '/' + result.data.item + '/timeline16p.jpg', timeline: '/' + result.data.item + '/timeline16p.jpg',
title: pandora.site.site.name + ' — ' + ( title: pandora.site.site.name + ' — ' + (

View file

@ -1758,29 +1758,17 @@ pandora.getVideoOptions = function(data) {
}).map(function(layer) { }).map(function(layer) {
return layer.id; return layer.id;
})[0]; })[0];
options.subtitles = options.subtitlesLayer
? data.layers[options.subtitlesLayer].map(function(subtitle) {
return Ox.extend({
id: subtitle.id,
'in': subtitle['in'],
out: subtitle.out,
text: subtitle.value.replace(/\n/g, ' ').replace(/<br\/?>/g, '\n')
}, subtitle.languages ? {
tracks: subtitle.languages
} : {});
})
: [];
options.censored = canPlayVideo ? [] options.censored = canPlayVideo ? []
: canPlayClips ? ( : canPlayClips ? (
options.subtitles.length options.subtitlesLayer
? options.subtitles.map(function(subtitle, i) { ? data.layers[options.subtitlesLayer].map(function(subtitle, i) {
return { return {
'in': i == 0 ? 0 : options.subtitles[i - 1].out, 'in': i == 0 ? 0 : subtitles[i - 1].out,
out: subtitle['in'] out: subtitle['in']
}; };
}).concat( }).concat(
[{'in': Ox.last(options.subtitles).out, out: data.duration}] [{'in': Ox.last(data.layers[options.subtitlesLayer]).out, out: data.duration}]
).filter(function(censored) { ).filter(function(censored) {
// don't include gaps shorter than one second // don't include gaps shorter than one second
return censored.out - censored['in'] >= 1; return censored.out - censored['in'] >= 1;