shaka-player 4.7.6 → 4.7.7

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.
@@ -542,6 +542,15 @@ shaka.media.DrmEngine = class {
542
542
  }
543
543
  }
544
544
 
545
+ /**
546
+ * Returns true if the manifest has init data.
547
+ *
548
+ * @return {boolean}
549
+ */
550
+ hasManifestInitData() {
551
+ return !!this.manifestInitData_;
552
+ }
553
+
545
554
  /**
546
555
  * Sets the server certificate based on the current DrmInfo.
547
556
  *
@@ -400,6 +400,10 @@ shaka.offline.Storage = class {
400
400
  downloader, config, activeHandle.cell, manifest, drmEngine);
401
401
  this.ensureNotDestroyed_();
402
402
 
403
+ this.setManifestDrmFields_(manifest, manifestDB, drmEngine, config);
404
+ await activeHandle.cell.updateManifest(manifestId, manifestDB);
405
+ this.ensureNotDestroyed_();
406
+
403
407
  const offlineUri = shaka.offline.OfflineUri.manifest(
404
408
  activeHandle.path.mechanism, activeHandle.path.cell, manifestId);
405
409
 
package/lib/player.js CHANGED
@@ -4691,6 +4691,12 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
4691
4691
  shaka.util.Error.Code.CONTENT_NOT_LOADED);
4692
4692
  }
4693
4693
 
4694
+ if (kind != 'subtitles' && kind != 'captions') {
4695
+ shaka.log.alwaysWarn(
4696
+ 'Using a kind value different of `subtitles` or `captions` can ' +
4697
+ 'cause unwanted issues.');
4698
+ }
4699
+
4694
4700
  if (!mimeType) {
4695
4701
  mimeType = await this.getTextMimetype_(uri);
4696
4702
  }
@@ -6494,6 +6500,8 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
6494
6500
  const restrictedStatuses = shaka.Player.restrictedStatuses_;
6495
6501
  let tracksChanged = false;
6496
6502
 
6503
+ goog.asserts.assert(this.drmEngine_, 'drmEngine should be non-null here.');
6504
+
6497
6505
  // Only filter tracks for keys if we have some key statuses to look at.
6498
6506
  if (keyIds.length) {
6499
6507
  for (const variant of this.manifest_.variants) {
@@ -6509,8 +6517,10 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
6509
6517
 
6510
6518
  for (const keyId of stream.keyIds) {
6511
6519
  const keyStatus = keyStatusMap[isGlobalStatus ? '00' : keyId];
6512
- variant.allowedByKeySystem = variant.allowedByKeySystem &&
6513
- !!keyStatus && !restrictedStatuses.includes(keyStatus);
6520
+ if (keyStatus || this.drmEngine_.hasManifestInitData()) {
6521
+ variant.allowedByKeySystem = variant.allowedByKeySystem &&
6522
+ !!keyStatus && !restrictedStatuses.includes(keyStatus);
6523
+ }
6514
6524
  }
6515
6525
  }
6516
6526
 
@@ -6914,7 +6924,7 @@ shaka.Player.TYPICAL_BUFFERING_THRESHOLD_ = 0.5;
6914
6924
  * @export
6915
6925
  */
6916
6926
  // eslint-disable-next-line no-useless-concat
6917
- shaka.Player.version = 'v4.7.6' + '-uncompiled'; // x-release-please-version
6927
+ shaka.Player.version = 'v4.7.7' + '-uncompiled'; // x-release-please-version
6918
6928
 
6919
6929
  // Initialize the deprecation system using the version string we just set
6920
6930
  // on the player.
@@ -141,8 +141,15 @@ shaka.polyfill.MediaCapabilities = class {
141
141
  }
142
142
 
