cablegates/static/js/pandora/ui/videoPreview.js

44 lines
1.6 KiB
JavaScript
Raw Normal View History

2011-08-08 13:58:28 +00:00
// vim: et:ts=4:sw=4:sts=4:ft=javascript
pandora.ui.videoPreview = function(data) {
var frameWidth = pandora.user.ui.sidebarSize,
2011-08-19 14:43:05 +00:00
frameHeight = Math.round(frameWidth / data.ratio),
2011-08-08 13:58:28 +00:00
that = Ox.VideoPreview({
2011-08-19 14:43:05 +00:00
duration: data.duration,
2011-08-08 13:58:28 +00:00
getFrame: function(position) {
var width = pandora.user.ui.sidebarSize,
height = Math.round(width / pandora.user.infoRatio),
2011-08-19 14:43:05 +00:00
resolution = Ox.filter(pandora.site.video.resolutions, function(resolution, i) {
return resolution >= height || i == pandora.site.video.resolutions.length - 1;
2011-08-08 13:58:28 +00:00
})[0];
return '/' + data.id + '/' + resolution + 'p' + (
Ox.isUndefined(position) ? '' : position
) + '.jpg';
},
frameHeight: frameHeight,
frameWidth: frameWidth,
timeline: '/' + data.id + '/timeline16p.png',
})
.bindEvent({
click: function(event) {
2011-08-16 13:28:12 +00:00
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)
);
}
2011-08-08 13:58:28 +00:00
}
});
function getResolution() {
return
}
return that;
};