shaka-player 4.6.6 → 4.6.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.
@@ -207,6 +207,15 @@ shaka.ads.ClientSideAd = class {
207
207
  }
208
208
  }
209
209
 
210
+ /**
211
+ * It's required for a muted ad to start when autoplaying.
212
+ *
213
+ * @param {number} videoVolume
214
+ */
215
+ setInitialMuted(videoVolume) {
216
+ this.volume_ = videoVolume;
217
+ this.manager_.setVolume(0);
218
+ }
210
219
 
211
220
  /**
212
221
  * @override
@@ -532,9 +532,10 @@ shaka.ads.ClientSideAdManager = class {
532
532
  if (this.ad_.isLinear()) {
533
533
  this.adContainer_.setAttribute('ad-active', 'true');
534
534
  this.video_.pause();
535
- this.ad_.setVolume(this.video_.volume);
536
535
  if (this.video_.muted) {
537
- this.ad_.setMuted(true);
536
+ this.ad_.setInitialMuted(this.video_.volume);
537
+ } else {
538
+ this.ad_.setVolume(this.video_.volume);
538
539
  }
539
540
  }
540
541
  }
@@ -3452,6 +3452,13 @@ shaka.hls.HlsParser = class {
3452
3452
  if (this.isLive_() && mediaSequenceToStartTime.has(position)) {
3453
3453
  firstStartTime = mediaSequenceToStartTime.get(position);
3454
3454
  }
3455
+ // This is for recovering from disconnects.
3456
+ if (firstStartTime === 0 &&
3457
+ this.presentationType_ == shaka.hls.HlsParser.PresentationType_.LIVE &&
3458
+ mediaSequenceToStartTime.size > 0 &&
3459
+ !mediaSequenceToStartTime.has(position)) {
3460
+ firstStartTime = this.presentationTimeline_.getSegmentAvailabilityStart();
3461
+ }
3455
3462
 
3456
3463
  /** @type {!Array.<!shaka.media.SegmentReference>} */
3457
3464
  const references = [];
@@ -3766,7 +3773,9 @@ shaka.hls.HlsParser = class {
3766
3773
 
3767
3774
  contentMimeType = response.headers['content-type'];
3768
3775
  } catch (error) {
3769
- if (error && error.code == shaka.util.Error.Code.HTTP_ERROR) {
3776
+ if (error &&
3777
+ (error.code == shaka.util.Error.Code.HTTP_ERROR ||
3778
+ error.code == shaka.util.Error.Code.BAD_HTTP_STATUS)) {
3770
3779
  headRequest.method = 'GET';
3771
3780
  const response = await this.makeNetworkRequest_(
3772
3781
  headRequest, requestType, {type});
@@ -37,7 +37,9 @@ shaka.net.NetworkingUtils = class {
37
37
  const response = await netEngine.request(type, request).promise;
38
38
  mimeType = response.headers['content-type'];
39
39
  } catch (error) {
40
- if (error && error.code == shaka.util.Error.Code.HTTP_ERROR) {
40
+ if (error &&
41
+ (error.code == shaka.util.Error.Code.HTTP_ERROR ||
42
+ error.code == shaka.util.Error.Code.BAD_HTTP_STATUS)) {
41
43
  request.method = 'GET';
42
44
  const response = await netEngine.request(type, request).promise;
43
45
  mimeType = response.headers['content-type'];
package/lib/player.js CHANGED
@@ -6779,7 +6779,7 @@ shaka.Player.TYPICAL_BUFFERING_THRESHOLD_ = 0.5;
6779
6779
  * @export
6780
6780
  */
6781
6781
  // eslint-disable-next-line no-useless-concat
6782
- shaka.Player.version = 'v4.6.6' + '-uncompiled'; // x-release-please-version
6782
+ shaka.Player.version = 'v4.6.7' + '-uncompiled'; // x-release-please-version
6783
6783
 
6784
6784
  // Initialize the deprecation system using the version string we just set
6785
6785
  // on the player.
@@ -791,3 +791,9 @@ shaka.polyfill.PatchedMediaKeysApple.MediaKeyStatusMap = class {
791
791
  goog.asserts.assert(false, 'Not used! Provided only for the compiler.');
792
792
  }
793
793
  };
794
+
795
+ if (!navigator.requestMediaKeySystemAccess ||
796
+ // eslint-disable-next-line no-restricted-syntax
797
+ !MediaKeySystemAccess.prototype.getConfiguration) {
798
+ shaka.polyfill.register(shaka.polyfill.PatchedMediaKeysApple.install);
799
+ }
@@ -1097,6 +1097,11 @@ shaka.util.PeriodCombiner = class {
1097
1097
  return true;
1098
1098
  }
1099
1099
 
1100
+ // Forced subtitles should be treated as unique streams
1101
+ if (outputStream.forced !== candidate.forced) {
1102
+ return false;
1103
+ }
1104
+
1100
1105
  const languageRelatedness = LanguageUtils.relatedness(
1101
1106
  outputStream.language, candidate.language);
1102
1107
 
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.6.6",
4
+ "version": "4.6.7",
5
5
  "homepage": "https://github.com/shaka-project/shaka-player",
6
6
  "author": "Google",
7
7
  "maintainers": [
@@ -603,6 +603,55 @@ describe('PeriodCombiner', () => {
603
603
  }
604
604
  });
605
605
 
606
+ // Regression test for #6054, where we failed on multi-period content with
607
+ // different numbers of forced-subtitle streams per period.
608
+ it('Does not combine subtitle and forced-subtitle tracks', async () => {
609
+ const videoStreams = [makeVideoStream(1280)];
610
+ const audioStreams = [makeAudioStream('en', /* channels= */ 2)];
611
+ const imageStreams = [];
612
+
613
+ const forcedSubtitle = makeTextStream('de');
614
+ forcedSubtitle.roles = ['forced-subtitle'];
615
+ forcedSubtitle.forced = true;
616
+
617
+ const subtitle = makeTextStream('de');
618
+ subtitle.roles = ['subtitle'];
619
+
620
+ /** @type {!Array.<shaka.extern.Period>} */
621
+ const periods = [
622
+ {
623
+ id: '1',
624
+ videoStreams,
625
+ audioStreams,
626
+ textStreams: [
627
+ forcedSubtitle,
628
+ subtitle,
629
+ ],
630
+ imageStreams,
631
+ },
632
+ {
633
+ id: '2',
634
+ videoStreams,
635
+ audioStreams,
636
+ textStreams: [
637
+ subtitle,
638
+ ],
639
+ imageStreams,
640
+ },
641
+ {
642
+ id: '3',
643
+ videoStreams,
644
+ audioStreams,
645
+ textStreams: [],
646
+ imageStreams,
647
+ },
648
+ ];
649
+
650
+ await combiner.combinePeriods(periods, /* isDynamic= */ true);
651
+ const textStreams = combiner.getTextStreams();
652
+ expect(textStreams.every((s) => s.roles.length === 1)).toBe(true);
653
+ });
654
+
606
655
  // Regression test for #3383, where we failed on multi-period content with
607
656
  // multiple image streams per period.
608
657
  it('Can handle multiple image streams', async () => {