shaka-player 3.3.5 → 3.3.6

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.
@@ -219,8 +219,9 @@ shaka.abr.SimpleAbrManager = class {
219
219
  * @export
220
220
  */
221
221
  getBandwidthEstimate() {
222
+ const defaultBandwidthEstimate = this.getDefaultBandwidth_();
222
223
  return this.bandwidthEstimator_.getBandwidthEstimate(
223
- this.config_.defaultBandwidthEstimate);
224
+ defaultBandwidthEstimate);
224
225
  }
225
226
 
226
227
 
@@ -1778,9 +1778,20 @@ shaka.hls.HlsParser = class {
1778
1778
  const pPreviousReference = i == 0 ?
1779
1779
  previousReference : partialSegmentRefs[partialSegmentRefs.length - 1];
1780
1780
  const pStartTime = (i == 0) ? startTime : pPreviousReference.endTime;
1781
- const pDuration = Number(item.getAttributeValue('DURATION'));
1782
- // A preload hinted partial segment doesn't have duration information,
1783
- // so its startTime and endTime are the same.
1781
+
1782
+ // If DURATION is missing from this partial segment, use the target
1783
+ // partial duration from the top of the playlist, which is a required
1784
+ // attribute for content with partial segments.
1785
+ const pDuration = Number(item.getAttributeValue('DURATION')) ||
1786
+ this.partialTargetDuration_;
1787
+
1788
+ // If for some reason we have neither an explicit duration, nor a target
1789
+ // partial duration, we should SKIP this partial segment to avoid
1790
+ // duplicating content in the presentation timeline.
1791
+ if (!pDuration) {
1792
+ continue;
1793
+ }
1794
+
1784
1795
  const pEndTime = pStartTime + pDuration;
1785
1796
 
1786
1797
  let pStartByte = 0;
@@ -1372,6 +1372,9 @@ shaka.media.DrmEngine = class {
1372
1372
  }
1373
1373
  return;
1374
1374
  }
1375
+ if (this.destroyer_.destroyed()) {
1376
+ return;
1377
+ }
1375
1378
 
1376
1379
  const updateEvent = new shaka.util.FakeEvent('drmsessionupdate');
1377
1380
  this.playerInterface_.onEvent(updateEvent);
package/lib/player.js CHANGED
@@ -6634,7 +6634,7 @@ shaka.Player.TYPICAL_BUFFERING_THRESHOLD_ = 0.5;
6634
6634
  * @define {string} A version number taken from git at compile time.
6635
6635
  * @export
6636
6636
  */
6637
- shaka.Player.version = 'v3.3.5-uncompiled';
6637
+ shaka.Player.version = 'v3.3.6-uncompiled';
6638
6638
 
6639
6639
  // Initialize the deprecation system using the version string we just set
6640
6640
  // on the player.
@@ -8,6 +8,7 @@ goog.provide('shaka.util.MimeUtils');
8
8
 
9
9
  goog.require('shaka.dependencies');
10
10
  goog.require('shaka.media.Transmuxer');
11
+ goog.require('shaka.util.ManifestParserUtils');
11
12
 
12
13
  /**
13
14
  * @summary A set of utility functions for dealing with MIME types.
@@ -32,6 +33,8 @@ shaka.util.MimeUtils = class {
32
33
  /**
33
34
  * Takes a MIME type and a codecs string and produces the full MIME
34
35
  * type. If it's a transport stream, convert its codecs to MP4 codecs.
36
+ * Otherwise for multiplexed content, convert the video MIME types to
37
+ * their audio equivalents if the content type is audio.
35
38
  *
36
39
  * @param {string} mimeType
37
40
  * @param {string} codecs
@@ -40,13 +43,19 @@ shaka.util.MimeUtils = class {
40
43
  */
