pass audioTrack, expand languages before passing

This commit is contained in:
j 2014-07-24 19:21:57 +02:00
parent 32719a212c
commit afae94a1be
3 changed files with 14 additions and 17 deletions

View file

@ -14,6 +14,7 @@ pandora.ui.editor = function(data) {
annotationsSort: ui.annotationsSort,
annotationsTooltip: Ox._('annotations')
+ ' <span class="OxBright">' + Ox.SYMBOLS.SHIFT + 'A</span>',
audioTrack: data.audioTrack,
censored: data.censored,
censoredIcon: pandora.site.cantPlay.icon,
censoredTooltip: Ox._(pandora.site.cantPlay.text),
@ -60,8 +61,9 @@ pandora.ui.editor = function(data) {
showLayers: Ox.clone(ui.showLayers),
showUsers: pandora.site.annotations.showUsers,
subtitles: data.subtitles,
subtitlesDefaultTrack: pandora.site.language,
subtitlesDefaultTrack: Ox.getLanguageNameByCode(pandora.site.language),
subtitlesLayer: data.subtitlesLayer,
subtitlesTrack: Ox.getLanguageNameByCode(pandora.site.language),
timeline: ui.videoTimeline,
timelines: pandora.site.timelines,
video: data.video,

View file

@ -14,7 +14,7 @@ pandora.ui.player = function(data) {
annotationsSort: ui.annotationsSort,
annotationsTooltip: Ox._('annotations')
+ ' <span class="OxBright">' + Ox.SYMBOLS.SHIFT + 'A</span>',
audioTrack: data.audioTracks ? data.audioTracks[0] : void 0,
audioTrack: data.audioTrack,
censored: data.censored,
censoredIcon: pandora.site.cantPlay.icon,
censoredTooltip: Ox._(pandora.site.cantPlay.text),
@ -49,8 +49,9 @@ pandora.ui.player = function(data) {
showUsers: pandora.site.annotations.showUsers,
showTimeline: ui.showTimeline,
smallTimelineURL: pandora.getMediaURL('/' + ui.item + '/timeline16p.jpg'),
subtitles: data.subtitles,
subtitlesDefaultTrack: pandora.site.language,
subtitlesDefaultTrack: Ox.getLanguageNameByCode(pandora.site.language),
subtitlesLayer: data.subtitlesLayer,
subtitlesTrack: Ox.getLanguageNameByCode(pandora.site.language),
timeline: ui.videoTimeline,
timelineTooltip: Ox._('timeline') + ' <span class="OxBright">' + Ox.SYMBOLS.SHIFT + 'T</span>',
video: data.video,

View file

@ -1758,18 +1758,6 @@ pandora.getVideoOptions = function(data) {
}).map(function(layer) {
return layer.id;
})[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 ? []
: canPlayClips ? (
options.subtitles.length
@ -1800,7 +1788,7 @@ pandora.getVideoOptions = function(data) {
options.video.push({
duration: data.durations[i],
index: i,
track: track,
track: Ox.getLanguageNameByCode(track),
resolution: resolution,
src: pandora.getVideoURL(data.item || pandora.user.ui.item, resolution, i + 1, track)
});
@ -1817,6 +1805,7 @@ pandora.getVideoOptions = function(data) {
});
}
});
options.audioTrack = data.audioTracks ? Ox.getLanguageNameByCode(data.audioTracks[0]) : void 0;
options.annotations = [];
pandora.site.layers.forEach(function(layer, i) {
options.annotations[i] = Ox.extend({}, layer, {
@ -1827,6 +1816,11 @@ pandora.getVideoOptions = function(data) {
annotation.editable = annotation.editable
|| annotation.user == pandora.user.username
|| pandora.site.capabilities['canEditAnnotations'][pandora.user.level];
annotation.languages = (
annotation.languages || [pandora.site.language]
).map(function(language) {
return Ox.getLanguageNameByCode(language);
});
return annotation;
})
});