shaka-player 4.8.11 → 4.8.13

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,5 +11,5 @@
11
11
  */
12
12
 
13
13
 
14
- /** @type {boolean} */
14
+ /** @type {string} */
15
15
  window.shakaMediaKeysPolyfill;
@@ -268,7 +268,8 @@ shaka.abr.SimpleAbrManager = class {
268
268
 
269
269
  if (currentBandwidth >= minBandwidth &&
270
270
  currentBandwidth <= maxBandwidth &&
271
- chosen.bandwidth != item.bandwidth) {
271
+ (chosen.bandwidth != item.bandwidth ||
272
+ this.isSameBandwidthAndHigherResolution_(chosen, item))) {
272
273
  chosen = item;
273
274
  }
274
275
  }
@@ -532,6 +533,23 @@ shaka.abr.SimpleAbrManager = class {
532
533
  return v1.width - v2.width;
533
534
  });
534
535
  }
536
+
537
+ /**
538
+ * @param {shaka.extern.Variant} chosenVariant
539
+ * @param {shaka.extern.Variant} newVariant
540
+ * @return {boolean}
541
+ * @private
542
+ */
543
+ isSameBandwidthAndHigherResolution_(chosenVariant, newVariant) {
544
+ if (chosenVariant.bandwidth != newVariant.bandwidth) {
545
+ return false;
546
+ }
547
+ if (!chosenVariant.video || !newVariant.video) {
548
+ return false;
549
+ }
550
+ return chosenVariant.video.width < newVariant.video.width ||
551
+ chosenVariant.video.height < newVariant.video.height;
552
+ }
535
553
  };
536
554
 
537
555
 
@@ -486,7 +486,7 @@ shaka.hls.HlsParser = class {
486
486
  mediaSequenceNumber);
487
487
  stream.segmentIndex.evict(playlistStartTime);
488
488
  }
489
- const oldSegment = segments[0];
489
+ const oldSegment = stream.segmentIndex.earliestReference();
490
490
  goog.asserts.assert(oldSegment, 'Should have segments!');
491
491
 
492
492
  streamInfo.minTimestamp = oldSegment.startTime;
@@ -4224,7 +4224,7 @@ shaka.hls.HlsParser = class {
4224
4224
  }
4225
4225
 
4226
4226
  const uri = drmTag.getRequiredAttrValue('URI');
4227
- const parsedData = shaka.net.DataUriPlugin.parseRaw(uri);
4227
+ const parsedData = shaka.net.DataUriPlugin.parseRaw(uri.split('?')[0]);
4228
4228
 
4229
4229
  // The data encoded in the URI is a PSSH box to be used as init data.
4230
4230
  const pssh = shaka.util.BufferUtils.toUint8(parsedData.data);
@@ -4267,7 +4267,7 @@ shaka.hls.HlsParser = class {
4267
4267
  }
4268
4268
 
4269
4269
  const uri = drmTag.getRequiredAttrValue('URI');
4270
- const parsedData = shaka.net.DataUriPlugin.parseRaw(uri);
4270
+ const parsedData = shaka.net.DataUriPlugin.parseRaw(uri.split('?')[0]);
4271
4271
 
4272
4272
  // The data encoded in the URI is a PlayReady Pro Object, so we need
4273
4273
  // convert it to pssh.
