shaka-player 4.7.2 → 4.7.3

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.
@@ -207,6 +207,15 @@ shaka.ads.ClientSideAd = class {
207
207
  }
208
208
  }
209
209
 
210
+ /**
211
+ * It's required for a muted ad to start when autoplaying.
212
+ *
213
+ * @param {number} videoVolume
214
+ */
215
+ setInitialMuted(videoVolume) {
216
+ this.volume_ = videoVolume;
217
+ this.manager_.setVolume(0);
218
+ }
210
219
 
211
220
  /**
212
221
  * @override
@@ -532,9 +532,10 @@ shaka.ads.ClientSideAdManager = class {
532
532
  if (this.ad_.isLinear()) {
533
533
  this.adContainer_.setAttribute('ad-active', 'true');
534
534
  this.video_.pause();
535
- this.ad_.setVolume(this.video_.volume);
536
535
  if (this.video_.muted) {
537
- this.ad_.setMuted(true);
536
+ this.ad_.setInitialMuted(this.video_.volume);
537
+ } else {
538
+ this.ad_.setVolume(this.video_.volume);
538
539
  }
539
540
  }
540
541
  }
@@ -1609,7 +1609,6 @@ shaka.dash.DashParser = class {
1609
1609
  hdr,
1610
1610
  videoLayout: undefined,
1611
1611
  tilesLayout,
1612
- matchedStreams: [],
1613
1612
  accessibilityPurpose,
1614
1613
  external: false,
1615
1614
  fastSwitching: false,
@@ -2237,7 +2237,7 @@ shaka.hls.HlsParser = class {
2237
2237
  stream.keyIds = realStream.keyIds;
2238
2238
  stream.mimeType = realStream.mimeType;
2239
2239
  stream.bandwidth = realStream.bandwidth;
2240
- stream.codecs = realStream.codecs || stream.codecs;
2240
+ stream.codecs = stream.codecs || realStream.codecs;
2241
2241
 
2242
2242
  // Since we lazy-loaded this content, the player may need to create new
2243
2243
  // sessions for the DRM info in this stream.
@@ -3452,6 +3452,13 @@ shaka.hls.HlsParser = class {
3452
3452
  if (this.isLive_() && mediaSequenceToStartTime.has(position)) {
3453
3453
  firstStartTime = mediaSequenceToStartTime.get(position);
3454
3454
  }
3455
+ // This is for recovering from disconnects.
3456
+ if (firstStartTime === 0 &&
3457
+ this.presentationType_ == shaka.hls.HlsParser.PresentationType_.LIVE &&
3458
+ mediaSequenceToStartTime.size > 0 &&
3459
+ !mediaSequenceToStartTime.has(position)) {
3460
+ firstStartTime = this.presentationTimeline_.getSegmentAvailabilityStart();
3461
+ }
3455
3462
 
3456
3463
  /** @type {!Array.<!shaka.media.SegmentReference>} */
3457
3464
  const references = [];
