cablegates/static/js/pandora/ui/flipbook.js

27 lines
1 KiB
JavaScript
Raw Normal View History

2011-07-29 18:37:11 +00:00
// vim: et:ts=4:sw=4:sts=4:ft=javascript
2011-05-25 19:42:45 +00:00
pandora.ui.flipbook = function(item) {
2011-06-19 17:49:25 +00:00
var that = Ox.Flipbook({
2011-05-25 19:42:45 +00:00
}).bindEvent('click', function(event, data) {
pandora.UI.set('videoPosition|' + item, data.position);
pandora.URL.set(item + '/timeline');
});
2011-07-30 12:23:06 +00:00
pandora.api.get({id: item, keys: ['duration', 'posterFrame']}, function(result) {
2011-06-01 11:03:43 +00:00
var duration = result.data.duration,
posterFrame = result.data.posterFrame || parseInt(duration/2),
2011-05-25 19:42:45 +00:00
steps = 24,
2011-08-06 18:18:39 +00:00
framePrefix = '/' + item + '/' + that.height() + 'p',
2011-05-25 19:42:45 +00:00
frames = {};
Ox.range(0, duration, duration/steps).forEach(function(position) {
position = parseInt(position);
frames[position] = framePrefix + position + '.jpg';
});
that.options({
frames: frames,
icon: framePrefix + posterFrame + '.jpg',
duration: duration
});
});
return that;
};