add loading/seeking icon

This commit is contained in:
rolux 2011-05-12 12:51:17 +02:00
parent 13b887abfb
commit a7d5774855
2 changed files with 34 additions and 1 deletions

View file

@ -47,6 +47,12 @@ Ox.VideoElement = function(options, self) {
that.triggerEvent('progress', { that.triggerEvent('progress', {
video: self.video video: self.video
}); });
},
seeked: function() {
that.triggerEvent('seeked');
},
seeking: function() {
that.triggerEvent('seeking');
} }
}); });

View file

@ -65,10 +65,25 @@ Ox.VideoPlayer = function(options, self) {
src: getBufferedImageURL() src: getBufferedImageURL()
}) })
//self.$bar.html(Ox.formatDuration(data.video.buffered.end(data.video.buffered.length - 1))) //self.$bar.html(Ox.formatDuration(data.video.buffered.end(data.video.buffered.length - 1)))
} },
seeked: hideLoadingIcon,
seeking: showLoadingIcon
}) })
.appendTo(that); .appendTo(that);
self.$loadingIcon = $('<img>')
.attr({
src: Ox.UI.getImagePath('symbolLoadingAnimated.svg')
})
.css({
position: 'absolute',
left: self.options.width / 2 - 16 + 'px',
top: self.options.height / 2 - 16 + 'px',
width: '32px',
height: '32px'
})
.appendTo(that.$element);
self.$controls = Ox.Bar({ self.$controls = Ox.Bar({
size: self.barHeight size: self.barHeight
}) })
@ -243,6 +258,7 @@ Ox.VideoPlayer = function(options, self) {
Ox.print('!!!!', data.video.width, data.video.height, data.video.videoWidth, data.video.videoHeight) Ox.print('!!!!', data.video.width, data.video.height, data.video.videoWidth, data.video.videoHeight)
self.duration = data.video.duration; self.duration = data.video.duration;
Ox.print('DURATION', Ox.formatDuration(self.duration)); Ox.print('DURATION', Ox.formatDuration(self.duration));
hideLoadingIcon();
that.gainFocus().bindEvent({ that.gainFocus().bindEvent({
key_space: function() { key_space: function() {
self.$playButton.toggleTitle(); self.$playButton.toggleTitle();
@ -294,6 +310,12 @@ Ox.VideoPlayer = function(options, self) {
}, 1000); }, 1000);
} }
function hideLoadingIcon() {
self.$loadingIcon.animate({
opacity: 0
}, 0);
}
function showControls() { function showControls() {
clearTimeout(self.controlsTimeout); clearTimeout(self.controlsTimeout);
self.$controls.animate({ self.$controls.animate({
@ -301,6 +323,11 @@ Ox.VideoPlayer = function(options, self) {
}, 250); }, 250);
} }
function showLoadingIcon() {
self.$loadingIcon.animate({
opacity: 1
}, 0);
}
function toggleMute() { function toggleMute() {
self.$video.toggleMute(); self.$video.toggleMute();
} }