shaka-player 4.6.4 → 4.6.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/ui/volume_bar.js CHANGED
@@ -32,6 +32,10 @@ shaka.ui.VolumeBar = class extends shaka.ui.RangeElement {
32
32
  /** @private {!shaka.extern.UIConfiguration} */
33
33
  this.config_ = this.controls.getConfig();
34
34
 
35
+ // We use a range of 100 to avoid problems with Firefox.
36
+ // See https://github.com/shaka-project/shaka-player/issues/3987
37
+ this.setRange(0, 100);
38
+
35
39
  this.eventManager.listen(this.video,
36
40
  'volumechange',
37
41
  () => this.onPresentationVolumeChange_());
@@ -74,9 +78,9 @@ shaka.ui.VolumeBar = class extends shaka.ui.RangeElement {
74
78
  */
75
79
  onChange() {
76
80
  if (this.ad && this.ad.isLinear()) {
77
- this.ad.setVolume(this.getValue());
81
+ this.ad.setVolume(this.getValue() / 100);
78
82
  } else {
79
- this.video.volume = this.getValue();
83
+ this.video.volume = this.getValue() / 100;
80
84
  if (this.video.volume == 0) {
81
85
  this.video.muted = true;
82
86
  } else {
@@ -90,7 +94,7 @@ shaka.ui.VolumeBar = class extends shaka.ui.RangeElement {
90
94
  if (this.video.muted) {
91
95
  this.setValue(0);
92
96
  } else {
93
- this.setValue(this.video.volume);
97
+ this.setValue(this.video.volume * 100);
94
98
  }
95
99
 
96
100
  this.updateColors_();
@@ -102,7 +106,7 @@ shaka.ui.VolumeBar = class extends shaka.ui.RangeElement {
102
106
  'This.ad should exist at this point!');
103
107
 
104
108
  const volume = this.ad.getVolume();
105
- this.setValue(volume);
109
+ this.setValue(volume * 100);
106
110
  this.updateColors_();
107
111
  }
108
112
 
@@ -110,8 +114,8 @@ shaka.ui.VolumeBar = class extends shaka.ui.RangeElement {
110
114
  updateColors_() {
111
115
  const colors = this.config_.volumeBarColors;
112
116
  const gradient = ['to right'];
113
- gradient.push(colors.level + (this.getValue() * 100) + '%');
114
- gradient.push(colors.base + (this.getValue() * 100) + '%');
117
+ gradient.push(colors.level + this.getValue() + '%');
118
+ gradient.push(colors.base + this.getValue() + '%');
115
119
  gradient.push(colors.base + '100%');
116
120
 
117
121
  this.container.style.background =