pandora/static/js/videoPreview.js

30 lines
1.1 KiB
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);
return pandora.getMediaURL('/' + data.id + '/' + resolution + 'p' + (
2011-08-08 13:58:28 +00:00
Ox.isUndefined(position) ? '' : position
) + '.jpg');
2011-08-08 13:58:28 +00:00
},
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,
timeline: pandora.getMediaURL('/' + data.id + '/timeline16p.jpg'),
2013-02-11 06:33:53 +00:00
videoTooltip: data.videoTooltip,
2011-09-19 12:29:55 +00:00
width: data.width
2011-08-08 13:58:28 +00:00
});
return that;
};