shaka-player 4.7.0 → 4.7.1

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.
@@ -867,7 +867,7 @@ shaka.media.MediaSourceEngine = class {
867
867
  const calculatedTimestampOffset = reference.startTime - timestamp;
868
868
  const timestampOffsetDifference =
869
869
  Math.abs(timestampOffset - calculatedTimestampOffset);
870
- if ((timestampOffsetDifference >= 0.1 || seeked || adaptation) &&
870
+ if ((timestampOffsetDifference >= 0.001 || seeked || adaptation) &&
871
871
  (!isChunkedData || calculatedTimestampOffset > 0 ||
872
872
  !timestampOffset)) {
873
873
  timestampOffset = calculatedTimestampOffset;
@@ -8,6 +8,7 @@ goog.provide('shaka.net.NetworkingUtils');
8
8
 
9
9
  goog.require('goog.Uri');
10
10
  goog.require('shaka.net.NetworkingEngine');
11
+ goog.require('shaka.util.Error');
11
12
 
12
13
 
13
14
  /**
@@ -30,13 +31,21 @@ shaka.net.NetworkingUtils = class {
30
31
  const type = shaka.net.NetworkingEngine.RequestType.MANIFEST;
31
32
 
32
33
  const request = shaka.net.NetworkingEngine.makeRequest([uri], retryParams);
33
- request.method = 'HEAD';
34
34
 
35
- const response = await netEngine.request(type, request).promise;
35
+ try {
36
+ request.method = 'HEAD';
37
+ const response = await netEngine.request(type, request).promise;
38
+ mimeType = response.headers['content-type'];
39
+ } catch (error) {
40
+ if (error && error.code == shaka.util.Error.Code.HTTP_ERROR) {
41
+ request.method = 'GET';
42
+ const response = await netEngine.request(type, request).promise;
43
+ mimeType = response.headers['content-type'];
44
+ }
45
+ }
36
46
 
37
47
  // https://bit.ly/2K9s9kf says this header should always be available,
38
48
  // but just to be safe:
39
- mimeType = response.headers['content-type'];
40
49
  return mimeType ? mimeType.toLowerCase().split(';').shift() : '';
41
50
  }
42
51
 
package/lib/player.js CHANGED
@@ -4594,7 +4594,7 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
4594
4594
 
4595
4595
  if (this.isLive()) {
4596
4596
  const now = this.getPresentationStartTimeAsDate().valueOf() +
4597
- this.seekRange().end * 1000;
4597
+ element.currentTime * 1000;
4598
4598
  const latency = (Date.now() - now) / 1000;
4599
4599
  this.stats_.setLiveLatency(latency);
4600
4600
  }
@@ -6865,7 +6865,7 @@ shaka.Player.TYPICAL_BUFFERING_THRESHOLD_ = 0.5;
6865
6865
  * @export
6866
6866
  */
6867
6867
  // eslint-disable-next-line no-useless-concat
6868
- shaka.Player.version = 'v4.7.0' + '-uncompiled'; // x-release-please-version
6868
+ shaka.Player.version = 'v4.7.1' + '-uncompiled'; // x-release-please-version
6869
6869
 
6870
6870
  // Initialize the deprecation system using the version string we just set
6871
6871
  // on the player.
@@ -614,9 +614,11 @@ shaka.util.TsParser = class {
614
614
  let sort = false;
615
615
  for (const audioData of this.audioData_) {
616
616
  const pes = this.parsePES_(audioData);
617
- if (pes && pes.pts != null && pes.dts != null) {
618
- if (this.audioPes_.length &&
619
- pes.dts < (this.audioPes_[this.audioPes_.length - 1].dts || 0)) {
617
+ let previousPes = this.audioPes_.length ?
618
+ this.audioPes_[this.audioPes_.length - 1] : null;
619
+ if (pes && pes.pts != null && pes.dts != null && (!previousPes ||
620
+ (previousPes.pts != pes.pts && previousPes.dts != pes.dts))) {
621
+ if (this.audioPes_.length && pes.dts < (previousPes.dts || 0)) {
620
622
  sort = true;
621
623
  }
622
624
  this.audioPes_.push(pes);
@@ -625,7 +627,7 @@ shaka.util.TsParser = class {
625
627
  if (!data) {
626
628
  continue;
627
629
  }
628
- const previousPes = this.audioPes_.pop();
630
+ previousPes = this.audioPes_.pop();
629
631
  previousPes.data =
630
632
  shaka.util.Uint8ArrayUtils.concat(previousPes.data, data);
631
633
  this.audioPes_.push(previousPes);
@@ -654,9 +656,11 @@ shaka.util.TsParser = class {
654
656
  let sort = false;
655
657
  for (const videoData of this.videoData_) {
656
658
  const pes = this.parsePES_(videoData);
657
- if (pes && pes.pts != null && pes.dts != null) {
658
- if (this.videoPes_.length &&
659
- pes.dts < (this.videoPes_[this.videoPes_.length - 1].dts || 0)) {
659
+ let previousPes = this.videoPes_.length ?
660
+ this.videoPes_[this.videoPes_.length - 1] : null;
661
+ if (pes && pes.pts != null && pes.dts != null && (!previousPes ||
662
+ (previousPes.pts != pes.pts && previousPes.dts != pes.dts))) {
663
+ if (this.videoPes_.length && pes.dts < (previousPes.dts || 0)) {
660
664
  sort = true;
661
665
  }
662
666
  this.videoPes_.push(pes);
@@ -665,7 +669,7 @@ shaka.util.TsParser = class {
665
669
  if (!data) {
666
670
  continue;
667
671
  }
668
- const previousPes = this.videoPes_.pop();
672
+ previousPes = this.videoPes_.pop();
669
673
  previousPes.data =
670
674
  shaka.util.Uint8ArrayUtils.concat(previousPes.data, data);
671
675
  this.videoPes_.push(previousPes);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "shaka-player",
3
3
  "description": "DASH/EME video player library",
4
- "version": "4.7.0",
4
+ "version": "4.7.1",
5
5
  "homepage": "https://github.com/shaka-project/shaka-player",
6
6
  "author": "Google",
7
7
  "maintainers": [
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 =