This commit is contained in:
j 2011-08-19 22:23:32 +02:00
commit 8cd2e78abc
3 changed files with 44 additions and 30 deletions

View file

@ -144,17 +144,26 @@ pandora.getListData = function() {
return data;
};
pandora.getVideoPartAndPosition = function(durations, position) {
var duration = 0, ret;
Ox.forEach(durations, function(d, i) {
if (duration + d > position) {
pandora.getVideoPartsAndPoints = function(durations, points) {
var parts = durations.length,
offsets = Ox.range(parts).map(function(i) {
return Ox.sum(Ox.sub(durations, 0, i));
}),
ret = {
part: i,
position: position - duration
}
parts: [],
points: []
};
points.forEach(function(point, i) {
Ox.loop(parts - 1, -1, -1, function(i) {
if (offsets[i] <= point) {
ret.parts[i] = i;
return false;
}
duration += d;
});
});
ret.parts = Ox.unique(ret.parts);
ret.points = points.map(function(point) {
return point - offsets[ret.parts[0]];
});
return ret;
};

View file

@ -206,6 +206,16 @@ pandora.ui.item = function() {
.bindEvent('resize', function() {
pandora.$ui.map.resizeMap();
}));
} else if (pandora.user.ui.itemView == 'statistics') {
var stats = Ox.Container();
Ox.TreeList({
data: result.data,
width: pandora.$ui.mainPanel.size(1) - Ox.UI.SCROLLBAR_SIZE
}).appendTo(stats);
pandora.$ui.contentPanel.replaceElement(1, stats);
} else if (pandora.user.ui.itemView == 'player') {
// fixme: duplicated
var layers = [],
@ -223,7 +233,7 @@ pandora.ui.item = function() {
pandora.$ui.contentPanel.replaceElement(1, pandora.$ui.player = Ox.VideoPanelPlayer({
annotationsSize: pandora.user.ui.annotationsSize,
cuts: result.data.cuts || [],
duration: video.duration,
duration: result.data.duration,
getTimelineImageURL: function(i) {
return '/' + pandora.user.ui.item + '/timeline64p' + i + '.png';
},
@ -260,18 +270,9 @@ pandora.ui.item = function() {
pandora.UI.set('volume', data.volume);
},
}));
} else if (pandora.user.ui.itemView == 'statistics') {
var stats = Ox.Container();
Ox.TreeList({
data: result.data,
width: pandora.$ui.mainPanel.size(1) - Ox.UI.SCROLLBAR_SIZE
}).appendTo(stats);
pandora.$ui.contentPanel.replaceElement(1, stats);
} else if (pandora.user.ui.itemView == 'timeline') {
var layers = [],
video = result.data.stream;
video = {};
$.each(pandora.site.layers, function(i, layer) {
layers[i] = $.extend({}, layer, {items: result.data.layers[layer.id]});
});
@ -284,7 +285,7 @@ pandora.ui.item = function() {
pandora.$ui.contentPanel.replaceElement(1, pandora.$ui.editor = Ox.VideoEditor({
annotationsSize: pandora.user.ui.annotationsSize,
cuts: result.data.cuts || [],
duration: video.duration,
duration: result.data.duration,
find: '',
getFrameURL: function(position) {
return '/' + pandora.user.ui.item + '/' + Ox.last(pandora.site.video.resolutions) + 'p' + position + '.jpg';

View file

@ -214,7 +214,11 @@ pandora.ui.list = function() { // fixme: remove view argument
},
openpreview: function(data) {
var $video = $('.OxItem.OxSelected > .OxIcon > .OxVideoPlayer');
$video && $video.trigger('click');
if ($video) {
// trigger singleclick
$video.trigger('mousedown');
Ox.UI.$window.trigger('mouseup');
}
$video && Ox.print('OPENPREVIEW!!!@!')
that.closePreview();
},
@ -229,18 +233,18 @@ pandora.ui.list = function() { // fixme: remove view argument
if ($img.length) {
var width = parseInt($img.css('width')),
height = parseInt($img.css('height'));
pandora.api.get({id: item, keys: ['parts']}, function(result) {
var inPoint = that.value(id, 'in'),
outPoint = that.value(id, 'out'),
pandora.api.get({id: item, keys: ['durations']}, function(result) {
var points = [that.value(id, 'in'), that.value(id, 'out')],
partsAndPoints = pandora.getVideoPartsAndPoints(result.data.durations, points),
$player = Ox.VideoPlayer({
height: height,
'in': inPoint,
out: outPoint,
'in': partsAndPoints.points[0],
out: partsAndPoints.points[1],
paused: true,
playInToOut: true,
poster: '/' + item + '/' + height + 'p' + that.value(id, 'in') + '.jpg',
poster: '/' + item + '/' + height + 'p' + points[0] + '.jpg',
width: width,
video: Ox.range(result.data.parts).map(function(i) {
video: partsAndPoints.parts.map(function(i) {
return '/' + item + '/96p' + (i + 1) + '.' + pandora.user.videoFormat
})
})