Skip to content

Commit

Permalink
Peg the volume control to 1.0 on init
Browse files Browse the repository at this point in the history
Setup styles so that the volume control initially renders at full volume. This matches browser behavior where volume is available and saves Javascript from having to manually update the volume control on init. After the initial draw, the volume control is updated dynamically the same way it was before.
  • Loading branch information
dmlap committed Mar 31, 2014
1 parent 8bc861f commit d5957da
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/css/video-js.less
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,7 @@ fonts to show/hide properly.
top: 0;
left: 0;
height: 0.5em;
width: 100%;

background: @slider-bar-color
url(@slider-bar-pattern)
Expand All @@ -311,6 +312,10 @@ fonts to show/hide properly.
.vjs-default-skin .vjs-volume-bar .vjs-volume-handle {
width: 0.5em;
height: 0.5em;
/* Assumes volume starts at 1.0. If you change the size of the
handle relative to the volume bar, you'll need to update this value
too. */
left: 90%;
}

.vjs-default-skin .vjs-volume-handle:before {
Expand Down
1 change: 0 additions & 1 deletion src/js/control-bar/volume-control.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ vjs.VolumeBar = vjs.Slider.extend({
vjs.Slider.call(this, player, options);
player.on('volumechange', vjs.bind(this, this.updateARIAAttributes));
player.ready(vjs.bind(this, this.updateARIAAttributes));
setTimeout(vjs.bind(this, this.update), 0); // update when elements is in DOM
}
});

Expand Down

0 comments on commit d5957da

Please sign in to comment.