shaka-player 4.9.4 → 4.9.5

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.
@@ -11,6 +11,19 @@ goog.provide('shaka.media.TimeRangesUtils');
11
11
  * @summary A set of utility functions for dealing with TimeRanges objects.
12
12
  */
13
13
  shaka.media.TimeRangesUtils = class {
14
+ /**
15
+ * Returns whether the buffer is small enough to be ignored.
16
+ *
17
+ * @param {TimeRanges} b
18
+ * @return {boolean}
19
+ * @private
20
+ */
21
+ static isBufferNegligible_(b) {
22
+ // Workaround Safari bug: https://bit.ly/2trx6O8
23
+ // Firefox may leave <1e-4s of data in buffer after clearing all content
24
+ return b.length == 1 && b.end(0) - b.start(0) < 1e-4;
25
+ }
26
+
14
27
  /**
15
28
  * Gets the first timestamp in the buffer.
16
29
  *
@@ -22,8 +35,7 @@ shaka.media.TimeRangesUtils = class {
22
35
  if (!b) {
23
36
  return null;
24
37
  }
25
- // Workaround Safari bug: https://bit.ly/2trx6O8
26
- if (b.length == 1 && b.end(0) - b.start(0) < 1e-6) {
38
+ if (shaka.media.TimeRangesUtils.isBufferNegligible_(b)) {
27
39
  return null;
28
40
  }
29
41
  // Workaround Edge bug: https://bit.ly/2JYLPeB
@@ -45,8 +57,7 @@ shaka.media.TimeRangesUtils = class {
45
57
  if (!b) {
46
58
  return null;
47
59
  }
48
- // Workaround Safari bug: https://bit.ly/2trx6O8
49
- if (b.length == 1 && b.end(0) - b.start(0) < 1e-6) {
60
+ if (shaka.media.TimeRangesUtils.isBufferNegligible_(b)) {
50
61
  return null;
51
62
  }
52
63
  return b.length ? b.end(b.length - 1) : null;
@@ -64,8 +75,7 @@ shaka.media.TimeRangesUtils = class {
64
75
  if (!b || !b.length) {
65
76
  return false;
66
77
  }
67
- // Workaround Safari bug: https://bit.ly/2trx6O8
68
- if (b.length == 1 && b.end(0) - b.start(0) < 1e-6) {
78
+ if (shaka.media.TimeRangesUtils.isBufferNegligible_(b)) {
69
79
  return false;
70
80
  }
71
81
 
@@ -92,8 +102,7 @@ shaka.media.TimeRangesUtils = class {
92
102
  if (!b || !b.length) {
93
103
  return 0;
94
104
  }
95
- // Workaround Safari bug: https://bit.ly/2trx6O8
96
- if (b.length == 1 && b.end(0) - b.start(0) < 1e-6) {
105
+ if (shaka.media.TimeRangesUtils.isBufferNegligible_(b)) {
97
106
  return 0;
98
107
  }
99
108
 
@@ -128,8 +137,7 @@ shaka.media.TimeRangesUtils = class {
128
137
  if (!b || !b.length) {
129
138
  return null;
130
139
  }
131
- // Workaround Safari bug: https://bit.ly/2trx6O8
132
- if (b.length == 1 && b.end(0) - b.start(0) < 1e-6) {
140
+ if (shaka.media.TimeRangesUtils.isBufferNegligible_(b)) {
133
141
  return null;
134
142
  }
135
143
 
package/lib/player.js CHANGED
@@ -1384,6 +1384,10 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
1384
1384
  this.preloadDueAdManagerTimer_.stop();
1385
1385
  }
1386
1386
 
1387
+ if (this.cmcdManager_) {
1388
+ this.cmcdManager_.reset();
1389
+ }
1390
+
1387
1391
  if (this.cmsdManager_) {
1388
1392
  this.cmsdManager_.reset();
1389
1393
  }
@@ -6573,6 +6577,10 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
6573
6577
  // This will reset the "enabled" of other tracks to false.
6574
6578
  track.enabled = true;
6575
6579
 
6580
+ if (!currentTrack) {
6581
+ return;
6582
+ }
6583
+
6576
6584
  // AirPlay does not reset the "enabled" of other tracks to false, so
6577
6585
  // it must be changed by hand.
6578
6586
  if (track.id !== currentTrack.id) {
@@ -7449,7 +7457,7 @@ shaka.Player.TYPICAL_BUFFERING_THRESHOLD_ = 0.5;
7449
7457
  * @export
7450
7458
  */
7451
7459
  // eslint-disable-next-line no-useless-concat
7452
- shaka.Player.version = 'v4.9.4' + '-uncompiled'; // x-release-please-version
7460
+ shaka.Player.version = 'v4.9.5' + '-uncompiled'; // x-release-please-version
7453
7461
 
7454
7462
  // Initialize the deprecation system using the version string we just set
7455
7463
  // on the player.
@@ -63,6 +63,16 @@ shaka.util.CmcdManager = class {
63
63
  this.config_ = config;
64
64
  }
65
65
 
66
+
67
+ /**
68
+ * Resets the CmcdManager.
69
+ */
70
+ reset() {
71
+ this.playbackStarted_ = false;
72
+ this.buffering_ = true;
73
+ this.starved_ = false;
74
+ }
75
+
66
76
  /**
67
77
  * Set the buffering state
68
78
  *
@@ -295,7 +295,7 @@ shaka.util.ManifestParserUtils.AUDIO_CODEC_REGEXPS_ = [
295
295
  /^flac$/, // some manifests wrongfully use this
296
296
  /^mp4a/,
297
297
  /^[ae]c-3$/,
298
- /^ac-4$/,
298
+ /^ac-4/,
299
299
  /^dts[cex]$/, // DTS Digital Surround (dtsc), DTS Express (dtse), DTS:X (dtsx)
300
300
  /^iamf/,
301
301
  ];
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.9.4",
4
+ "version": "4.9.5",
5
5
  "homepage": "https://github.com/shaka-project/shaka-player",
6
6
  "author": "Google",
7
7
  "maintainers": [