pass languages and audio track to player

This commit is contained in:
j 2014-07-23 17:45:39 +02:00
parent f61cc7ee54
commit 32719a212c
3 changed files with 34 additions and 11 deletions

View file

@ -13,6 +13,7 @@ pandora.ui.item = function() {
pandora.api.get({ pandora.api.get({
id: pandora.user.ui.item, id: pandora.user.ui.item,
keys: isVideoView ? [ keys: isVideoView ? [
'audioTracks',
'cuts', 'director', 'duration', 'durations', 'editable', 'layers', 'cuts', 'director', 'duration', 'durations', 'editable', 'layers',
'modified', 'parts', 'posterFrame', 'rendered', 'rightslevel', 'modified', 'parts', 'posterFrame', 'rendered', 'rightslevel',
'size', 'title', 'videoRatio', 'year' 'size', 'title', 'videoRatio', 'year'

View file

@ -14,6 +14,7 @@ pandora.ui.player = function(data) {
annotationsSort: ui.annotationsSort, annotationsSort: ui.annotationsSort,
annotationsTooltip: Ox._('annotations') annotationsTooltip: Ox._('annotations')
+ ' <span class="OxBright">' + Ox.SYMBOLS.SHIFT + 'A</span>', + ' <span class="OxBright">' + Ox.SYMBOLS.SHIFT + 'A</span>',
audioTrack: data.audioTracks ? data.audioTracks[0] : void 0,
censored: data.censored, censored: data.censored,
censoredIcon: pandora.site.cantPlay.icon, censoredIcon: pandora.site.cantPlay.icon,
censoredTooltip: Ox._(pandora.site.cantPlay.text), censoredTooltip: Ox._(pandora.site.cantPlay.text),

View file

@ -1738,13 +1738,15 @@ pandora.getMediaURL = function(url) {
return pandora.site.site.mediaprefix + url; return pandora.site.site.mediaprefix + url;
}; };
pandora.getVideoURL = function(id, resolution, part) { pandora.getVideoURL = function(id, resolution, part, track) {
var prefix = pandora.site.site.videoprefix var prefix = pandora.site.site.videoprefix
.replace('{id}', id) .replace('{id}', id)
.replace('{part}', part) .replace('{part}', part)
.replace('{resolution}', resolution) .replace('{resolution}', resolution)
.replace('{uid}', Ox.uid()); .replace('{uid}', Ox.uid());
return prefix + '/' + id + '/' + resolution + 'p' + part + '.' + pandora.user.videoFormat; return prefix + '/' + id + '/' + resolution + 'p' + part
+ (track ? '.' + track : '')
+ '.' + pandora.user.videoFormat;
}; };
pandora.getVideoOptions = function(data) { pandora.getVideoOptions = function(data) {
@ -1758,12 +1760,14 @@ pandora.getVideoOptions = function(data) {
})[0]; })[0];
options.subtitles = options.subtitlesLayer options.subtitles = options.subtitlesLayer
? data.layers[options.subtitlesLayer].map(function(subtitle) { ? data.layers[options.subtitlesLayer].map(function(subtitle) {
return { return Ox.extend({
id: subtitle.id, id: subtitle.id,
'in': subtitle['in'], 'in': subtitle['in'],
out: subtitle.out, out: subtitle.out,
text: subtitle.value.replace(/\n/g, ' ').replace(/<br\/?>/g, '\n') text: subtitle.value.replace(/\n/g, ' ').replace(/<br\/?>/g, '\n')
}; }, subtitle.languages ? {
tracks: subtitle.languages
} : {});
}) })
: []; : [];
options.censored = canPlayVideo ? [] options.censored = canPlayVideo ? []
@ -1788,15 +1792,31 @@ pandora.getVideoOptions = function(data) {
}) })
) )
: [{'in': 0, out: data.duration}]; : [{'in': 0, out: data.duration}];
options.video = {}; options.video = [];
pandora.site.video.resolutions.forEach(function(resolution) { pandora.site.video.resolutions.forEach(function(resolution) {
options.video[resolution] = Ox.range(data.parts).map(function(i) { if (data.audioTracks) {
return { data.audioTracks.forEach(function(track) {
Ox.range(data.parts).forEach(function(i) {
options.video.push({
duration: data.durations[i], duration: data.durations[i],
src: pandora.getVideoURL(data.item || pandora.user.ui.item, resolution, i + 1) index: i,
}; track: track,
resolution: resolution,
src: pandora.getVideoURL(data.item || pandora.user.ui.item, resolution, i + 1, track)
}); });
}); });
});
} else {
Ox.range(data.parts).forEach(function(i) {
options.video.push({
duration: data.durations[i],
index: i,
resolution: resolution,
src: pandora.getVideoURL(data.item || pandora.user.ui.item, resolution, i + 1)
});
});
}
});
options.annotations = []; options.annotations = [];
pandora.site.layers.forEach(function(layer, i) { pandora.site.layers.forEach(function(layer, i) {
options.annotations[i] = Ox.extend({}, layer, { options.annotations[i] = Ox.extend({}, layer, {
@ -1811,6 +1831,7 @@ pandora.getVideoOptions = function(data) {
}) })
}); });
}); });
Ox.Log('Video', 'VideoOptions', options);
return options; return options;
}; };