forked from 0x2620/pandora
merge
This commit is contained in:
commit
8cd2e78abc
3 changed files with 44 additions and 30 deletions
|
@ -144,17 +144,26 @@ pandora.getListData = function() {
|
||||||
return data;
|
return data;
|
||||||
};
|
};
|
||||||
|
|
||||||
pandora.getVideoPartAndPosition = function(durations, position) {
|
pandora.getVideoPartsAndPoints = function(durations, points) {
|
||||||
var duration = 0, ret;
|
var parts = durations.length,
|
||||||
Ox.forEach(durations, function(d, i) {
|
offsets = Ox.range(parts).map(function(i) {
|
||||||
if (duration + d > position) {
|
return Ox.sum(Ox.sub(durations, 0, i));
|
||||||
ret = {
|
}),
|
||||||
part: i,
|
ret = {
|
||||||
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;
|
||||||
}
|
}
|
||||||
return false;
|
});
|
||||||
}
|
});
|
||||||
duration += d;
|
ret.parts = Ox.unique(ret.parts);
|
||||||
|
ret.points = points.map(function(point) {
|
||||||
|
return point - offsets[ret.parts[0]];
|
||||||
});
|
});
|
||||||
return ret;
|
return ret;
|
||||||
};
|
};
|
||||||
|
|
|
@ -206,6 +206,16 @@ pandora.ui.item = function() {
|
||||||
.bindEvent('resize', function() {
|
.bindEvent('resize', function() {
|
||||||
pandora.$ui.map.resizeMap();
|
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') {
|
} else if (pandora.user.ui.itemView == 'player') {
|
||||||
// fixme: duplicated
|
// fixme: duplicated
|
||||||
var layers = [],
|
var layers = [],
|
||||||
|
@ -223,7 +233,7 @@ pandora.ui.item = function() {
|
||||||
pandora.$ui.contentPanel.replaceElement(1, pandora.$ui.player = Ox.VideoPanelPlayer({
|
pandora.$ui.contentPanel.replaceElement(1, pandora.$ui.player = Ox.VideoPanelPlayer({
|
||||||
annotationsSize: pandora.user.ui.annotationsSize,
|
annotationsSize: pandora.user.ui.annotationsSize,
|
||||||
cuts: result.data.cuts || [],
|
cuts: result.data.cuts || [],
|
||||||
duration: video.duration,
|
duration: result.data.duration,
|
||||||
getTimelineImageURL: function(i) {
|
getTimelineImageURL: function(i) {
|
||||||
return '/' + pandora.user.ui.item + '/timeline64p' + i + '.png';
|
return '/' + pandora.user.ui.item + '/timeline64p' + i + '.png';
|
||||||
},
|
},
|
||||||
|
@ -260,18 +270,9 @@ pandora.ui.item = function() {
|
||||||
pandora.UI.set('volume', data.volume);
|
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') {
|
} else if (pandora.user.ui.itemView == 'timeline') {
|
||||||
var layers = [],
|
var layers = [],
|
||||||
video = result.data.stream;
|
video = {};
|
||||||
$.each(pandora.site.layers, function(i, layer) {
|
$.each(pandora.site.layers, function(i, layer) {
|
||||||
layers[i] = $.extend({}, layer, {items: result.data.layers[layer.id]});
|
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({
|
pandora.$ui.contentPanel.replaceElement(1, pandora.$ui.editor = Ox.VideoEditor({
|
||||||
annotationsSize: pandora.user.ui.annotationsSize,
|
annotationsSize: pandora.user.ui.annotationsSize,
|
||||||
cuts: result.data.cuts || [],
|
cuts: result.data.cuts || [],
|
||||||
duration: video.duration,
|
duration: result.data.duration,
|
||||||
find: '',
|
find: '',
|
||||||
getFrameURL: function(position) {
|
getFrameURL: function(position) {
|
||||||
return '/' + pandora.user.ui.item + '/' + Ox.last(pandora.site.video.resolutions) + 'p' + position + '.jpg';
|
return '/' + pandora.user.ui.item + '/' + Ox.last(pandora.site.video.resolutions) + 'p' + position + '.jpg';
|
||||||
|
|
|
@ -214,7 +214,11 @@ pandora.ui.list = function() { // fixme: remove view argument
|
||||||
},
|
},
|
||||||
openpreview: function(data) {
|
openpreview: function(data) {
|
||||||
var $video = $('.OxItem.OxSelected > .OxIcon > .OxVideoPlayer');
|
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!!!@!')
|
$video && Ox.print('OPENPREVIEW!!!@!')
|
||||||
that.closePreview();
|
that.closePreview();
|
||||||
},
|
},
|
||||||
|
@ -229,18 +233,18 @@ pandora.ui.list = function() { // fixme: remove view argument
|
||||||
if ($img.length) {
|
if ($img.length) {
|
||||||
var width = parseInt($img.css('width')),
|
var width = parseInt($img.css('width')),
|
||||||
height = parseInt($img.css('height'));
|
height = parseInt($img.css('height'));
|
||||||
pandora.api.get({id: item, keys: ['parts']}, function(result) {
|
pandora.api.get({id: item, keys: ['durations']}, function(result) {
|
||||||
var inPoint = that.value(id, 'in'),
|
var points = [that.value(id, 'in'), that.value(id, 'out')],
|
||||||
outPoint = that.value(id, 'out'),
|
partsAndPoints = pandora.getVideoPartsAndPoints(result.data.durations, points),
|
||||||
$player = Ox.VideoPlayer({
|
$player = Ox.VideoPlayer({
|
||||||
height: height,
|
height: height,
|
||||||
'in': inPoint,
|
'in': partsAndPoints.points[0],
|
||||||
out: outPoint,
|
out: partsAndPoints.points[1],
|
||||||
paused: true,
|
paused: true,
|
||||||
playInToOut: true,
|
playInToOut: true,
|
||||||
poster: '/' + item + '/' + height + 'p' + that.value(id, 'in') + '.jpg',
|
poster: '/' + item + '/' + height + 'p' + points[0] + '.jpg',
|
||||||
width: width,
|
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
|
return '/' + item + '/96p' + (i + 1) + '.' + pandora.user.videoFormat
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in a new issue