shaka-player 3.2.7 → 3.2.8

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.
@@ -216,8 +216,9 @@ shaka.abr.SimpleAbrManager = class {
216
216
  * @export
217
217
  */
218
218
  getBandwidthEstimate() {
219
+ const defaultBandwidthEstimate = this.getDefaultBandwidth_();
219
220
  return this.bandwidthEstimator_.getBandwidthEstimate(
220
- this.config_.defaultBandwidthEstimate);
221
+ defaultBandwidthEstimate);
221
222
  }
222
223
 
223
224
 
@@ -1775,9 +1775,20 @@ shaka.hls.HlsParser = class {
1775
1775
  const pPreviousReference = i == 0 ?
1776
1776
  previousReference : partialSegmentRefs[partialSegmentRefs.length - 1];
1777
1777
  const pStartTime = (i == 0) ? startTime : pPreviousReference.endTime;
1778
- const pDuration = Number(item.getAttributeValue('DURATION'));
1779
- // A preload hinted partial segment doesn't have duration information,
1780
- // so its startTime and endTime are the same.
1778
+
1779
+ // If DURATION is missing from this partial segment, use the target
1780
+ // partial duration from the top of the playlist, which is a required
1781
+ // attribute for content with partial segments.
1782
+ const pDuration = Number(item.getAttributeValue('DURATION')) ||
1783
+ this.partialTargetDuration_;
1784
+
1785
+ // If for some reason we have neither an explicit duration, nor a target
1786
+ // partial duration, we should SKIP this partial segment to avoid
1787
+ // duplicating content in the presentation timeline.
1788
+ if (!pDuration) {
1789
+ continue;
1790
+ }
1791
+
1781
1792
  const pEndTime = pStartTime + pDuration;
1782
1793
 
1783
1794
  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
@@ -6430,7 +6430,7 @@ shaka.Player.TYPICAL_BUFFERING_THRESHOLD_ = 0.5;
6430
6430
  * @define {string} A version number taken from git at compile time.
6431
6431
  * @export
6432
6432
  */
6433
- shaka.Player.version = 'v3.2.7-uncompiled';
6433
+ shaka.Player.version = 'v3.2.8-uncompiled';
6434
6434
 
6435
6435
  // Initialize the deprecation system using the version string we just set
6436
6436
  // 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.2.7",
4
+ "version": "3.2.8",
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",
@@ -630,11 +630,13 @@ describe('HlsParser live', () => {
630
630
  expect(ref.startTime).not.toBeLessThan(rolloverOffset);
631
631
  });
632
632
 
633
+ // Test for https://github.com/shaka-project/shaka-player/issues/4223
633
634
  it('parses streams with partial and preload hinted segments', async () => {
634
635
  playerInterface.isLowLatencyMode = () => true;
635
636
  const mediaWithPartialSegments = [
636
637
  '#EXTM3U\n',
637
638
  '#EXT-X-TARGETDURATION:5\n',
639
+ '#EXT-X-PART-INF:PART-TARGET=1.5\n',
638
640
  '#EXT-X-MAP:URI="init.mp4",BYTERANGE="616@0"\n',
639
641
  '#EXT-X-MEDIA-SEQUENCE:0\n',
640
642
  // ref includes partialRef, partialRef2
@@ -668,6 +670,11 @@ describe('HlsParser live', () => {
668
670
  segmentDataStartTime + 4, /* baseUri= */ '', /* startByte= */ 200,
669
671
  /* endByte= */ 429);
670
672
 
673
+ const ref = ManifestParser.makeReference(
674
+ 'test:/main.mp4', segmentDataStartTime, segmentDataStartTime + 4,
675
+ /* baseUri= */ '', /* startByte= */ 0, /* endByte= */ 429,
676
+ /* timestampOffset= */ 0, [partialRef, partialRef2]);
677
+
671
678
  const partialRef3 = ManifestParser.makeReference(
672
679
  'test:/partial.mp4', segmentDataStartTime + 4,
673
680
  segmentDataStartTime + 6,
@@ -677,17 +684,12 @@ describe('HlsParser live', () => {
677
684
  // so its startTime and endTime are the same.
678
685
  const preloadRef = ManifestParser.makeReference(
679
686
  'test:/partial.mp4', segmentDataStartTime + 6,
680
- segmentDataStartTime + 6,
687
+ segmentDataStartTime + 7.5,
681
688
  /* baseUri= */ '', /* startByte= */ 210, /* endByte= */ null);
682
689
 
683
- const ref = ManifestParser.makeReference(
684
- 'test:/main.mp4', segmentDataStartTime, segmentDataStartTime + 4,
685
- /* baseUri= */ '', /* startByte= */ 0, /* endByte= */ 429,
686
- /* timestampOffset= */ 0, [partialRef, partialRef2]);
687
-
688
690
  // ref2 is not fully published yet, so it doesn't have a segment uri.
689
691
  const ref2 = ManifestParser.makeReference(
690
- '', segmentDataStartTime + 4, segmentDataStartTime + 6,
692
+ '', segmentDataStartTime + 4, segmentDataStartTime + 7.5,
691
693
  /* baseUri= */ '', /* startByte= */ 0, /* endByte= */ null,
692
694
  /* timestampOffset= */ 0, [partialRef3, preloadRef]);
693
695
 
@@ -697,6 +699,56 @@ describe('HlsParser live', () => {
697
699
  ManifestParser.verifySegmentIndex(video, [ref, ref2]);
698
700
  });
699
701
 
702
+ // Test for https://github.com/shaka-project/shaka-player/issues/4223
703
+ it('ignores preload hinted segments without target duration', async () => {
704
+ playerInterface.isLowLatencyMode = () => true;
705
+
706
+ // Missing PART-TARGET, so preload hints are skipped.
707
+ const mediaWithPartialSegments = [
708
+ '#EXTM3U\n',
709
+ '#EXT-X-TARGETDURATION:5\n',
710
+ '#EXT-X-MAP:URI="init.mp4",BYTERANGE="616@0"\n',
711
+ '#EXT-X-MEDIA-SEQUENCE:0\n',
712
+ '#EXTINF:4,\n',
713
+ // ref1
714
+ 'main.mp4\n',
715
+ // ref2 includes partialRef, but not preloadRef
716
+ // partialRef
717
+ '#EXT-X-PART:DURATION=2,URI="partial.mp4",BYTERANGE=210@0\n',
718
+ // preloadRef
719
+ '#EXT-X-PRELOAD-HINT:TYPE=PART,URI="partial.mp4",BYTERANGE-START=210\n',
720
+ ].join('');
721
+
722
+ fakeNetEngine
723
+ .setResponseText('test:/master', master)
724
+ .setResponseText('test:/video', mediaWithPartialSegments)
725
+ .setResponseValue('test:/init.mp4', initSegmentData)
726
+ .setResponseValue('test:/main.mp4', segmentData)
727
+ .setResponseValue('test:/partial.mp4', segmentData)
728
+ .setResponseValue('test:/partial2.mp4', segmentData);
729
+
730
+ const ref1 = ManifestParser.makeReference(
731
+ 'test:/main.mp4', segmentDataStartTime, segmentDataStartTime + 4,
732
+ /* baseUri= */ '', /* startByte= */ 0, /* endByte= */ null,
733
+ /* timestampOffset= */ 0, []);
734
+
735
+ const partialRef = ManifestParser.makeReference(
736
+ 'test:/partial.mp4', segmentDataStartTime + 4,
737
+ segmentDataStartTime + 6,
738
+ /* baseUri= */ '', /* startByte= */ 0, /* endByte= */ 209);
739
+
740
+ // ref2 is not fully published yet, so it doesn't have a segment uri.
741
+ const ref2 = ManifestParser.makeReference(
742
+ '', segmentDataStartTime + 4, segmentDataStartTime + 6,
743
+ /* baseUri= */ '', /* startByte= */ 0, /* endByte= */ 209,
744
+ /* timestampOffset= */ 0, [partialRef]);
745
+
746
+ const manifest = await parser.start('test:/master', playerInterface);
747
+ const video = manifest.variants[0].video;
748
+ await video.createSegmentIndex();
749
+ ManifestParser.verifySegmentIndex(video, [ref1, ref2]);
750
+ });
751
+
700
752
  // Test for https://github.com/shaka-project/shaka-player/issues/4185
701
753
  it('does not fail on preload hints with LL mode off', async () => {
702
754
  // LL mode must be off for this test!
@@ -706,6 +758,7 @@ describe('HlsParser live', () => {
706
758
  '#EXTM3U\n',
707
759
  '#EXT-X-TARGETDURATION:5\n',
708
760
  '#EXT-X-MAP:URI="init.mp4",BYTERANGE="616@0"\n',
761
+ '#EXT-X-PART-INF:PART-TARGET=1.5\n',
709
762
  '#EXTINF:4,\n',
710
763
  'main.mp4\n',
711
764
  '#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,38 +0,0 @@
1
- ## Description
2
-
3
- <!--
4
- Give the PR a helpful title that summaries what this PR changes. Here, include
5
- a summary of the change and which issue is fixed. Also include relevant
6
- motivation and context. List any dependencies that are required for this
7
- change.
8
-
9
- If this fixes any issues, include lines like this:
10
- Fixes #123
11
- -->
12
-
13
-
14
- ## Screenshots (optional)
15
-
16
- <!--
17
- If you change the UI, add before and after screenshots demonstrating your
18
- changes.
19
- -->
20
-
21
-
22
- ## Type of change
23
-
24
- - [ ] Bug fix (non-breaking change which fixes an issue)
25
- - [ ] New feature (non-breaking change which adds functionality)
26
- - [ ] Breaking change (fix or feature that would cause existing functionality to
27
- not work as expected)
28
- - [ ] This change requires a documentation update
29
-
30
- ## Checklist:
31
-
32
- - [ ] I have signed the Google CLA <https://cla.developers.google.com>
33
- - [ ] My code follows the style guidelines of this project
34
- - [ ] I have made corresponding changes to the documentation
35
- - [ ] I have added tests that prove my fix is effective or that my feature works
36
- - [ ] I have verified my change on multiple browsers on different platforms
37
- - [ ] I have run `./build/all.py` and the build passes
38
- - [ ] I have run `./build/test.py` and all tests pass