shaka-player 4.8.8 → 4.8.10

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.
@@ -642,6 +642,15 @@ shaka.cea.Cea608DataChannel = class {
642
642
  // b1 -> |P|0|0|1|X|X|X|X|
643
643
  return (b1 & 0x70) === 0x10;
644
644
  }
645
+
646
+ /**
647
+ * Checks if the data contains a XDS control code.
648
+ * @param {number} b1 Byte 1.
649
+ * @return {boolean}
650
+ */
651
+ static isXdsControlCode(b1) {
652
+ return b1 >= 0x01 && b1 <= 0x0F;
653
+ }
645
654
  };
646
655
 
647
656
  /**
@@ -307,16 +307,20 @@ shaka.cea.CeaDecoder = class {
307
307
  ccPacket.ccData1 &= 0x7f;
308
308
  ccPacket.ccData2 &= 0x7f;
309
309
 
310
+ // Ignore XDS
311
+ if (shaka.cea.Cea608DataChannel.isXdsControlCode(ccPacket.ccData1)) {
312
+ return null;
313
+ }
314
+
310
315
  // Check for empty captions and skip them.
311
316
  if (!ccPacket.ccData1 && !ccPacket.ccData2) {
312
317
  return null;
313
318
  }
314
319
 
315
- this.streams_.add(selectedMode);
316
-
317
320
  // Process the clean CC data pair.
318
321
  let parsedClosedCaption = null;
319
322
  if (shaka.cea.Cea608DataChannel.isControlCode(ccPacket.ccData1)) {
323
+ this.streams_.add(selectedMode);
320
324
  parsedClosedCaption = selectedStream.handleControlCode(ccPacket);
321
325
  } else {
322
326
  // Handle as a Basic North American Character.
@@ -41,27 +41,23 @@ shaka.media.ManifestFilterer = class {
41
41
  }
42
42
 
43
43
  /**
44
- * Filters a manifest, removing unplayable streams/variants.
44
+ * Filters a manifest, removing unplayable streams/variants and choosing
45
+ * the codecs.
45
46
  *
46
47
  * @param {?shaka.extern.Manifest} manifest
47
48
  * @return {!Promise.<boolean>} tracksChanged
48
49
  */
49
50
  async filterManifest(manifest) {
50
- await this.filterManifestWithStreamUtils_(manifest);
51
- return this.filterManifestWithRestrictions(manifest);
52
- }
53
-
54
- /**
55
- * Filters a manifest, removing unplayable streams/variants.
56
- *
57
- * @param {?shaka.extern.Manifest} manifest
58
- * @private
59
- */
60
- async filterManifestWithStreamUtils_(manifest) {
61
51
  goog.asserts.assert(manifest, 'Manifest should exist!');
62
52
  await shaka.util.StreamUtils.filterManifest(this.drmEngine_, manifest,
63
53
  this.config_.drm.preferredKeySystems);
54
+ shaka.util.StreamUtils.chooseCodecsAndFilterManifest(
55
+ manifest,
56
+ this.config_.preferredVideoCodecs,
57
+ this.config_.preferredAudioCodecs,
58
+ this.config_.preferredDecodingAttributes);
64
59
  this.checkPlayableVariants_(manifest);
60
+ return this.filterManifestWithRestrictions(manifest);
65
61
  }
66
62
 
67
63
 