@@ -177,12 +177,18 @@ shaka.media.DrmEngine = class {
177
177
 
178
178
  // |video_| will be |null| if we never attached to a video element.
179
179
  if (this.video_) {
180
- goog.asserts.assert(!this.video_.src, 'video src must be removed first!');
180
+ // Webkit EME implementation requires the src to be defined to clear
181
+ // the MediaKeys.
182
+ if (!shaka.util.Platform.isMediaKeysPolyfilled('webkit')) {
183
+ goog.asserts.assert(!this.video_.src,
184
+ 'video src must be removed first!');
185
+ }
181
186
 
182
187
  try {
183
188
  await this.video_.setMediaKeys(null);
184
189
  } catch (error) {
185
190
  // Ignore any failures while removing media keys from the video element.
191
+ shaka.log.debug(`DrmEngine.destroyNow_ exception`, error);
186
192
  }
187
193
 
188
194
  this.video_ = null;
@@ -316,7 +316,7 @@ shaka.media.MediaSourceEngine = class {
316
316
  'audio/mp4; codecs="mp4a.40.2"',
317
317
  'audio/mp4; codecs="ac-3"',
318
318
  'audio/mp4; codecs="ec-3"',
319
- 'audio/mp4; codecs="ac-4"',
319
+ 'audio/mp4; codecs="ac-4.02.01.01"',
320
320
  'audio/mp4; codecs="opus"',
321
321
  'audio/mp4; codecs="flac"',
322
322
  'audio/mp4; codecs="dtsc"', // DTS Digital Surround
@@ -98,7 +98,7 @@ shaka.media.PresentationTimeline = class {
98
98
  this.startTimeLocked_ = false;
99
99
 
100
100
  /** @private {?number} */
101
- this.initialProgramDateTime_ = null;
101
+ this.initialProgramDateTime_ = presentationStartTime;
102
102
  }
103
103
 
104
104
 
package/lib/player.js CHANGED
@@ -828,21 +828,6 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
828
828
  */
829
829
  setupLcevc_(config) {
830
830
  if (config.lcevc.enabled) {
831
- const tracks = this.getVariantTracks();
832
- if (tracks && tracks[0] && tracks[0].videoMimeType == 'video/mp2t') {
833
- const edge = shaka.util.Platform.isEdge() ||
834
- shaka.util.Platform.isLegacyEdge();
835
- if (edge) {
836
- if (!config.mediaSource.forceTransmux) {
837
- // If forceTransmux is disabled for Microsoft Edge, LCEVC data
838
- // is stripped out in case of a MPEG-2 TS container.
839
- // Hence the warning for Microsoft Edge when playing content with
840
- // MPEG-2 TS container.
841
- shaka.log.alwaysWarn('LCEVC Warning: For MPEG-2 TS decoding '+
842
- 'the config.mediaSource.forceTransmux must be enabled.');
843
- }
844
- }
845
- }
846
831
  this.closeLcevcDec_();
847
832
  this.createLcevcDec_(config.lcevc);
848
833
  } else {
@@ -1289,6 +1274,13 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
1289
1274
  this.playhead_ = null;
1290
1275
  }
1291
1276
 
1277
+ // EME v0.1b requires the media element to clear the MediaKeys
1278
+ if (shaka.util.Platform.isMediaKeysPolyfilled('webkit') &&
1279
+ this.drmEngine_) {
1280
+ await this.drmEngine_.destroy();
1281
+ this.drmEngine_ = null;
1282
+ }
1283
+
1292
1284
  // Media source engine holds onto the media element, and in order to
1293
1285
  // detach the media keys (with drm engine), we need to break the
1294
1286
  // connection between media source engine and the media element.
@@ -7248,7 +7240,7 @@ shaka.Player.TYPICAL_BUFFERING_THRESHOLD_ = 0.5;
7248
7240
  * @export
7249
7241
  */
7250
7242
  // eslint-disable-next-line no-useless-concat
7251
- shaka.Player.version = 'v4.8.11' + '-uncompiled'; // x-release-please-version
7243
+ shaka.Player.version = 'v4.8.13' + '-uncompiled'; // x-release-please-version
7252
7244
 
7253
7245
  // Initialize the deprecation system using the version string we just set
7254
7246
  // on the player.
@@ -76,7 +76,7 @@ shaka.polyfill.PatchedMediaKeysApple = class {
76
76
  navigator.requestMediaKeySystemAccess =
77
77
  PatchedMediaKeysApple.requestMediaKeySystemAccess;
78
78
 
79
- window.shakaMediaKeysPolyfill = true;
79
+ window.shakaMediaKeysPolyfill = PatchedMediaKeysApple.apiName_;
80
80
  }
81
81
 
82
82
  /**
@@ -115,7 +115,7 @@ shaka.polyfill.PatchedMediaKeysApple = class {
115
115
  PatchedMediaKeysApple.originalNavigatorRequestMediaKeySystemAccess = null;
116
116
  PatchedMediaKeysApple.originalHTMLMediaElementPrototypeMediaKeys = null;
117
117
 
118
- window.shakaMediaKeysPolyfill = false;
118
+ window.shakaMediaKeysPolyfill = '';
119
119
  }
120
120
 
121
121
  /**
@@ -791,3 +791,10 @@ shaka.polyfill.PatchedMediaKeysApple.MediaKeyStatusMap = class {
791
791
  goog.asserts.assert(false, 'Not used! Provided only for the compiler.');
792
792
  }
793
793
  };
794
+
795
+ /**
796
+ * API name.
797
+ *
798
+ * @private {string}
799
+ */
800
+ shaka.polyfill.PatchedMediaKeysApple.apiName_ = 'apple';
@@ -50,7 +50,7 @@ shaka.polyfill.PatchedMediaKeysNop = class {
50
50
  window.MediaKeys = PatchedMediaKeysNop.MediaKeys;
51
51
  window.MediaKeySystemAccess = PatchedMediaKeysNop.MediaKeySystemAccess;
52
52
 
53
- window.shakaMediaKeysPolyfill = true;
53
+ window.shakaMediaKeysPolyfill = PatchedMediaKeysNop.apiName_;
54
54
  }
55
55
 
56
56
  /**
@@ -136,6 +136,13 @@ shaka.polyfill.PatchedMediaKeysNop.MediaKeySystemAccess = class {
136
136
  createMediaKeys() {}
137
137
  };
138
138
 
139
+ /**
140
+ * API name.
141
+ *
142
+ * @private {string}
143
+ */
144
+ shaka.polyfill.PatchedMediaKeysNop.apiName_ = 'nop';
145
+
139
146
 
140
147
  // A low priority ensures this is the last and acts as a fallback.
141
148
  shaka.polyfill.register(shaka.polyfill.PatchedMediaKeysNop.install, -10);
@@ -73,7 +73,7 @@ shaka.polyfill.PatchedMediaKeysWebkit = class {
73
73
  window.MediaKeys = PatchedMediaKeysWebkit.MediaKeys;
74
74
  window.MediaKeySystemAccess = PatchedMediaKeysWebkit.MediaKeySystemAccess;
75
75
 
76
- window.shakaMediaKeysPolyfill = true;
76
+ window.shakaMediaKeysPolyfill = PatchedMediaKeysWebkit.apiName_;
77
77
  }
78
78
 
79
79
  /**
@@ -860,7 +860,9 @@ class extends shaka.util.FakeEventTarget {
860
860
  PatchedMediaKeysWebkit.prefixApi_('cancelKeyRequest');
861
861
  try {
862
862
  this.media_[cancelKeyRequestName](this.keySystem_, this.sessionId);
863
- } catch (exception) {}
863
+ } catch (exception) {
864
+ shaka.log.debug(`${cancelKeyRequestName} exception`, exception);
865
+ }
864
866
  }
865
867
 
866
868
  // Resolve the 'closed' promise and return it.
@@ -977,4 +979,12 @@ shaka.polyfill.PatchedMediaKeysWebkit.MediaKeyStatusMap = class {
977
979
  shaka.polyfill.PatchedMediaKeysWebkit.prefix_ = '';
978
980
 
979
981
 
982
+ /**
983
+ * API name.
984
+ *
985
+ * @private {string}
986
+ */
987
+ shaka.polyfill.PatchedMediaKeysWebkit.apiName_ = 'webkit';
988
+
989
+
980
990
  shaka.polyfill.register(shaka.polyfill.PatchedMediaKeysWebkit.install);
@@ -644,16 +644,17 @@ shaka.util.Platform = class {
644
644
  /**
645
645
  * Returns true if MediaKeys is polyfilled
646
646
  *
647
+ * @param {string=} polyfillType
647
648
  * @return {boolean}
648
649
  */
649
- static isMediaKeysPolyfilled() {
650
- if (window.shakaMediaKeysPolyfill) {
651
- return true;
650
+ static isMediaKeysPolyfilled(polyfillType) {
651
+ if (polyfillType) {
652
+ return polyfillType === window.shakaMediaKeysPolyfill;
652
653
  }
653
-
654
- return false;
654
+ return !!window.shakaMediaKeysPolyfill;
655
655
  }
656
656
 
657
+
657
658
  /**
658
659
  * Detect the maximum resolution that the platform's hardware can handle.
659
660
  *
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.8.11",
4
+ "version": "4.8.13",
5
5
  "homepage": "https://github.com/shaka-project/shaka-player",
6
6
  "author": "Google",
7
7
  "maintainers": [