41
44
  static getFullOrConvertedType(mimeType, codecs, contentType) {
42
45
  const fullMimeType = shaka.util.MimeUtils.getFullType(mimeType, codecs);
46
+ const ContentType = shaka.util.ManifestParserUtils.ContentType;
43
47
 
44
- if (!shaka.dependencies.muxjs() ||
45
- !shaka.media.Transmuxer.isTsContainer(fullMimeType)) {
46
- return fullMimeType;
48
+ if (shaka.media.Transmuxer.isTsContainer(fullMimeType)) {
49
+ if (shaka.dependencies.muxjs()) {
50
+ return shaka.media.Transmuxer.convertTsCodecs(
51
+ contentType, fullMimeType);
52
+ }
53
+ } else if (contentType == ContentType.AUDIO) {
54
+ // video/mp2t is the correct mime type for TS audio, so only replace the
55
+ // word "video" with "audio" for non-TS audio content.
56
+ return fullMimeType.replace('video', 'audio');
47
57
  }
48
-
49
- return shaka.media.Transmuxer.convertTsCodecs(contentType, fullMimeType);
58
+ return fullMimeType;
50
59
  }
51
60
 
52
61
 
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": "3.3.5",
4
+ "version": "3.3.6",
5
5
  "homepage": "https://github.com/shaka-project/shaka-player",
6
6
  "author": "Google",
7
7
  "maintainers": [
@@ -50,7 +50,7 @@
50
50
  "less": "https://gitpkg.now.sh/joeyparrish/less.js/packages/less?28c63a43",
51
51
  "less-plugin-clean-css": "github:austingardner/less-plugin-clean-css#4e9e77bf",
52
52
  "material-design-lite": "^1.3.0",
53
- "mux.js": "^5.14.1",
53
+ "mux.js": "^6.1.0",
54
54
  "open-sans-fonts": "^1.6.2",
55
55
  "postcss-less": "^6.0.0",
56
56
  "pwacompat": "^2.0.17",
@@ -632,11 +632,13 @@ describe('HlsParser live', () => {
632
632
  expect(ref.startTime).not.toBeLessThan(rolloverOffset);
633
633
  });
634
634
 
635
+ // Test for https://github.com/shaka-project/shaka-player/issues/4223
635
636
  it('parses streams with partial and preload hinted segments', async () => {
636
637
  playerInterface.isLowLatencyMode = () => true;
637
638
  const mediaWithPartialSegments = [
638
639
  '#EXTM3U\n',
639
640
  '#EXT-X-TARGETDURATION:5\n',
641
+ '#EXT-X-PART-INF:PART-TARGET=1.5\n',
640
642
  '#EXT-X-MAP:URI="init.mp4",BYTERANGE="616@0"\n',
641
643
  '#EXT-X-MEDIA-SEQUENCE:0\n',
642
644
  // ref includes partialRef, partialRef2
@@ -670,6 +672,11 @@ describe('HlsParser live', () => {
670
672
  segmentDataStartTime + 4, /* baseUri= */ '', /* startByte= */ 200,
671
673
  /* endByte= */ 429);
672
674
 
675
+ const ref = ManifestParser.makeReference(
676
+ 'test:/main.mp4', segmentDataStartTime, segmentDataStartTime + 4,
677
+ /* baseUri= */ '', /* startByte= */ 0, /* endByte= */ 429,
678
+ /* timestampOffset= */ 0, [partialRef, partialRef2]);
679
+
673
680
  const partialRef3 = ManifestParser.makeReference(
674
681
  'test:/partial.mp4', segmentDataStartTime + 4,
675
682
  segmentDataStartTime + 6,
@@ -679,17 +686,12 @@ describe('HlsParser live', () => {
679
686
  // so its startTime and endTime are the same.
680
687
  const preloadRef = ManifestParser.makeReference(
681
688
  'test:/partial.mp4', segmentDataStartTime + 6,
682
- segmentDataStartTime + 6,
689
+ segmentDataStartTime + 7.5,
683
690
  /* baseUri= */ '', /* startByte= */ 210, /* endByte= */ null);
684
691
 
685
- const ref = ManifestParser.makeReference(
686
- 'test:/main.mp4', segmentDataStartTime, segmentDataStartTime + 4,
687
- /* baseUri= */ '', /* startByte= */ 0, /* endByte= */ 429,
688
- /* timestampOffset= */ 0, [partialRef, partialRef2]);
689
-
690
692
  // ref2 is not fully published yet, so it doesn't have a segment uri.
691
693
  const ref2 = ManifestParser.makeReference(
692
- '', segmentDataStartTime + 4, segmentDataStartTime + 6,
694
+ '', segmentDataStartTime + 4, segmentDataStartTime + 7.5,
693
695
  /* baseUri= */ '', /* startByte= */ 0, /* endByte= */ null,
694
696
  /* timestampOffset= */ 0, [partialRef3, preloadRef]);
695
697
 
@@ -699,6 +701,56 @@ describe('HlsParser live', () => {
699
701
  ManifestParser.verifySegmentIndex(video, [ref, ref2]);
700
702
  });
701
703
 
704
+ // Test for https://github.com/shaka-project/shaka-player/issues/4223
705
+ it('ignores preload hinted segments without target duration', async () => {
706
+ playerInterface.isLowLatencyMode = () => true;
707
+
708
+ // Missing PART-TARGET, so preload hints are skipped.
709
+ const mediaWithPartialSegments = [
710
+ '#EXTM3U\n',
711
+ '#EXT-X-TARGETDURATION:5\n',
712
+ '#EXT-X-MAP:URI="init.mp4",BYTERANGE="616@0"\n',
713
+ '#EXT-X-MEDIA-SEQUENCE:0\n',
714
+ '#EXTINF:4,\n',
715
+ // ref1
716
+ 'main.mp4\n',
717
+ // ref2 includes partialRef, but not preloadRef
718
+ // partialRef
719
+ '#EXT-X-PART:DURATION=2,URI="partial.mp4",BYTERANGE=210@0\n',
720
+ // preloadRef
721
+ '#EXT-X-PRELOAD-HINT:TYPE=PART,URI="partial.mp4",BYTERANGE-START=210\n',
722
+ ].join('');
723
+
724
+ fakeNetEngine
725
+ .setResponseText('test:/master', master)
726
+ .setResponseText('test:/video', mediaWithPartialSegments)
727
+ .setResponseValue('test:/init.mp4', initSegmentData)
728
+ .setResponseValue('test:/main.mp4', segmentData)
729
+ .setResponseValue('test:/partial.mp4', segmentData)
730
+ .setResponseValue('test:/partial2.mp4', segmentData);
731
+
732
+ const ref1 = ManifestParser.makeReference(
733
+ 'test:/main.mp4', segmentDataStartTime, segmentDataStartTime + 4,
734
+ /* baseUri= */ '', /* startByte= */ 0, /* endByte= */ null,
735
+ /* timestampOffset= */ 0, []);
736
+
737
+ const partialRef = ManifestParser.makeReference(
738
+ 'test:/partial.mp4', segmentDataStartTime + 4,
739
+ segmentDataStartTime + 6,
740
+ /* baseUri= */ '', /* startByte= */ 0, /* endByte= */ 209);
741
+
742
+ // ref2 is not fully published yet, so it doesn't have a segment uri.
743
+ const ref2 = ManifestParser.makeReference(
744
+ '', segmentDataStartTime + 4, segmentDataStartTime + 6,
745
+ /* baseUri= */ '', /* startByte= */ 0, /* endByte= */ 209,
746
+ /* timestampOffset= */ 0, [partialRef]);
747
+
748
+ const manifest = await parser.start('test:/master', playerInterface);
749
+ const video = manifest.variants[0].video;
750
+ await video.createSegmentIndex();
751
+ ManifestParser.verifySegmentIndex(video, [ref1, ref2]);
752
+ });
753
+
702
754
  // Test for https://github.com/shaka-project/shaka-player/issues/4185
703
755
  it('does not fail on preload hints with LL mode off', async () => {
704
756
  // LL mode must be off for this test!
@@ -708,6 +760,7 @@ describe('HlsParser live', () => {
708
760
  '#EXTM3U\n',
709
761
  '#EXT-X-TARGETDURATION:5\n',
710
762
  '#EXT-X-MAP:URI="init.mp4",BYTERANGE="616@0"\n',
763
+ '#EXT-X-PART-INF:PART-TARGET=1.5\n',
711
764
  '#EXTINF:4,\n',
712
765
  'main.mp4\n',
713
766
  '#EXT-X-PART:DURATION=2,URI="partial.mp4",BYTERANGE=210@0\n',
@@ -161,7 +161,7 @@
161
161
  /* Consistent margins (external) and padding (internal) between controls. */
162
162
  .bottom-panels-elements-margin();
163
163
 
164
- padding: 0;
164
+ padding: 0 5px;
165
165
 
166
166
  /* Transparent backgrounds, no borders, and a pointer when you mouse over
167
167
  * them. */
@@ -37,7 +37,7 @@
37
37
  }
38
38
 
39
39
  .bottom-panels-elements-margin() {
40
- margin: 1px 6px;
40
+ margin: 1px;
41
41
  }
42
42
 
43
43
  /* For containers which host elements overlaying other things. */
@@ -140,6 +140,7 @@
140
140
 
141
141
  .shaka-volume-bar-container {
142
142
  width: 100px;
143
+ padding: 0;
143
144
  }
144
145
 
145
146
  .shaka-range-element {
@@ -1,10 +0,0 @@
1
- <!--
2
- Please remember to:
3
-
4
- 1. Use Conventional Commits syntax (fix: ..., feat: ..., etc.) in commits and
5
- PR title (https://www.conventionalcommits.org/)
6
- 2. Tag any related or fixed issues ("Issue #123", "Closes #420")
7
- 3. Sign the Google CLA if you haven't (https://cla.developers.google.com)
8
-
9
- You may delete this comment from the PR description.
10
- -->