shaka-player 4.10.1 → 4.10.2

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.
@@ -1707,7 +1707,8 @@ shaka.extern.AdsConfiguration;
1707
1707
  * ignoreDevicePixelRatio: boolean,
1708
1708
  * clearBufferSwitch: boolean,
1709
1709
  * safeMarginSwitch: number,
1710
- * cacheLoadThreshold: number
1710
+ * cacheLoadThreshold: number,
1711
+ * minTimeToSwitch: number
1711
1712
  * }}
1712
1713
  *
1713
1714
  * @property {boolean} enabled
@@ -1769,6 +1770,11 @@ shaka.extern.AdsConfiguration;
1769
1770
  * Indicates the value in milliseconds from which a request is not
1770
1771
  * considered cached.
1771
1772
  * Defaults to <code>20</code>.
1773
+ * @property {number} minTimeToSwitch
1774
+ * Indicates the minimum time to change quality once the real bandwidth is
1775
+ * available, in seconds. This time is only used on the first load.
1776
+ * Defaults to <code>0</code> seconds except in Apple browsers whose default
1777
+ * value is <code>0.5</code> seconds.
1772
1778
  * @exportDoc
1773
1779
  */
1774
1780
  shaka.extern.AbrConfiguration;
@@ -433,14 +433,17 @@ shaka.abr.SimpleAbrManager = class {
433
433
  return;
434
434
  }
435
435
  this.startupComplete_ = true;
436
- } else {
437
- // Check if we've left the switch interval.
438
- const now = Date.now();
439
- const delta = now - this.lastTimeChosenMs_;
440
- if (delta < this.config_.switchInterval * 1000) {
441
- shaka.log.v2('Still within switch interval...');
442
- return;
443
- }
436
+
437
+ this.lastTimeChosenMs_ -=
438
+ (this.config_.switchInterval - this.config_.minTimeToSwitch) * 1000;
439
+ }
440
+
441
+ // Check if we've left the switch interval.
442
+ const now = Date.now();
443
+ const delta = now - this.lastTimeChosenMs_;
444
+ if (delta < this.config_.switchInterval * 1000) {
445
+ shaka.log.v2('Still within switch interval...');
446
+ return;
444
447
  }
445
448
 
446
449
  const chosenVariant = this.chooseVariant();
@@ -635,9 +635,10 @@ shaka.hls.HlsParser = class {
635
635
  if (goog.DEBUG) {
636
636
  const firstSequenceStartTime =
637
637
  mediaSequenceToStartTime.values().next().value;
638
- shaka.log.warning(
639
- firstSequenceStartTime == segment0.startTime,
640
- 'Sequence number map is not ordered as expected!');
638
+ if (firstSequenceStartTime != segment0.startTime) {
639
+ shaka.log.warning(
640
+ 'Sequence number map is not ordered as expected!');
641
+ }
641
642
  }
642
643
  for (const [sequence, start] of mediaSequenceToStartTime) {
643
644
  if (start == segment0.startTime) {
package/lib/player.js CHANGED
@@ -6931,7 +6931,7 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
6931
6931
  // Check if we should show text (based on difference between audio and text
6932
6932
  // languages).
6933
6933
  if (initialTextStream) {
6934
- if (initialVariant.audio && this.shouldInitiallyShowText_(
6934
+ if (this.shouldInitiallyShowText_(
6935
6935
  initialVariant.audio, initialTextStream)) {
6936
6936
  this.isTextVisible_ = true;
6937
6937
  }
@@ -6951,7 +6951,7 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
6951
6951
  /**
6952
6952
  * Check if we should show text on screen automatically.
6953
6953
  *
6954
- * @param {shaka.extern.Stream} audioStream
6954
+ * @param {?shaka.extern.Stream} audioStream
6955
6955
  * @param {shaka.extern.Stream} textStream
6956
6956
  * @return {boolean}
6957
6957
  * @private
@@ -6982,6 +6982,9 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
6982
6982
  }
6983
6983
 
6984
6984
  if (this.config_.autoShowText == AutoShowText.IF_SUBTITLES_MAY_BE_NEEDED) {
6985
+ if (!audioStream) {
6986
+ return false;
6987
+ }
6985
6988
  /* The text should automatically be shown if the text is
6986
6989
  * language-compatible with the user's text language preference, but not
6987
6990
  * compatible with the audio. These are cases where we deduce that
@@ -7806,7 +7809,7 @@ shaka.Player.TYPICAL_BUFFERING_THRESHOLD_ = 0.5;
7806
7809
  * @export
7807
7810
  */
7808
7811
  // eslint-disable-next-line no-useless-concat
7809
- shaka.Player.version = 'v4.10.1' + '-uncompiled'; // x-release-please-version
7812
+ shaka.Player.version = 'v4.10.2' + '-uncompiled'; // x-release-please-version
7810
7813
 
7811
7814
  // Initialize the deprecation system using the version string we just set
7812
7815
  // on the player.
@@ -351,6 +351,7 @@ shaka.util.PlayerConfiguration = class {
351
351
  clearBufferSwitch: false,
352
352
  safeMarginSwitch: 0,
353
353
  cacheLoadThreshold: 20,
354
+ minTimeToSwitch: shaka.util.Platform.isApple() ? 0.5 : 0,
354
355
  };
355
356
 
356
357
  const cmcd = {
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.10.1",
4
+ "version": "4.10.2",
5
5
  "homepage": "https://github.com/shaka-project/shaka-player",
6
6
  "author": "Google",
7
7
  "maintainers": [
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "AD_DURATION": "Durée de l'annonce",
3
3
  "AD_PROGRESS": "Annonce [AD_ON] sur [NUM_ADS]",
4
- "AD_STATISTICS": "Statistiques de la annonce",
4
+ "AD_STATISTICS": "Statistiques de l'annonce",
5
5
  "AD_TIME": "Annonce : [AD_TIME]",
6
6
  "AIRPLAY": "AirPlay",
7
7
  "AUTO_QUALITY": "Automatique",