in video player, separate playing event from position event, so controls that need live updates can bind to playing, while others can safely bind to position

This commit is contained in:
rlx 2011-11-05 16:03:13 +00:00
parent d152c4b48b
commit 291b75c43b
4 changed files with 22 additions and 3 deletions

View file

@ -427,7 +427,7 @@ Ox.Element = function(options, self) {
'playing', 'position', 'progress' 'playing', 'position', 'progress'
].indexOf(event) == -1) { ].indexOf(event) == -1) {
if (!/^pandora_/.test(event)) { if (!/^pandora_/.test(event)) {
Ox.Log('Core', that.id, self.options.id, 'trigger', event, data); Ox.Log('EVENT', that.id, self.options.id, 'trigger', event, data);
} }
} }
// it is necessary to check if self.$eventHandler exists, // it is necessary to check if self.$eventHandler exists,

View file

@ -204,7 +204,14 @@ Ox.VideoEditor = function(options, self) {
muted: function(data) { muted: function(data) {
that.triggerEvent('muted', data); that.triggerEvent('muted', data);
}, },
position: changePlayer, paused: function(data) {
that.triggerEvent('paused', data);
},
playing: changePlayer,
position: function(data) {
changePlayer(data);
that.triggerEvent('position', data);
},
size: toggleSize, size: toggleSize,
volume: function(data) { volume: function(data) {
that.triggerEvent('volume', data); that.triggerEvent('volume', data);

View file

@ -101,6 +101,12 @@ Ox.VideoPanelPlayer = function(options, self) {
muted: function(data) { muted: function(data) {
that.triggerEvent('muted', data); that.triggerEvent('muted', data);
}, },
paused: function(data) {
that.triggerEvent('paused', data);
},
position: function(data) {
that.triggerEvent('position', data);
},
scale: function(data) { scale: function(data) {
that.triggerEvent('scale', data); that.triggerEvent('scale', data);
}, },

View file

@ -1649,7 +1649,7 @@ Ox.VideoPlayer = function(options, self) {
} else { } else {
setPosition(self.options.position, 'video'); setPosition(self.options.position, 'video');
} }
that.triggerEvent('position', { that.triggerEvent('playing', {
position: self.options.position position: self.options.position
}); });
} }
@ -2153,6 +2153,12 @@ Ox.VideoPlayer = function(options, self) {
if (self.$playButton && from != 'button') { if (self.$playButton && from != 'button') {
self.$playButton.toggleTitle(); self.$playButton.toggleTitle();
} }
that.triggerEvent('paused', {
paused: self.options.paused
});
self.options.paused && that.triggerEvent('position', {
position: self.options.position
});
} }
function togglePlayIcon() { function togglePlayIcon() {