shaka-player 4.9.19 → 4.9.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.
@@ -26,6 +26,7 @@
26
26
  *
27
27
  * @property {number} maxAttempts
28
28
  * The maximum number of times the request should be attempted.
29
+ * The minimum supported value is 1 (only one request without retries).
29
30
  * @property {number} baseDelay
30
31
  * The delay before the first retry, in milliseconds.
31
32
  * @property {number} backoffFactor
@@ -2007,13 +2007,15 @@ shaka.dash.DashParser = class {
2007
2007
 
2008
2008
  const duration = context.periodInfo.duration || 0;
2009
2009
  const getBaseUris = context.representation.getBaseUris;
2010
+ const mimeType = context.representation.mimeType;
2011
+ const codecs = context.representation.codecs;
2010
2012
  streamInfo = {
2011
2013
  generateSegmentIndex: () => {
2012
2014
  const segmentIndex = shaka.media.SegmentIndex.forSingleSegment(
2013
2015
  periodStart, duration, getBaseUris());
2014
2016
  segmentIndex.forEachTopLevelReference((ref) => {
2015
- ref.mimeType = context.representation.mimeType;
2016
- ref.codecs = context.representation.codecs;
2017
+ ref.mimeType = mimeType;
2018
+ ref.codecs = codecs;
2017
2019
  });
2018
2020
  return Promise.resolve(segmentIndex);
2019
2021
  },
@@ -150,6 +150,12 @@ shaka.media.AdaptationSet = class {
150
150
  }
151
151
  }
152
152
 
153
+ // Don't adapt between spatial and non spatial audio, which may
154
+ // annoy the user.
155
+ if (a.spatialAudio !== b.spatialAudio) {
156
+ return false;
157
+ }
158
+
153
159
  // We can only adapt between base-codecs.
154
160
  if (compareCodecs && !AdaptationSet.canTransitionBetween_(a, b)) {
155
161
  return false;
@@ -1862,12 +1862,10 @@ shaka.media.StreamingEngine = class {
1862
1862
  });
1863
1863
 
1864
1864
  if (!waitingForAnotherStreamToRecover) {
1865
- if (this.config_.maxDisabledTime > 0) {
1866
- const handled = this.playerInterface_.disableStream(
1867
- mediaState.stream, this.config_.maxDisabledTime);
1868
- if (handled) {
1869
- return;
1870
- }
1865
+ const handled = this.playerInterface_.disableStream(
1866
+ mediaState.stream, this.config_.maxDisabledTime);
1867
+ if (handled) {
1868
+ return;
1871
1869
  }
1872
1870
  // Reduction schedule: 80%, 60%, 40%, 20%, 16%, 12%, 8%, 4%, fail.
1873
1871
  // Note: percentages are used for comparisons to avoid rounding errors.
@@ -2284,10 +2282,11 @@ shaka.media.StreamingEngine = class {
2284
2282
  this.playerInterface_.onManifestUpdate();
2285
2283
  } else {
2286
2284
  // All other schemes are dispatched as a general 'emsg' event.
2285
+ const endTime = startTime + (eventDuration / timescale);
2287
2286
  /** @type {shaka.extern.EmsgInfo} */
2288
2287
  const emsg = {
2289
2288
  startTime: startTime,
2290
- endTime: startTime + (eventDuration / timescale),
2289
+ endTime: endTime,
2291
2290
  schemeIdUri: schemeId,
2292
2291
  value: value,
2293
2292
  timescale: timescale,
@@ -2320,17 +2319,17 @@ shaka.media.StreamingEngine = class {
2320
2319
  schemeId == 'https://developer.apple.com/streaming/emsg-id3') {
2321
2320
  // See https://aomediacodec.github.io/id3-emsg/
2322
2321
  const frames = shaka.util.Id3Utils.getID3Frames(messageData);
2323
- if (frames.length && reference) {
2322
+ if (frames.length) {
2324
2323
  /** @private {shaka.extern.ID3Metadata} */
2325
2324
  const metadata = {
2326
- cueTime: reference.startTime,
2325
+ cueTime: startTime,
2327
2326
  data: messageData,
2328
2327
  frames: frames,
2329
- dts: reference.startTime,
2330
- pts: reference.startTime,
2328
+ dts: startTime,
2329
+ pts: startTime,
2331
2330
  };
2332
2331
  this.playerInterface_.onMetadata(
2333
- [metadata], /* offset= */ 0, reference.endTime);
2332
+ [metadata], /* offset= */ 0, endTime);
2334
2333
  }
2335
2334
  }
2336
2335
  }
@@ -2686,11 +2685,9 @@ shaka.media.StreamingEngine = class {
2686
2685
  // use the backoff system to delay and backoff the error handling.
2687
2686
  await this.failureCallbackBackoff_.attempt();
2688
2687
  this.destroyer_.ensureNotDestroyed();
2689
-
2690
- const maxDisabledTime = this.getDisabledTime_(error);
2691
2688
  // Try to recover from network errors
2692
- if (error.category === shaka.util.Error.Category.NETWORK &&
2693
- maxDisabledTime > 0) {
2689
+ if (error.category === shaka.util.Error.Category.NETWORK) {
2690
+ const maxDisabledTime = this.getDisabledTime_(error);
2694
2691
  error.handled = this.playerInterface_.disableStream(
2695
2692
  mediaState.stream, maxDisabledTime);
2696
2693
 
package/lib/player.js CHANGED
@@ -3019,7 +3019,7 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
3019
3019
  */
3020
3020
  processTimedMetadataMediaSrc_(metadata, offset, segmentEndTime) {
3021
3021
  for (const sample of metadata) {
3022
- if (sample.data && sample.cueTime && sample.frames) {
3022
+ if (sample.data && typeof(sample.cueTime) == 'number' && sample.frames) {
3023
3023
  const start = sample.cueTime + offset;
3024
3024
  let end = segmentEndTime;
3025
3025
  // This can happen when the ID3 info arrives in a previous segment.
@@ -6908,6 +6908,10 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
6908
6908
  return false;
6909
6909
  }
6910
6910
 
6911
+ if (disableTime == 0) {
6912
+ return false;
6913
+ }
6914
+
6911
6915
  // It only makes sense to disable a stream if we have an alternative else we
6912
6916
  // end up disabling all variants.
6913
6917
  const hasAltStream = this.manifest_.variants.some((variant) => {
@@ -7480,7 +7484,7 @@ shaka.Player.TYPICAL_BUFFERING_THRESHOLD_ = 0.5;
7480
7484
  * @export
7481
7485
  */
7482
7486
  // eslint-disable-next-line no-useless-concat
7483
- shaka.Player.version = 'v4.9.19' + '-uncompiled'; // x-release-please-version
7487
+ shaka.Player.version = 'v4.9.21' + '-uncompiled'; // x-release-please-version
7484
7488
 
7485
7489
  // Initialize the deprecation system using the version string we just set
7486
7490
  // on the player.
@@ -726,6 +726,15 @@ shaka.text.UITextDisplayer = class {
726
726
  style.display = 'flex';
727
727
  style.flexDirection = 'column';
728
728
  style.alignItems = 'center';
729
+ if (cue.textAlign == Cue.textAlign.LEFT ||
730
+ cue.textAlign == Cue.textAlign.START) {
731
+ style.width = '100%';
732
+ style.alignItems = 'start';
733
+ } else if (cue.textAlign == Cue.textAlign.RIGHT ||
734
+ cue.textAlign == Cue.textAlign.END) {
735
+ style.width = '100%';
736
+ style.alignItems = 'end';
737
+ }
729
738
 
730
739
  if (cue.displayAlign == Cue.displayAlign.BEFORE) {
731
740
  style.justifyContent = 'flex-start';
@@ -811,23 +820,41 @@ shaka.text.UITextDisplayer = class {
811
820
 
812
821
  style.lineHeight = cue.lineHeight;
813
822
 
814
- // The position defines the indent of the text container in the
815
- // direction defined by the writing direction.
816
- if (cue.position != null) {
817
- if (cue.writingMode == Cue.writingMode.HORIZONTAL_TOP_TO_BOTTOM) {
818
- style.paddingLeft = cue.position;
819
- } else {
820
- style.paddingTop = cue.position;
821
- }
822
- }
823
-
824
823
  // The positionAlign attribute is an alignment for the text container in
825
824
  // the dimension of the writing direction.
826
825
  const computedPositionAlign = this.computeCuePositionAlignment_(cue);
827
826
  if (computedPositionAlign == Cue.positionAlign.LEFT) {
828
827
  style.cssFloat = 'left';
828
+ if (cue.position !== null) {
829
+ style.position = 'absolute';
830
+ if (cue.writingMode == Cue.writingMode.HORIZONTAL_TOP_TO_BOTTOM) {
831
+ style.left = cue.position + '%';
832
+ style.width = 'auto';
833
+ } else {
834
+ style.top = cue.position + '%';
835
+ }
836
+ }
829
837
  } else if (computedPositionAlign == Cue.positionAlign.RIGHT) {
830
838
  style.cssFloat = 'right';
839
+ if (cue.position !== null) {
840
+ style.position = 'absolute';
841
+ if (cue.writingMode == Cue.writingMode.HORIZONTAL_TOP_TO_BOTTOM) {
842
+ style.right = cue.position + '%';
843
+ style.width = 'auto';
844
+ } else {
845
+ style.bottom = cue.position + '%';
846
+ }
847
+ }
848
+ } else {
849
+ if (cue.position !== null && cue.position != 50) {
850
+ style.position = 'absolute';
851
+ if (cue.writingMode == Cue.writingMode.HORIZONTAL_TOP_TO_BOTTOM) {
852
+ style.left = cue.position + '%';
853
+ style.width = 'auto';
854
+ } else {
855
+ style.top = cue.position + '%';
856
+ }
857
+ }
831
858
  }
832
859
 
833
860
  style.textAlign = cue.textAlign;
@@ -1242,7 +1242,7 @@ shaka.util.PeriodCombiner = class {
1242
1242
  return true;
1243
1243
  } else if (candidateRoleMatches.length < bestRoleMatches.length) {
1244
1244
  return false;
1245
- } else {
1245
+ } else if (candidate.roles.length !== best.roles.length) {
1246
1246
  // Both streams have the same role overlap with the outputStream
1247
1247
  // If this is the case, choose the stream with the fewer roles overall.
1248
1248
  // Streams that match best together tend to be streams with the same
@@ -949,13 +949,17 @@ shaka.util.StreamUtils = class {
949
949
  if (!keySystemConfig.audio) {
950
950
  // KeySystemTrackConfiguration
951
951
  keySystemConfig.audio = {
952
- encryptionScheme: info.encryptionScheme,
953
952
  robustness: info.audioRobustness,
954
953
  };
954
+ if (info.encryptionScheme) {
955
+ keySystemConfig.audio.encryptionScheme = info.encryptionScheme;
956
+ }
955
957
  } else {
956
- keySystemConfig.audio.encryptionScheme =
957
- keySystemConfig.audio.encryptionScheme ||
958
- info.encryptionScheme;
958
+ if (info.encryptionScheme) {
959
+ keySystemConfig.audio.encryptionScheme =
960
+ keySystemConfig.audio.encryptionScheme ||
961
+ info.encryptionScheme;
962
+ }
959
963
  keySystemConfig.audio.robustness =
960
964
  keySystemConfig.audio.robustness ||
961
965
  info.audioRobustness;
@@ -970,13 +974,17 @@ shaka.util.StreamUtils = class {
970
974
  if (!keySystemConfig.video) {
971
975
  // KeySystemTrackConfiguration
972
976
  keySystemConfig.video = {
973
- encryptionScheme: info.encryptionScheme,
974
977
  robustness: info.videoRobustness,
975
978
  };
979
+ if (info.encryptionScheme) {
980
+ keySystemConfig.video.encryptionScheme = info.encryptionScheme;
981
+ }
976
982
  } else {
977
- keySystemConfig.video.encryptionScheme =
978
- keySystemConfig.video.encryptionScheme ||
979
- info.encryptionScheme;
983
+ if (info.encryptionScheme) {
984
+ keySystemConfig.video.encryptionScheme =
985
+ keySystemConfig.video.encryptionScheme ||
986
+ info.encryptionScheme;
987
+ }
980
988
  keySystemConfig.video.robustness =
981
989
  keySystemConfig.video.robustness ||
982
990
  info.videoRobustness;
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.9.19",
4
+ "version": "4.9.21",
5
5
  "homepage": "https://github.com/shaka-project/shaka-player",
6
6
  "author": "Google",
7
7
  "maintainers": [