From 291b75c43baf0422a9376bdb3a1252afd7623adc Mon Sep 17 00:00:00 2001 From: rlx <0x0073@0x2620.org> Date: Sat, 5 Nov 2011 16:03:13 +0000 Subject: [PATCH] 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 --- source/Ox.UI/js/Core/Ox.Element.js | 2 +- source/Ox.UI/js/Video/Ox.VideoEditor.js | 9 ++++++++- source/Ox.UI/js/Video/Ox.VideoPanelPlayer.js | 6 ++++++ source/Ox.UI/js/Video/Ox.VideoPlayer.js | 8 +++++++- 4 files changed, 22 insertions(+), 3 deletions(-) diff --git a/source/Ox.UI/js/Core/Ox.Element.js b/source/Ox.UI/js/Core/Ox.Element.js index 1966cae6..53c5970d 100644 --- a/source/Ox.UI/js/Core/Ox.Element.js +++ b/source/Ox.UI/js/Core/Ox.Element.js @@ -427,7 +427,7 @@ Ox.Element = function(options, self) { 'playing', 'position', 'progress' ].indexOf(event) == -1) { 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, diff --git a/source/Ox.UI/js/Video/Ox.VideoEditor.js b/source/Ox.UI/js/Video/Ox.VideoEditor.js index 800e251e..3ecfa43b 100644 --- a/source/Ox.UI/js/Video/Ox.VideoEditor.js +++ b/source/Ox.UI/js/Video/Ox.VideoEditor.js @@ -204,7 +204,14 @@ Ox.VideoEditor = function(options, self) { muted: function(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, volume: function(data) { that.triggerEvent('volume', data); diff --git a/source/Ox.UI/js/Video/Ox.VideoPanelPlayer.js b/source/Ox.UI/js/Video/Ox.VideoPanelPlayer.js index 0cb61c9a..afb4be01 100644 --- a/source/Ox.UI/js/Video/Ox.VideoPanelPlayer.js +++ b/source/Ox.UI/js/Video/Ox.VideoPanelPlayer.js @@ -101,6 +101,12 @@ Ox.VideoPanelPlayer = function(options, self) { muted: function(data) { that.triggerEvent('muted', data); }, + paused: function(data) { + that.triggerEvent('paused', data); + }, + position: function(data) { + that.triggerEvent('position', data); + }, scale: function(data) { that.triggerEvent('scale', data); }, diff --git a/source/Ox.UI/js/Video/Ox.VideoPlayer.js b/source/Ox.UI/js/Video/Ox.VideoPlayer.js index 38778407..3cfcbc6e 100644 --- a/source/Ox.UI/js/Video/Ox.VideoPlayer.js +++ b/source/Ox.UI/js/Video/Ox.VideoPlayer.js @@ -1649,7 +1649,7 @@ Ox.VideoPlayer = function(options, self) { } else { setPosition(self.options.position, 'video'); } - that.triggerEvent('position', { + that.triggerEvent('playing', { position: self.options.position }); } @@ -2153,6 +2153,12 @@ Ox.VideoPlayer = function(options, self) { if (self.$playButton && from != 'button') { self.$playButton.toggleTitle(); } + that.triggerEvent('paused', { + paused: self.options.paused + }); + self.options.paused && that.triggerEvent('position', { + position: self.options.position + }); } function togglePlayIcon() {