@@ -553,7 +553,9 @@ shaka.media.PreloadManager = class extends shaka.util.FakeEventTarget {
553
553
 
554
554
  const tracksChangedInitial = this.manifestFilterer_.applyRestrictions(
555
555
  this.manifest_);
556
- if (tracksChangedInitial) {
556
+ const tracksChangedBefore = await this.manifestFilterer_.filterManifest(
557
+ this.manifest_);
558
+ if (tracksChangedInitial || tracksChangedBefore) {
557
559
  const event = this.makeEvent_(
558
560
  shaka.util.FakeEvent.EventName.TracksChanged);
559
561
  await Promise.resolve();
@@ -568,7 +570,6 @@ shaka.media.PreloadManager = class extends shaka.util.FakeEventTarget {
568
570
 
569
571
  // Now that we have drm information, filter the manifest (again) so that
570
572
  // we can ensure we only use variants with the selected key system.
571
- // const tracksChanged =
572
573
  const tracksChangedAfter = await this.manifestFilterer_.filterManifest(
573
574
  this.manifest_);
574
575
  if (tracksChangedAfter) {
@@ -630,14 +631,6 @@ shaka.media.PreloadManager = class extends shaka.util.FakeEventTarget {
630
631
  this.config_.preferredVideoLabel,
631
632
  this.config_.mediaSource.codecSwitchingStrategy,
632
633
  this.config_.manifest.dash.enableAudioGroups);
633
-
634
- // If the content is multi-codec and the browser can play more than one of
635
- // them, choose codecs now before we initialize streaming.
636
- shaka.util.StreamUtils.chooseCodecsAndFilterManifest(
637
- this.manifest_,
638
- this.config_.preferredVideoCodecs,
639
- this.config_.preferredAudioCodecs,
640
- this.config_.preferredDecodingAttributes);
641
634
  }
642
635
 
643
636
  // Make the ABR manager.
@@ -146,6 +146,19 @@ shaka.net.NetworkingEngine = class extends shaka.util.FakeEventTarget {
146
146
  delete shaka.net.NetworkingEngine.schemes_[scheme];
147
147
  }
148
148
 
149
+ /**
150
+ * Copies all of the filters from this networking engine into another.
151
+ * @param {!shaka.net.NetworkingEngine} other
152
+ */
153
+ copyFiltersInto(other) {
154
+ for (const filter of this.requestFilters_) {
155
+ other.requestFilters_.add(filter);
156
+ }
157
+ for (const filter of this.responseFilters_) {
158
+ other.responseFilters_.add(filter);
159
+ }
160
+ }
161
+
149
162
  /**
150
163
  * Registers a new request filter. All filters are applied in the order they
151
164
  * are registered.
package/lib/player.js CHANGED
@@ -1968,6 +1968,7 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
1968
1968
  // Sadly, as the network engine creation code must be replaceable by tests,
1969
1969
  // it cannot be made and use the utilities defined in this function.
1970
1970
  const networkingEngine = this.createNetworkingEngine(getPreloadManager);
1971
+ this.networkingEngine_.copyFiltersInto(networkingEngine);
1971
1972
 
1972
1973
  /** @return {!shaka.media.DrmEngine} */
1973
1974
  const createDrmEngine = () => {
@@ -2265,7 +2266,7 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
2265
2266
  const setupPlayhead = (startTime) => {
2266
2267
  this.playhead_ = this.createPlayhead(startTime);
2267
2268
  this.playheadObservers_ =
2268
- this.createPlayheadObserversForMSE_(startTimeOfLoad);
2269
+ this.createPlayheadObserversForMSE_(startTime);
2269
2270
 
2270
2271
  // We need to start the buffer management code near the end because it
2271
2272
  // will set the initial buffering state and that depends on other
@@ -3080,16 +3081,16 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
3080
3081
  * Create the observers for MSE playback. These observers are responsible for
3081
3082
  * notifying the app and player of specific events during MSE playback.
3082
3083
  *
3083
- * @param {number} startTimeOfLoad
3084
+ * @param {number} startTime
3084
3085
  * @return {!shaka.media.PlayheadObserverManager}
3085
3086
  * @private
3086
3087
  */
3087
- createPlayheadObserversForMSE_(startTimeOfLoad) {
3088
+ createPlayheadObserversForMSE_(startTime) {
3088
3089
  goog.asserts.assert(this.manifest_, 'Must have manifest');
3089
3090
  goog.asserts.assert(this.regionTimeline_, 'Must have region timeline');
3090
3091
  goog.asserts.assert(this.video_, 'Must have video element');
3091
3092
 
3092
- const startsPastZero = this.isLive() || startTimeOfLoad > 0;
3093
+ const startsPastZero = this.isLive() || startTime > 0;
3093
3094
 
3094
3095
  // Create the region observer. This will allow us to notify the app when we
3095
3096
  // move in and out of timeline regions.
@@ -7239,7 +7240,7 @@ shaka.Player.TYPICAL_BUFFERING_THRESHOLD_ = 0.5;
7239
7240
  * @export
7240
7241
  */
7241
7242
  // eslint-disable-next-line no-useless-concat
7242
- shaka.Player.version = 'v4.8.8' + '-uncompiled'; // x-release-please-version
7243
+ shaka.Player.version = 'v4.8.10' + '-uncompiled'; // x-release-please-version
7243
7244
 
7244
7245
  // Initialize the deprecation system using the version string we just set
7245
7246
  // on the player.
@@ -41,8 +41,7 @@ shaka.util.ObjectUtils = class {
41
41
 
42
42
  // This covers Uint8Array and friends, even without a TypedArray
43
43
  // base-class constructor.
44
- const isTypedArray =
45
- val.buffer && val.buffer.constructor == ArrayBuffer;
44
+ const isTypedArray = val.buffer instanceof ArrayBuffer;
46
45
  if (isTypedArray) {
47
46
  return val;
48
47
  }
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.8",
4
+ "version": "4.8.10",
5
5
  "homepage": "https://github.com/shaka-project/shaka-player",
6
6
  "author": "Google",
7
7
  "maintainers": [
@@ -46,6 +46,10 @@ shaka.ui.AudioLanguageSelection = class extends shaka.ui.SettingsMenu {
46
46
  });
47
47
 
48
48
 
49
+ this.eventManager.listen(this.player, 'loading', () => {
50
+ this.onTracksChanged_();
51
+ });
52
+
49
53
  this.eventManager.listen(this.player, 'trackschanged', () => {
50
54
  this.onTracksChanged_();
51
55
  });
@@ -50,6 +50,10 @@ shaka.ui.ResolutionSelection = class extends shaka.ui.SettingsMenu {
50
50
  });
51
51
 
52
52
 
53
+ this.eventManager.listen(this.player, 'loading', () => {
54
+ this.updateResolutionSelection_();
55
+ });
56
+
53
57
  this.eventManager.listen(this.player, 'variantchanged', () => {
54
58
  this.updateResolutionSelection_();
55
59
  });
@@ -64,6 +64,10 @@ shaka.ui.TextSelection = class extends shaka.ui.SettingsMenu {
64
64
  this.updateTextLanguages_();
65
65
  });
66
66
 
67
+ this.eventManager.listen(this.player, 'loading', () => {
68
+ this.onTracksChanged_();
69
+ });
70
+
67
71
  this.eventManager.listen(this.player, 'texttrackvisibility', () => {
68
72
  this.onCaptionStateChange_();
69
73
  this.updateTextLanguages_();