@@ -3766,7 +3773,9 @@ shaka.hls.HlsParser = class {
3766
3773
 
3767
3774
  contentMimeType = response.headers['content-type'];
3768
3775
  } catch (error) {
3769
- if (error && error.code == shaka.util.Error.Code.HTTP_ERROR) {
3776
+ if (error &&
3777
+ (error.code == shaka.util.Error.Code.HTTP_ERROR ||
3778
+ error.code == shaka.util.Error.Code.BAD_HTTP_STATUS)) {
3770
3779
  headRequest.method = 'GET';
3771
3780
  const response = await this.makeNetworkRequest_(
3772
3781
  headRequest, requestType, {type});
@@ -460,9 +460,10 @@ shaka.media.MediaSourceEngine = class {
460
460
  * @param {shaka.util.ManifestParserUtils.ContentType} contentType
461
461
  * @param {shaka.extern.Stream} stream
462
462
  * @param {string} codecs
463
+ * @param {boolean=} forceTransmux
463
464
  * @private
464
465
  */
465
- initSourceBuffer_(contentType, stream, codecs) {
466
+ initSourceBuffer_(contentType, stream, codecs, forceTransmux = false) {
466
467
  const ContentType = shaka.util.ManifestParserUtils.ContentType;
467
468
 
468
469
  goog.asserts.assert(
@@ -474,7 +475,7 @@ shaka.media.MediaSourceEngine = class {
474
475
  if (contentType == ContentType.TEXT) {
475
476
  this.reinitText(mimeType, this.sequenceMode_, stream.external);
476
477
  } else {
477
- let needTransmux = this.config_.forceTransmux;
478
+ let needTransmux = this.config_.forceTransmux || forceTransmux;
478
479
  if (!shaka.media.Capabilities.isTypeSupported(mimeType) ||
479
480
  (!this.sequenceMode_ &&
480
481
  shaka.util.MimeUtils.RAW_FORMATS.includes(mimeType))) {
@@ -491,8 +492,10 @@ shaka.media.MediaSourceEngine = class {
491
492
  ContentType.VIDEO, (codecs || '').split(','));
492
493
  if (audioCodec && videoCodec) {
493
494
  this.needSplitMuxedContent_ = true;
494
- this.initSourceBuffer_(ContentType.AUDIO, stream, audioCodec);
495
- this.initSourceBuffer_(ContentType.VIDEO, stream, videoCodec);
495
+ this.initSourceBuffer_(
496
+ ContentType.AUDIO, stream, audioCodec, /* forceTransmux= */ true);
497
+ this.initSourceBuffer_(
498
+ ContentType.VIDEO, stream, videoCodec, /* forceTransmux= */ true);
496
499
  return;
497
500
  }
498
501
  const transmuxerPlugin =
@@ -1854,7 +1857,8 @@ shaka.media.MediaSourceEngine = class {
1854
1857
  let needTransmux = this.config_.forceTransmux;
1855
1858
  if (!shaka.media.Capabilities.isTypeSupported(newMimeType) ||
1856
1859
  (!this.sequenceMode_ &&
1857
- shaka.util.MimeUtils.RAW_FORMATS.includes(newMimeType))) {
1860
+ shaka.util.MimeUtils.RAW_FORMATS.includes(newMimeType)) ||
1861
+ codecs.includes(',')) {
1858
1862
  needTransmux = true;
1859
1863
  }
1860
1864
  const TransmuxerEngine = shaka.transmuxer.TransmuxerEngine;
@@ -1935,7 +1939,8 @@ shaka.media.MediaSourceEngine = class {
1935
1939
  let needTransmux = this.config_.forceTransmux;
1936
1940
  if (!shaka.media.Capabilities.isTypeSupported(newMimeType) ||
1937
1941
  (!this.sequenceMode_ &&
1938
- shaka.util.MimeUtils.RAW_FORMATS.includes(newMimeType))) {
1942
+ shaka.util.MimeUtils.RAW_FORMATS.includes(newMimeType)) ||
1943
+ stream.codecs.includes(',')) {
1939
1944
  needTransmux = true;
1940
1945
  }
1941
1946
  const newMimeTypeWithAllCodecs =
@@ -37,7 +37,9 @@ shaka.net.NetworkingUtils = class {
37
37
  const response = await netEngine.request(type, request).promise;
38
38
  mimeType = response.headers['content-type'];
39
39
  } catch (error) {
40
- if (error && error.code == shaka.util.Error.Code.HTTP_ERROR) {
40
+ if (error &&
41
+ (error.code == shaka.util.Error.Code.HTTP_ERROR ||
42
+ error.code == shaka.util.Error.Code.BAD_HTTP_STATUS)) {
41
43
  request.method = 'GET';
42
44
  const response = await netEngine.request(type, request).promise;
43
45
  mimeType = response.headers['content-type'];
package/lib/player.js CHANGED
@@ -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.2' + '-uncompiled'; // x-release-please-version
6868
+ shaka.Player.version = 'v4.7.3' + '-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.
@@ -791,3 +791,9 @@ shaka.polyfill.PatchedMediaKeysApple.MediaKeyStatusMap = class {
791
791
  goog.asserts.assert(false, 'Not used! Provided only for the compiler.');
792
792
  }
793
793
  };
794
+
795
+ if (!navigator.requestMediaKeySystemAccess ||
796
+ // eslint-disable-next-line no-restricted-syntax
797
+ !MediaKeySystemAccess.prototype.getConfiguration) {
798
+ shaka.polyfill.register(shaka.polyfill.PatchedMediaKeysApple.install);
799
+ }