shaka-player 4.10.20 → 4.10.21

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.
@@ -384,8 +384,6 @@ shaka.media.PreloadManager = class extends shaka.util.FakeEventTarget {
384
384
  await this.parseManifestInner_();
385
385
  this.throwIfDestroyed_();
386
386
 
387
- this.manifestPromise_.resolve();
388
-
389
387
  await this.initializeDrmInner_();
390
388
  this.throwIfDestroyed_();
391
389
 
@@ -495,10 +493,15 @@ shaka.media.PreloadManager = class extends shaka.util.FakeEventTarget {
495
493
  this.assetUri_, this.manifestPlayerInterface_);
496
494
  }
497
495
 
496
+ this.manifestPromise_.resolve();
497
+
498
498
  // This event is fired after the manifest is parsed, but before any
499
499
  // filtering takes place.
500
500
  const event =
501
501
  this.makeEvent_(shaka.util.FakeEvent.EventName.ManifestParsed);
502
+ // Delay event to ensure manifest has been properly propagated
503
+ // to the player.
504
+ await Promise.resolve();
502
505
  this.dispatchEvent(event);
503
506
 
504
507
  // We require all manifests to have at least one variant.
@@ -1902,8 +1902,12 @@ shaka.media.StreamingEngine = class {
1902
1902
  });
1903
1903
 
1904
1904
  if (!waitingForAnotherStreamToRecover) {
1905
+ const maxDisabledTime = this.getDisabledTime_(error);
1906
+ if (maxDisabledTime) {
1907
+ shaka.log.debug(logPrefix, 'Disabling stream due to quota', error);
1908
+ }
1905
1909
  const handled = this.playerInterface_.disableStream(
1906
- mediaState.stream, this.config_.maxDisabledTime);
1910
+ mediaState.stream, maxDisabledTime);
1907
1911
  if (handled) {
1908
1912
  return;
1909
1913
  }
@@ -2824,18 +2828,26 @@ shaka.media.StreamingEngine = class {
2824
2828
  * @private
2825
2829
  */
2826
2830
  async handleStreamingError_(mediaState, error) {
2831
+ const logPrefix = shaka.media.StreamingEngine.logPrefix_(mediaState);
2832
+
2827
2833
  // If we invoke the callback right away, the application could trigger a
2828
2834
  // rapid retry cycle that could be very unkind to the server. Instead,
2829
2835
  // use the backoff system to delay and backoff the error handling.
2830
2836
  await this.failureCallbackBackoff_.attempt();
2831
2837
  this.destroyer_.ensureNotDestroyed();
2832
- // Try to recover from network errors
2833
- if (error.category === shaka.util.Error.Category.NETWORK) {
2838
+
2839
+ // Try to recover from network errors, but not timeouts.
2840
+ // See https://github.com/shaka-project/shaka-player/issues/7368
2841
+ if (error.category === shaka.util.Error.Category.NETWORK &&
2842
+ error.code != shaka.util.Error.Code.TIMEOUT) {
2834
2843
  if (mediaState.restoreStreamAfterTrickPlay) {
2835
2844
  this.setTrickPlay(/* on= */ false);
2836
2845
  return;
2837
2846
  }
2838
2847
  const maxDisabledTime = this.getDisabledTime_(error);
2848
+ if (maxDisabledTime) {
2849
+ shaka.log.debug(logPrefix, 'Disabling stream due to error', error);
2850
+ }
2839
2851
  error.handled = this.playerInterface_.disableStream(
2840
2852
  mediaState.stream, maxDisabledTime);
2841
2853
 
@@ -2860,6 +2872,7 @@ shaka.media.StreamingEngine = class {
2860
2872
 
2861
2873
  /**
2862
2874
  * @param {!shaka.util.Error} error
2875
+ * @return {number}
2863
2876
  * @private
2864
2877
  */
2865
2878
  getDisabledTime_(error) {
package/lib/player.js CHANGED
@@ -1660,14 +1660,13 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
1660
1660
  // Wait for the manifest to be parsed.
1661
1661
  await mutexWrapOperation(async () => {
1662
1662
  await preloadManager.waitForManifest();
1663
+ // Retrieve the manifest. This is specifically put before the media
1664
+ // source engine is initialized, for the benefit of event handlers.
1665
+ this.parserFactory_ = preloadManager.getParserFactory();
1666
+ this.parser_ = preloadManager.receiveParser();
1667
+ this.manifest_ = preloadManager.getManifest();
1663
1668
  }, 'waitForFinish');
1664
1669
 
1665
- // Retrieve the manifest. This is specifically put before the media
1666
- // source engine is initialized, for the benefit of event handlers.
1667
- this.parserFactory_ = preloadManager.getParserFactory();
1668
- this.parser_ = preloadManager.receiveParser();
1669
- this.manifest_ = preloadManager.getManifest();
1670
-
1671
1670
  if (!this.mediaSourceEngine_) {
1672
1671
  await mutexWrapOperation(async () => {
1673
1672
  await this.initializeMediaSourceEngineInner_();
@@ -7860,7 +7859,7 @@ shaka.Player.TYPICAL_BUFFERING_THRESHOLD_ = 0.5;
7860
7859
  * @export
7861
7860
  */
7862
7861
  // eslint-disable-next-line no-useless-concat, max-len
7863
- shaka.Player.version = 'v4.10.20' + '-uncompiled'; // x-release-please-version
7862
+ shaka.Player.version = 'v4.10.21' + '-uncompiled'; // x-release-please-version
7864
7863
 
7865
7864
  // Initialize the deprecation system using the version string we just set
7866
7865
  // on the player.
@@ -10,6 +10,7 @@ goog.require('shaka.log');
10
10
  goog.require('shaka.media.Capabilities');
11
11
  goog.require('shaka.polyfill');
12
12
  goog.require('shaka.util.DrmUtils');
13
+ goog.require('shaka.util.MimeUtils');
13
14
  goog.require('shaka.util.Platform');
14
15
 
15
16
 
@@ -222,6 +223,7 @@ shaka.polyfill.MediaCapabilities = class {
222
223
  * @private
223
224
  */
224
225
  static async checkDrmSupport_(videoConfig, audioConfig, mcapKeySystemConfig) {
226
+ const MimeUtils = shaka.util.MimeUtils;
225
227
  const audioCapabilities = [];
226
228
  const videoCapabilities = [];
227
229
 
@@ -277,8 +279,12 @@ shaka.polyfill.MediaCapabilities = class {
277
279
  mediaKeySystemConfig.videoCapabilities = videoCapabilities;
278
280
  }
279
281
 
280
- const videoCodec = videoConfig ? videoConfig.contentType : '';
281
- const audioCodec = audioConfig ? audioConfig.contentType : '';
282
+ const videoMimeType = videoConfig ? videoConfig.contentType : '';
283
+ const audioMimeType = audioConfig ? audioConfig.contentType : '';
284
+ const videoCodec = MimeUtils.getBasicType(videoMimeType) + ';' +
285
+ MimeUtils.getCodecBase(videoMimeType);
286
+ const audioCodec = MimeUtils.getBasicType(audioMimeType) + ';' +
287
+ MimeUtils.getCodecBase(audioMimeType);
282
288
  const keySystem = mcapKeySystemConfig.keySystem;
283
289
 
284
290
  /** @type {MediaKeySystemAccess} */
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.10.20",
4
+ "version": "4.10.21",
5
5
  "homepage": "https://github.com/shaka-project/shaka-player",
6
6
  "author": "Google",
7
7
  "maintainers": [