143
143
  if (audioConfig) {
144
- const contentType = audioConfig.contentType;
145
- const isSupported = Capabilities.isTypeSupported(contentType);
144
+ let isSupported;
145
+ if (shaka.util.Platform.isChromecast() &&
146
+ audioConfig.spatialRendering) {
147
+ const extendedType =
148
+ audioConfig.contentType + '; spatialRendering=true';
149
+ isSupported = Capabilities.isTypeSupported(extendedType);
150
+ } else {
151
+ isSupported = Capabilities.isTypeSupported(audioConfig.contentType);
152
+ }
146
153
  if (!isSupported) {
147
154
  return res;
148
155
  }
@@ -446,10 +446,11 @@ shaka.util.TsParser = class {
446
446
  *
447
447
  * @param {shaka.extern.MPEG_PES} pes
448
448
  * @param {?shaka.extern.VideoNalu=} lastNalu
449
+ * @param {?number=} lastState
449
450
  * @return {!Array.<shaka.extern.VideoNalu>}
450
451
  * @export
451
452
  */
452
- parseNalus(pes, lastNalu) {
453
+ parseNalus(pes, lastNalu, lastState) {
453
454
  const timescale = shaka.util.TsParser.Timescale;
454
455
  const time = pes.pts ? pes.pts / timescale : null;
455
456
  const data = pes.data;
@@ -465,7 +466,7 @@ shaka.util.TsParser = class {
465
466
  // precede each NALU. A start code is 2 or 3 0x00 bytes followed with a
466
467
  // 0x01 byte. e.g. 0x000001 or 0x00000001.
467
468
  // More info in: https://stackoverflow.com/questions/24884827/possible-locations-for-sequence-picture-parameter-sets-for-h-264-stream/24890903#24890903
468
- let numZeros = 0;
469
+ let numZeros = lastState || 0;
469
470
 
470
471
  /** @type {!Array.<shaka.extern.VideoNalu>} */
471
472
  const nalus = [];
@@ -490,7 +491,7 @@ shaka.util.TsParser = class {
490
491
  const startCodeSize = numZeros > 3 ? 3 : numZeros;
491
492
  const lastByteToKeep = i - startCodeSize;
492
493
  // Optimization
493
- if (lastByteToKeep != 0) {
494
+ if (lastState && lastByteToKeep != 0) {
494
495
  const prevData = data.subarray(0, lastByteToKeep);
495
496
  lastNalu.data = shaka.util.Uint8ArrayUtils.concat(
496
497
  lastNalu.data, prevData);
@@ -572,6 +573,7 @@ shaka.util.TsParser = class {
572
573
  lastNalu.fullData = shaka.util.Uint8ArrayUtils.concat(
573
574
  lastNalu.fullData, data);
574
575
  }
576
+ lastState = Math.min(3, numZeros);
575
577
  return nalus;
576
578
  }
577
579
 
@@ -676,8 +678,9 @@ shaka.util.TsParser = class {
676
678
  }
677
679
  if (naluProcessing) {
678
680
  let lastNalu;
681
+ let lastState;
679
682
  for (const pes of this.videoPes_) {
680
- pes.nalus = this.parseNalus(pes, lastNalu);
683
+ pes.nalus = this.parseNalus(pes, lastNalu, lastState);
681
684
  if (pes.nalus.length) {
682
685
  lastNalu = pes.nalus[pes.nalus.length - 1];
683
686
  }
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.6",
4
+ "version": "4.7.7",
5
5
  "homepage": "https://github.com/shaka-project/shaka-player",
6
6
  "author": "Google",
7
7
  "maintainers": [
package/ui/externs/ui.js CHANGED
@@ -486,3 +486,27 @@ shaka.extern.IUISeekBar.Factory = class {
486
486
  */
487
487
  create(rootElement, controls) {}
488
488
  };
489
+
490
+ /**
491
+ * @interface
492
+ * @exportDoc
493
+ */
494
+ shaka.extern.IUIPlayButton = class {
495
+ /**
496
+ * @param {!HTMLElement} parent
497
+ * @param {!shaka.ui.Controls} controls
498
+ */
499
+ constructor(parent, controls) {
500
+ /**
501
+ * @protected {!HTMLButtonElement}
502
+ * @exportDoc
503
+ */
504
+ this.button;
505
+ }
506
+
507
+ /** @return {boolean} */
508
+ isPaused() {}
509
+
510
+ /** @return {boolean} */
511
+ isEnded() {}
512
+ };
package/ui/play_button.js CHANGED
@@ -16,6 +16,7 @@ goog.requireType('shaka.ui.Controls');
16
16
 
17
17
  /**
18
18
  * @extends {shaka.ui.Element}
19
+ * @implements {shaka.extern.IUIPlayButton}
19
20
  * @export
20
21
  */
21
22
  shaka.ui.PlayButton = class extends shaka.ui.Element {
@@ -95,6 +96,7 @@ shaka.ui.PlayButton = class extends shaka.ui.Element {
95
96
  /**
96
97
  * @return {boolean}
97
98
  * @protected
99
+ * @override
98
100
  */
99
101
  isPaused() {
100
102
  if (this.ad && this.ad.isLinear()) {
@@ -107,6 +109,7 @@ shaka.ui.PlayButton = class extends shaka.ui.Element {
107
109
  /**
108
110
  * @return {boolean}
109
111
  * @protected
112
+ * @override
110
113
  */
111
114
  isEnded() {
112
115
  if (this.ad && this.ad.isLinear()) {