From b1f9450bb30abbd39214cb29e4f87a54bf6f2388 Mon Sep 17 00:00:00 2001 From: MrAvenger Date: Tue, 17 Dec 2013 15:05:03 +0000 Subject: [PATCH 1/2] SeekHandle content I wanted to use the SeekHandle to show the current time but as far as I could tell it only contained static content, I made this change to allow the content to be updated. Is this its intended purpose or am I playing with something that has another a different job? --- src/js/control-bar/progress-control.js | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/src/js/control-bar/progress-control.js b/src/js/control-bar/progress-control.js index 0dc42cc749..e0cb174f99 100644 --- a/src/js/control-bar/progress-control.js +++ b/src/js/control-bar/progress-control.js @@ -182,7 +182,12 @@ vjs.PlayProgressBar.prototype.createEl = function(){ * @param {Object=} options * @constructor */ -vjs.SeekHandle = vjs.SliderHandle.extend(); +vjs.SeekHandle = vjs.SliderHandle.extend({ + init: function(player, options) { + vjs.SliderHandle.call(this, player, options); + player.on('timeupdate', vjs.bind(this, this.updateContent)); + } +}); /** * The default value for the handle content, which may be read by screen readers @@ -193,8 +198,15 @@ vjs.SeekHandle = vjs.SliderHandle.extend(); vjs.SeekHandle.prototype.defaultValue = '00:00'; /** @inheritDoc */ -vjs.SeekHandle.prototype.createEl = function(){ - return vjs.SliderHandle.prototype.createEl.call(this, 'div', { - className: 'vjs-seek-handle' - }); +vjs.SeekHandle.prototype.createEl = function() { + return this.content = vjs.SliderHandle.prototype.createEl.call(this, 'div', { + className: 'vjs-seek-handle', + }); +}; + +vjs.SeekHandle.prototype.updateContent = function() { + + // Allows for smooth scrubbing, when player can't keep up. + var time = (this.player_.scrubbing) ? this.player_.getCache().currentTime : this.player_.currentTime(); + this.content.innerHTML = '' + vjs.formatTime(time, this.player_.duration()) + ''; }; From ec1bea41a5a674aa4599eec691437c65f763e47a Mon Sep 17 00:00:00 2001 From: MrAvenger Date: Tue, 17 Dec 2013 15:26:56 +0000 Subject: [PATCH 2/2] Update progress-control.js --- src/js/control-bar/progress-control.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/js/control-bar/progress-control.js b/src/js/control-bar/progress-control.js index e0cb174f99..f0fd61e9f4 100644 --- a/src/js/control-bar/progress-control.js +++ b/src/js/control-bar/progress-control.js @@ -200,7 +200,7 @@ vjs.SeekHandle.prototype.defaultValue = '00:00'; /** @inheritDoc */ vjs.SeekHandle.prototype.createEl = function() { return this.content = vjs.SliderHandle.prototype.createEl.call(this, 'div', { - className: 'vjs-seek-handle', + className: 'vjs-seek-handle' }); };