add playbackRate to video elements

This commit is contained in:
j 2016-03-29 14:26:04 +02:00
parent da08120ff4
commit f2e7c75d2c
5 changed files with 32 additions and 3 deletions

View file

@ -78,6 +78,7 @@ Ox.VideoAnnotationPanel = function(options, self) {
muted: false, muted: false,
out: 0, out: 0,
paused: true, paused: true,
playbackRate: 1,
position: 0, position: 0,
posterFrame: 0, posterFrame: 0,
resolution: 0, resolution: 0,
@ -119,6 +120,11 @@ Ox.VideoAnnotationPanel = function(options, self) {
paused: self.options.paused paused: self.options.paused
}); });
}, },
playbackRate: function() {
self.$player[0].options({
playbackRate: self.options.playbackRate
});
},
position: function() { position: function() {
setPosition(self.options.position); setPosition(self.options.position);
}, },
@ -397,6 +403,7 @@ Ox.VideoAnnotationPanel = function(options, self) {
muted: self.options.muted, muted: self.options.muted,
out: self.options.out, out: self.options.out,
paused: self.options.paused, paused: self.options.paused,
playbackRate: self.options.playbackRate,
position: type == 'play' ? self.options.position : self.options[type], position: type == 'play' ? self.options.position : self.options[type],
posterFrame: self.options.posterFrame, posterFrame: self.options.posterFrame,
resolution: self.options.resolution, resolution: self.options.resolution,

View file

@ -33,6 +33,7 @@ Ox.VideoEditPanel = function(options, self) {
muted: false, muted: false,
out: 0, out: 0,
paused: true, paused: true,
playbackRate: 1,
playInToOut: false, playInToOut: false,
position: 0, position: 0,
resolution: 0, resolution: 0,
@ -89,6 +90,9 @@ Ox.VideoEditPanel = function(options, self) {
paused: function() { paused: function() {
self.$video.options({paused: self.options.paused}); self.$video.options({paused: self.options.paused});
}, },
playbackRate: function() {
self.$video.options({playbackRate: self.options.playbackRate});
},
position: function() { position: function() {
self.$video.options({position: self.options.position}); self.$video.options({position: self.options.position});
self.$timeline.options({position: self.options.position}); self.$timeline.options({position: self.options.position});
@ -233,6 +237,7 @@ Ox.VideoEditPanel = function(options, self) {
loop: self.options.loop, loop: self.options.loop,
muted: self.options.muted, muted: self.options.muted,
out: self.options.out, out: self.options.out,
playbackRate: self.options.playbackRate,
paused: self.options.paused, paused: self.options.paused,
position: self.options.position, position: self.options.position,
resolution: self.options.resolution, resolution: self.options.resolution,

View file

@ -6,6 +6,7 @@ Ox.VideoElement <f> VideoElement Object
autoplay <b|false> autoplay autoplay <b|false> autoplay
items <a|[]> array of objects with src,in,out,duration items <a|[]> array of objects with src,in,out,duration
loop <b|false> loop playback loop <b|false> loop playback
playbackRate <n|1> playback rate
self <o> Shared private variable self <o> Shared private variable
([options[, self]]) -> <o:Ox.Element> VideoElement Object ([options[, self]]) -> <o:Ox.Element> VideoElement Object
loadedmetadata <!> loadedmetadata loadedmetadata <!> loadedmetadata
@ -23,6 +24,7 @@ Ox.VideoElement = function(options, self) {
.defaults({ .defaults({
autoplay: false, autoplay: false,
loop: false, loop: false,
playbackRate: 1,
items: [] items: []
}) })
.options(options || {}) .options(options || {})
@ -67,11 +69,13 @@ Ox.VideoElement = function(options, self) {
that.triggerEvent('durationchange', { that.triggerEvent('durationchange', {
duration: that.duration() duration: that.duration()
}); });
}); });
} }
} }
}); });
},
playbackRate: function() {
self.video.playbackRate = self.options.playbackRate;
} }
}) })
.css({width: '100%', height: '100%'}); .css({width: '100%', height: '100%'});
@ -157,7 +161,6 @@ Ox.VideoElement = function(options, self) {
} }
}); });
} }
}, },
seeking: function() { seeking: function() {
//seeking event triggered in setCurrentTime //seeking event triggered in setCurrentTime
@ -317,6 +320,7 @@ Ox.VideoElement = function(options, self) {
} }
self.video.volume = volume; self.video.volume = volume;
self.video.muted = muted; self.video.muted = muted;
self.video.playbackRate = self.options.playbackRate;
self.$video.css(css); self.$video.css(css);
self.buffering = true; self.buffering = true;
Ox.Log('Video', 'sCV', self.video.src, item['in'], Ox.Log('Video', 'sCV', self.video.src, item['in'],

View file

@ -47,6 +47,7 @@ Ox.VideoPlayer <f> Generic Video Player
loop <b|false> If true, video loops loop <b|false> If true, video loops
muted <b|false> If true, video is muted muted <b|false> If true, video is muted
paused <b|false> If true, video is paused paused <b|false> If true, video is paused
playbackRate: <n|1> playback rate
playInToOut <b|false> If true, video plays only from in to out playInToOut <b|false> If true, video plays only from in to out
position <n|0> Initial position (sec) position <n|0> Initial position (sec)
poster <s|''> Poster URL poster <s|''> Poster URL
@ -148,6 +149,7 @@ Ox.VideoPlayer = function(options, self) {
loop: false, loop: false,
muted: false, muted: false,
paused: false, paused: false,
playbackRate: 1,
playInToOut: false, playInToOut: false,
position: 0, position: 0,
poster: '', poster: '',
@ -207,6 +209,11 @@ Ox.VideoPlayer = function(options, self) {
self.options.paused = !self.options.paused; self.options.paused = !self.options.paused;
togglePaused(); togglePaused();
}, },
playbackRate: function() {
self.$video.options({
playbackRate: self.options.playbackRate
});
},
position: function() { position: function() {
setPosition(self.options.position); setPosition(self.options.position);
}, },
@ -430,7 +437,8 @@ Ox.VideoPlayer = function(options, self) {
}); });
self.$video = Ox.VideoElement({ self.$video = Ox.VideoElement({
items: self.video items: self.video,
playbackRate: self.options.playbackRate
}) })
.bindEvent(Ox.extend({ .bindEvent(Ox.extend({
durationchange: durationchange, durationchange: durationchange,

View file

@ -55,6 +55,7 @@ Ox.VideoTimelinePanel = function(options, self) {
muted: false, muted: false,
out: 0, out: 0,
paused: true, paused: true,
playbackRate: 1,
position: 0, position: 0,
resolution: 0, resolution: 0,
selected: '', selected: '',
@ -79,6 +80,9 @@ Ox.VideoTimelinePanel = function(options, self) {
paused: function() { paused: function() {
self.$player.options({paused: self.options.paused}); self.$player.options({paused: self.options.paused});
}, },
playbackRate: function() {
self.$player.options({playbackRate: self.options.playbackRate});
},
position: function() { position: function() {
setPosition(self.options.position); setPosition(self.options.position);
}, },
@ -121,6 +125,7 @@ Ox.VideoTimelinePanel = function(options, self) {
height: self.options.height, height: self.options.height,
muted: self.options.muted, muted: self.options.muted,
paused: self.options.paused, paused: self.options.paused,
playbackRate: self.options.playbackRate,
position: self.options.position, position: self.options.position,
resolution: self.options.resolution, resolution: self.options.resolution,
smallTimelineURL: self.options.smallTimelineURL, smallTimelineURL: self.options.smallTimelineURL,