Skip to content

Commit

Permalink
Don't force sliders to get evaluated on load
Browse files Browse the repository at this point in the history
Since the load and play progress sliders are guaranteed to start from zero, set that through CSS. Calling Slider.prototype.update forces a re-flow because element dimensions are queried and style rules changed. That reflow consistently took around 60ms on my laptop which would mean dropped frames and "jerkiness" on initialization.
  • Loading branch information
dmlap committed Mar 31, 2014
1 parent efe25c0 commit 8bc861f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
2 changes: 2 additions & 0 deletions src/css/video-js.less
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,8 @@ fonts to show/hide properly.
height: 100%;
margin: 0;
padding: 0;
/* updated by javascript during playback */
width: 0;
/* Needed for IE6 *///
left: 0;
top: 0;
Expand Down
7 changes: 1 addition & 6 deletions src/js/slider.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ vjs.Slider = vjs.Component.extend({
this.bar = this.getChild(this.options_['barName']);
this.handle = this.getChild(this.options_['handleName']);

player.on(this.playerEvent, vjs.bind(this, this.update));

this.on('mousedown', this.onMouseDown);
this.on('touchstart', this.onMouseDown);
this.on('focus', this.onFocus);
Expand All @@ -26,10 +24,7 @@ vjs.Slider = vjs.Component.extend({

this.player_.on('controlsvisible', vjs.bind(this, this.update));

// This is actually to fix the volume handle position. http://twitter.com/#!/gerritvanaaken/status/159046254519787520
// this.player_.one('timeupdate', vjs.bind(this, this.update));

player.ready(vjs.bind(this, this.update));
player.on(this.playerEvent, vjs.bind(this, this.update));

this.boundEvents = {};
}
Expand Down

0 comments on commit 8bc861f

Please sign in to comment.