diff --git a/static/js/item.js b/static/js/item.js
index baee8721..a8102c32 100644
--- a/static/js/item.js
+++ b/static/js/item.js
@@ -13,6 +13,7 @@ pandora.ui.item = function() {
pandora.api.get({
id: pandora.user.ui.item,
keys: isVideoView ? [
+ 'audioTracks',
'cuts', 'director', 'duration', 'durations', 'editable', 'layers',
'modified', 'parts', 'posterFrame', 'rendered', 'rightslevel',
'size', 'title', 'videoRatio', 'year'
diff --git a/static/js/player.js b/static/js/player.js
index 5028b76d..3e71f905 100644
--- a/static/js/player.js
+++ b/static/js/player.js
@@ -14,6 +14,7 @@ pandora.ui.player = function(data) {
annotationsSort: ui.annotationsSort,
annotationsTooltip: Ox._('annotations')
+ ' ' + Ox.SYMBOLS.SHIFT + 'A',
+ audioTrack: data.audioTracks ? data.audioTracks[0] : void 0,
censored: data.censored,
censoredIcon: pandora.site.cantPlay.icon,
censoredTooltip: Ox._(pandora.site.cantPlay.text),
diff --git a/static/js/utils.js b/static/js/utils.js
index 40f83c90..45b18632 100644
--- a/static/js/utils.js
+++ b/static/js/utils.js
@@ -1738,13 +1738,15 @@ pandora.getMediaURL = function(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
.replace('{id}', id)
.replace('{part}', part)
.replace('{resolution}', resolution)
.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) {
@@ -1758,12 +1760,14 @@ pandora.getVideoOptions = function(data) {
})[0];
options.subtitles = options.subtitlesLayer
? data.layers[options.subtitlesLayer].map(function(subtitle) {
- return {
+ return Ox.extend({
id: subtitle.id,
'in': subtitle['in'],
out: subtitle.out,
text: subtitle.value.replace(/\n/g, ' ').replace(/
/g, '\n')
- };
+ }, subtitle.languages ? {
+ tracks: subtitle.languages
+ } : {});
})
: [];
options.censored = canPlayVideo ? []
@@ -1788,14 +1792,30 @@ pandora.getVideoOptions = function(data) {
})
)
: [{'in': 0, out: data.duration}];
- options.video = {};
+ options.video = [];
pandora.site.video.resolutions.forEach(function(resolution) {
- options.video[resolution] = Ox.range(data.parts).map(function(i) {
- return {
- duration: data.durations[i],
- src: pandora.getVideoURL(data.item || pandora.user.ui.item, resolution, i + 1)
- };
- });
+ if (data.audioTracks) {
+ data.audioTracks.forEach(function(track) {
+ Ox.range(data.parts).forEach(function(i) {
+ options.video.push({
+ duration: data.durations[i],
+ 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 = [];
pandora.site.layers.forEach(function(layer, i) {
@@ -1811,6 +1831,7 @@ pandora.getVideoOptions = function(data) {
})
});
});
+ Ox.Log('Video', 'VideoOptions', options);
return options;
};