cablegates/static/js/pandora/ui/videoPreview.js
2011-08-16 13:28:12 +00:00

43 lines
1.6 KiB
JavaScript

// vim: et:ts=4:sw=4:sts=4:ft=javascript
pandora.ui.videoPreview = function(data) {
var frameWidth = pandora.user.ui.sidebarSize,
frameHeight = Math.round(frameWidth / data.video.aspectRatio),
that = Ox.VideoPreview({
duration: data.video.duration,
getFrame: function(position) {
var width = pandora.user.ui.sidebarSize,
height = Math.round(width / pandora.user.infoRatio),
resolution = Ox.filter(data.video.resolutions, function(resolution, i) {
return resolution >= height || i == data.video.resolutions.length - 1;
})[0];
return '/' + data.id + '/' + resolution + 'p' + (
Ox.isUndefined(position) ? '' : position
) + '.jpg';
},
frameHeight: frameHeight,
frameWidth: frameWidth,
timeline: '/' + data.id + '/timeline16p.png',
})
.bindEvent({
click: function(event) {
if (pandora.user.ui.item) {
pandora.$ui[
pandora.user.ui.itemView == 'player' ? 'player' : 'editor'
].options({
position: event.position
});
} else {
pandora.UI.set('videoPosition|' + data.id, event.position);
pandora.URL.set(
'/' + data.id + '/timeline' //'/' + Ox.formatDuration(event.position, 2)
);
}
}
});
function getResolution() {
return
}
return that;
};