video.js icon indicating copy to clipboard operation
video.js copied to clipboard

Reset volume icon to reflect that muted(true) and vol = 0 are not the same

Open marguinbc opened this issue 9 years ago • 1 comments

Description

Currently, the same icon is used for muted(true) and volume = 0. However, it is possible for volume to be 0 without the player being muted, for example by sliding the volume slider to 0. This changes the icon to the muted icon. Toggling the muted icon then does nothing because the player is not muted, it just has a volume level of 0. The only way to remove the muted icon is to move the volume slider to set a new volume level.

If we want to fix this, we would need to keep track of whether we muted the player by toggling the mute-toggle, via the muted attribute, or by moving the volume to 0 using the slider.

An easier solution would be to redefine the ranges for the volume icons so that:

  • muted(true): vjs-icon-volume-muted = vjs-vol-0
  • vol 0: vjs-icon-volume-low = vjs-vol-1
  • vol >0 && <= .5: vjs-icon-volume-mid = vjs-vol-2
  • vol > .5: vjs-icon-volume-high = vjs-vol-3

Visually this also makes sense because:

  • vjs-icon-volume-muted has a slash through it representing muted
  • vjs-icon-volume-low has no slash and the speaker icon with no arcs/sound waves
  • vjs-icon-volume-mid has one arc/sound ring which can visually be interpreted as half
  • vjs-icon-volume-high has two arcs/sound rings which can visually be interpreted as half

Steps to reproduce

Explain in detail the exact steps necessary to reproduce the issue.

  1. Mute the player. Note that player.muted() returns true, player.volume() should return whatever the volume is/was prior to muting - which initially should be 1 2.Un-mute the player tapping the mute-toggle button. Note that player.muted() returns false, player.volume() should return the same as before
  2. Click and drag the volume slider to 0. Note that player.muted() is false and player.volume() returns 0 but the icon is the same as muted() true
  3. Try and restore the volume by tapping the mute-toggle button. Nothing happens. The volume remains 0 and the icon remains crossed out.
  4. Click and drag anywhere on the volume slider and note that the volume will change, removing the muted icon

Results

Expected

Sliding the volume slider to 0 sets the volume to 0 without setting muted(true) or showing the muted icon. When the muted-toggle button appears muted, tapping it should un-muted and restore the original volume level.

Actual

Sliding the volume slider to 0 sets the volume to 0 sets the mute-toggle button icon to muted but does not mute the player. Tapping the mute-toggle button to try and un-mute does not work. Only sliding the volume slider removes the muted icon state and restores the volume.

Error output

None.

Additional Information

Please include any additional information necessary here. Including the following:

versions

5.x and 6.x

videojs

All / Current

browsers

All browsers that show the volumeMenuButton

OSes

All OSes where the browsers can show the volumeMenuButton

plugins

No plugins

A potential risk of changing this behavior exists if developers are using the vjs-icon-volume-* classes or vjs-vol-# classes to determine volume levels. This risk should be low as they should be using player.volume() to obtain the result programmatically.

marguinbc avatar Jun 20 '17 13:06 marguinbc

Fixed by #4425.

gkatsev avatar Aug 11 '17 21:08 gkatsev