Ox.SmallVideoTimelineImage = function(options, self) {
self = self || {};
var that = Ox.Element({}, self)
.defaults({
duration: 1920,
editing: false,
getTimelineURL: null,
'in': 0,
out: 0,
results: [],
subtitles: [],
width: 256,
type: 'player'
})
.options(options || {})
.css({
position: 'absolute',
width: self.options.width + 'px'
});
// fixme: unless we do a block timeline,
// we can always use a single 1920 png
self.height = self.options.type == 'player' ? 16 : 24;
self.imageHeight = self.options.type == 'player' ? 16 : 18;
self.imageTop = self.options.type == 'player' ? 0 : 3;
that.css({
height: self.height + 'px'
});
self.$timeline = $('')
.attr({
src: Ox.UI.PATH + 'png/transparent.png'
})
.css({
position: 'absolute',
width: self.options.width + 'px',
height: self.imageHeight + 'px',
top: self.imageTop + 'px'
})
.appendTo(that.$element);
getImageURL('timeline', function(imageURL) {
self.$timeline.attr({
src: imageURL
});
that.triggerEvent('load');
});
self.$subtitles = $('')
.attr({
src: getImageURL('subtitles')
})
.css({
position: 'absolute',
width: self.options.width + 'px',
height: self.imageHeight + 'px',
top: self.imageTop + 'px'
})
.appendTo(that.$element);
self.$results = $('')
.attr({
src: getImageURL('results')
})
.css({
position: 'absolute',
width: self.options.width + 'px',
height: self.imageHeight + 'px',
top: self.imageTop + 'px'
})
.appendTo(that.$element);
self.$selection = $('')
.attr({
src: getImageURL('selection')
})
.css({
position: 'absolute',
width: self.options.width + 'px',
height: self.imageHeight + 'px',
top: self.imageTop + 'px'
})
.appendTo(that.$element);
function getImageURL(image, callback) {
Ox.print(image == 'results' || image == 'selection' ?
self.options.width : Math.ceil(self.options.duration))
var width = image == 'results' || image == 'selection' ?
self.options.width : Math.ceil(self.options.duration),
height = self.imageHeight,
canvas = $('