cleanup video url construction, add uid to prefix

This commit is contained in:
j 2012-03-03 14:56:35 +01:00
parent 141683d309
commit ab2c8f7d0f
4 changed files with 11 additions and 13 deletions

View file

@ -179,9 +179,7 @@ pandora.ui.clipList = function(videoRatio) {
poster: '/' + item + '/' + height + 'p' + points[0] + '.jpg', poster: '/' + item + '/' + height + 'p' + points[0] + '.jpg',
rewind: true, rewind: true,
video: partsAndPoints.parts.map(function(i) { video: partsAndPoints.parts.map(function(i) {
var part = (i + 1), return pandora.getVideoUrl(item, 96, i + 1);
prefix = pandora.site.site.videoprefix.replace('{part}', part);
return prefix + '/' + item + '/96p' + part + '.' + pandora.user.videoFormat;
}), }),
width: width width: width
}) })

View file

@ -43,9 +43,7 @@ pandora.ui.clipPlayer = function() {
partsAndPoints = pandora.getVideoPartsAndPoints(result.data.durations, points); partsAndPoints = pandora.getVideoPartsAndPoints(result.data.durations, points);
data[i] = { data[i] = {
parts: partsAndPoints.parts.map(function(i) { parts: partsAndPoints.parts.map(function(i) {
var part = (i + 1), return pandora.getVideoUrl(item, 96, i + 1);
prefix = pandora.site.site.videoprefix.replace('{part}', part);
return prefix + '/' + id + '/96p' + part + '.' + pandora.user.videoFormat;
}), }),
points: partsAndPoints.points points: partsAndPoints.points
}; };

View file

@ -107,9 +107,7 @@ pandora.ui.itemClips = function(options) {
poster: '/' + self.options.id + '/' + self.height + 'p' + points[0] + '.jpg', poster: '/' + self.options.id + '/' + self.height + 'p' + points[0] + '.jpg',
rewind: true, rewind: true,
video: partsAndPoints.parts.map(function(i) { video: partsAndPoints.parts.map(function(i) {
var part = (i + 1), return pandora.getVideoUrl(item, 96, i + 1);
prefix = pandora.site.site.videoprefix.replace('{part}', part);
return prefix + '/' + self.options.id + '/96p' + part + '.' + pandora.user.videoFormat;
}), }),
width: self.width width: self.width
}) })

View file

@ -792,6 +792,13 @@ pandora.getSortOperator = function(key) {
) > -1 ? '+' : '-'; ) > -1 ? '+' : '-';
}; };
pandora.getVideoUrl = function(id, resolution, part) {
var pandora.site.site.videoprefix
.replace('{uid}', Ox.uid())
.replace('{part}', part);
return prefix + '/' + id + '/' + resolution + 'p' + part + '.' + pandora.user.videoFormat;
}
pandora.getVideoOptions = function(data) { pandora.getVideoOptions = function(data) {
var canPlayClips = data.editable || pandora.site.capabilities.canPlayClips[pandora.user.level] >= data.rightslevel, var canPlayClips = data.editable || pandora.site.capabilities.canPlayClips[pandora.user.level] >= data.rightslevel,
canPlayVideo = data.editable || pandora.site.capabilities.canPlayVideo[pandora.user.level] >= data.rightslevel, canPlayVideo = data.editable || pandora.site.capabilities.canPlayVideo[pandora.user.level] >= data.rightslevel,
@ -828,10 +835,7 @@ pandora.getVideoOptions = function(data) {
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) { options.video[resolution] = Ox.range(data.parts).map(function(i) {
var part = (i + 1), return pandora.getVideoUrl(data.item || pandora.user.ui.item, resolution, i + 1);
prefix = pandora.site.site.videoprefix.replace('{part}', part);
return prefix + '/' + (data.item || pandora.user.ui.item) + '/'
+ resolution + 'p' + part + '.' + pandora.user.videoFormat;
}); });
}); });
options.layers = []; options.layers = [];