forked from 0x2620/oxjs
add new timeline and find input to video player
This commit is contained in:
parent
ac2ea5f53d
commit
ce33d3650a
6 changed files with 326 additions and 162 deletions
|
|
@ -14,7 +14,6 @@ Ox.SmallVideoTimelineImage = function(options, self) {
|
|||
type: 'player'
|
||||
})
|
||||
.options(options || {})
|
||||
.addClass('OxSmallVideoTimeline')
|
||||
.css({
|
||||
position: 'absolute',
|
||||
width: self.options.width + 'px'
|
||||
|
|
@ -84,6 +83,8 @@ Ox.SmallVideoTimelineImage = function(options, self) {
|
|||
.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,
|
||||
|
|
@ -160,21 +161,33 @@ Ox.SmallVideoTimelineImage = function(options, self) {
|
|||
});
|
||||
});
|
||||
} else if (image == 'timeline') {
|
||||
var counter = 0,
|
||||
images = Math.ceil(self.options.duration / 3600),
|
||||
var $image, counter, images,
|
||||
top = self.options.type == 'player' ? 0 : 1;
|
||||
Ox.loop(images, function(i) {
|
||||
var $image = $('<img>')
|
||||
if (Ox.isString(self.options.timeline)) {
|
||||
$image = $('<img>')
|
||||
.attr({
|
||||
src: self.options.getTimelineURL(i)
|
||||
src: self.options.getTimelineURL(0)
|
||||
})
|
||||
.load(function() {
|
||||
context.drawImage($image[0], i * 3600, top);
|
||||
if (++counter == images) {
|
||||
callback(canvas.toDataURL());
|
||||
}
|
||||
context.drawImage($image[0])
|
||||
callback(canvas.toDataURL());
|
||||
});
|
||||
})
|
||||
} else {
|
||||
counter = 0;
|
||||
images = Math.ceil(self.options.duration / 3600);
|
||||
Ox.loop(images, function(i) {
|
||||
var $image = $('<img>')
|
||||
.attr({
|
||||
src: self.options.getTimelineURL(i)
|
||||
})
|
||||
.load(function() {
|
||||
context.drawImage($image[0], i * 3600, top);
|
||||
if (++counter == images) {
|
||||
callback(canvas.toDataURL());
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
if (image != 'timeline') {
|
||||
context.putImageData(imageData, 0, 0);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue