Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SeekHandle content #902

Merged
merged 2 commits into from Feb 12, 2014
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
22 changes: 17 additions & 5 deletions src/js/control-bar/progress-control.js
Expand Up @@ -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
Expand All @@ -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', {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you could use this.el() in the same way you're using this.content here. Let me know if there was a specific reason for creating a new property in addition to el().

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 = '<span class="vjs-control-text">' + vjs.formatTime(time, this.player_.duration()) + '</span>';
};