pandora/static/js/pandora/videoPreview.js

29 lines
990 B
JavaScript
Raw Normal View History

2011-08-08 13:58:28 +00:00
// vim: et:ts=4:sw=4:sts=4:ft=javascript
2011-11-05 17:04:10 +00:00
'use strict';
2011-08-08 13:58:28 +00:00
pandora.ui.videoPreview = function(data) {
2011-09-18 06:51:28 +00:00
var 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) {
2012-05-22 15:07:34 +00:00
var resolutions = pandora.site.video.resolutions.filter(function(resolution, i) {
2012-01-30 20:48:04 +00:00
return resolution >= data.height;
}),
resolution = resolutions.length
2012-01-30 21:16:58 +00:00
? Ox.min(resolutions)
: Ox.max(pandora.site.video.resolutions);
2011-08-08 13:58:28 +00:00
return '/' + data.id + '/' + resolution + 'p' + (
Ox.isUndefined(position) ? '' : position
) + '.jpg';
},
2011-09-18 06:51:28 +00:00
frameRatio: data.frameRatio,
2011-09-19 12:29:55 +00:00
height: data.height,
2011-09-29 17:25:04 +00:00
position: data.position,
2011-09-18 21:18:05 +00:00
scaleToFill: true,
2012-05-17 09:38:59 +00:00
timeline: '/' + data.id + '/timeline16p.jpg',
2011-09-19 12:29:55 +00:00
width: data.width
2011-08-08 13:58:28 +00:00
});
return that;
};