shaka-player 4.7.9 → 4.7.11

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.
@@ -656,7 +656,7 @@ shaka.ads.AdManager = class extends shaka.util.FakeEventTarget {
656
656
  */
657
657
  getServerSideCuePoints() {
658
658
  shaka.Deprecate.deprecateFeature(5,
659
- 'AdManager',
659
+ 'AdManager.getServerSideCuePoints',
660
660
  'Please use getCuePoints function.');
661
661
  return this.getCuePoints();
662
662
  }
@@ -755,16 +755,10 @@ shaka.dash.TimelineSegmentIndex = class extends shaka.media.SegmentIndex {
755
755
 
756
756
  this.evict(this.periodStart_);
757
757
 
758
- if (timeline.length === 0) {
759
- return;
760
- }
761
-
762
- if (this.periodEnd_ !== Infinity) {
763
- // Adjust the last timeline entry to match the period end
764
- const lastTimePeriod = timeline[timeline.length - 1];
765
- // NOTE: end should be relative to period start
766
- lastTimePeriod.end = this.periodEnd_ - this.periodStart_;
767
- }
758
+ // Do NOT adjust last range to match period end! With high precision
759
+ // timestamps several recalculations may give wrong results on less precise
760
+ // platforms. To mitigate that, we're using cached |periodEnd_| value in
761
+ // find/get() methods whenever possible.
768
762
  }
769
763
 
770
764
  /**
@@ -784,7 +778,7 @@ shaka.dash.TimelineSegmentIndex = class extends shaka.media.SegmentIndex {
784
778
  const timeline = this.templateInfo_.timeline;
785
779
 
786
780
  // Early exit if the time isn't within this period
787
- if (time < this.periodStart_ || time > this.periodEnd_) {
781
+ if (time < this.periodStart_ || time >= this.periodEnd_) {
788
782
  return null;
789
783
  }
790
784
 
@@ -797,10 +791,14 @@ shaka.dash.TimelineSegmentIndex = class extends shaka.media.SegmentIndex {
797
791
  // the references by a fraction of a second. To account for this, we use
798
792
  // the start of the next segment as /end/, unless this is the last
799
793
  // reference, in which case we use the period end as the /end/
800
- let end = range.end + this.periodStart_;
794
+ let end;
801
795
 
802
796
  if (i < lastIndex) {
803
797
  end = timeline[i + 1].start + this.periodStart_;
798
+ } else if (this.periodEnd_ === Infinity) {
799
+ end = range.end + this.periodStart_;
800
+ } else {
801
+ end = this.periodEnd_;
804
802
  }
805
803
 
806
804
  if ((time >= start) && (time < end)) {
@@ -831,6 +829,12 @@ shaka.dash.TimelineSegmentIndex = class extends shaka.media.SegmentIndex {
831
829
  .unscaledPresentationTimeOffset + range.unscaledStart;
832
830
  const timestampOffset = this.periodStart_ -
833
831
  this.templateInfo_.scaledPresentationTimeOffset;
832
+ const trueSegmentEnd = this.periodStart_ + range.end;
833
+ let segmentEnd = trueSegmentEnd;
834
+ if (correctedPosition === this.getNumReferences() - 1 &&
835
+ this.periodEnd_ !== Infinity) {
836
+ segmentEnd = this.periodEnd_;
837
+ }
834
838
 
835
839
  const partialSegmentRefs = [];
836
840
 
@@ -901,7 +905,7 @@ shaka.dash.TimelineSegmentIndex = class extends shaka.media.SegmentIndex {
901
905
 
902
906
  ref = new shaka.media.SegmentReference(
903
907
  this.periodStart_ + range.start,
904
- this.periodStart_ + range.end,
908
+ segmentEnd,
905
909
  createUrisCb,
906
910
  /* startByte= */ 0,
907
911
  /* endByte= */ null,
@@ -916,6 +920,7 @@ shaka.dash.TimelineSegmentIndex = class extends shaka.media.SegmentIndex {
916
920
  shaka.media.SegmentReference.Status.AVAILABLE,
917
921
  this.aes128Key_,
918
922
  /* allPartialSegments= */ range.partialSegments > 0);
923
+ ref.trueEndTime = trueSegmentEnd;
919
924
  this.references[correctedPosition] = ref;
920
925
  }
921
926
 
@@ -107,7 +107,7 @@ shaka.Deprecate = class {
107
107
  libraryVersion,
108
108
  '. Additional information:',
109
109
  description,
110
- ].join('');
110
+ ].join(' ');
111
111
 
112
112
  shaka.log.alwaysError(errorMessage);
113
113
  goog.asserts.assert(false, errorMessage);
@@ -32,6 +32,7 @@ goog.require('shaka.util.FakeEvent');
32
32
  goog.require('shaka.util.LanguageUtils');
33
33
  goog.require('shaka.util.ManifestParserUtils');
34
34
  goog.require('shaka.util.MimeUtils');
35
+ goog.require('shaka.util.Networking');
35
36
  goog.require('shaka.util.OperationManager');
36
37
  goog.require('shaka.util.Pssh');
37
38
  goog.require('shaka.media.SegmentUtils');
@@ -909,8 +910,11 @@ shaka.hls.HlsParser = class {
909
910
  playlist, middleSegment.tags, getUris);
910
911
  this.mapTagToInitSegmentRefMap_.clear();
911
912
  if (initSegmentRef) {
912
- const initSegmentRequest = shaka.net.NetworkingEngine.makeRequest(
913
- initSegmentRef.getUris(), this.config_.retryParameters);
913
+ const initSegmentRequest = shaka.util.Networking.createSegmentRequest(
914
+ initSegmentRef.getUris(),
915
+ initSegmentRef.getStartByte(),
916
+ initSegmentRef.getEndByte(),
917
+ this.config_.retryParameters);
914
918
  const initType =
915
919
  shaka.net.NetworkingEngine.AdvancedRequestType.INIT_SEGMENT;
916
920
  const initResponse = await this.makeNetworkRequest_(
@@ -2839,12 +2843,12 @@ shaka.hls.HlsParser = class {
2839
2843
  // Don't download the key object until the segment is parsed, to avoid a
2840
2844
  // startup delay for long manifests with lots of keys.
2841
2845
  keyInfo.fetchKey = async () => {
2842
- const keyUri = shaka.hls.Utils.constructSegmentUris(
2846
+ const keyUris = shaka.hls.Utils.constructSegmentUris(
2843
2847
  getUris(), drmTag.getRequiredAttrValue('URI'), variables);
2844
2848
 
2845
2849
  const requestType = shaka.net.NetworkingEngine.RequestType.KEY;
2846
2850
  const request = shaka.net.NetworkingEngine.makeRequest(
2847
- [keyUri], this.config_.retryParameters);
2851
+ keyUris, this.config_.retryParameters);
2848
2852
  const keyResponse = await this.makeNetworkRequest_(request, requestType);
2849
2853
 
2850
2854
  // keyResponse.status is undefined when URI is "data:text/plain;base64,"
@@ -4130,7 +4134,22 @@ shaka.hls.HlsParser = class {
4130
4134
  * @return {?shaka.extern.DrmInfo}
4131
4135
  * @private
4132
4136
  */
4133
- static identityDrmParser_(drmTag) {
4137
+ static identityDrmParser_(drmTag, mimeType) {
4138
+ if (mimeType == 'video/mp2t') {
4139
+ throw new shaka.util.Error(
4140
+ shaka.util.Error.Severity.CRITICAL,
4141
+ shaka.util.Error.Category.MANIFEST,
4142
+ shaka.util.Error.Code.HLS_MSE_ENCRYPTED_MP2T_NOT_SUPPORTED);
4143
+ }
4144
+
4145
+ if (shaka.util.Platform.isMediaKeysPolyfilled()) {
4146
+ throw new shaka.util.Error(
4147
+ shaka.util.Error.Severity.CRITICAL,
4148
+ shaka.util.Error.Category.MANIFEST,
4149
+ shaka.util.Error.Code
4150
+ .HLS_MSE_ENCRYPTED_LEGACY_APPLE_MEDIA_KEYS_NOT_SUPPORTED);
4151
+ }
4152
+
4134
4153
  const method = drmTag.getRequiredAttrValue('METHOD');
4135
4154
  const VALID_METHODS = ['SAMPLE-AES', 'SAMPLE-AES-CTR'];
4136
4155
  if (!VALID_METHODS.includes(method)) {
@@ -28,7 +28,7 @@ shaka.media.ManifestParser = class {
28
28
  */
29
29
  static registerParserByExtension(extension, parserFactory) {
30
30
  shaka.Deprecate.deprecateFeature(5,
31
- 'ManifestParser',
31
+ 'ManifestParser.registerParserByExtension',
32
32
  'Please use an ManifestParser with registerParserByMime function.');
33
33
  }
34
34
 
@@ -125,7 +125,8 @@ shaka.media.ManifestParser = class {
125
125
  shaka.util.Error.Severity.CRITICAL,
126
126
  shaka.util.Error.Category.MANIFEST,
127
127
  shaka.util.Error.Code.UNABLE_TO_GUESS_MANIFEST_TYPE,
128
- uri);
128
+ uri,
129
+ mimeType);
129
130
  }
130
131
 
131
132
 
@@ -129,7 +129,10 @@ shaka.media.InitSegmentReference = class {
129
129
  static equal(reference1, reference2) {
130
130
  const ArrayUtils = shaka.util.ArrayUtils;
131
131
  const BufferUtils = shaka.util.BufferUtils;
132
- if (!reference1 || !reference2) {
132
+
133
+ if (reference1 === reference2) {
134
+ return true;
135
+ } else if (!reference1 || !reference2) {
133
136
  return reference1 == reference2;
134
137
  } else {
135
138
  return reference1.getStartByte() == reference2.getStartByte() &&
@@ -2163,8 +2163,8 @@ shaka.media.StreamingEngine = class {
2163
2163
  const bufferedBehind = presentationTime - startTime;
2164
2164
 
2165
2165
  const overflow = bufferedBehind - bufferBehind;
2166
- // See: https://github.com/shaka-project/shaka-player/issues/2982
2167
- if (overflow <= 0.01) {
2166
+ // See: https://github.com/shaka-project/shaka-player/issues/6240
2167
+ if (overflow <= 1) {
2168
2168
  shaka.log.v2(logPrefix,
2169
2169
  'buffer behind okay:',
2170
2170
  'presentationTime=' + presentationTime,
package/lib/player.js CHANGED
@@ -742,7 +742,7 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
742
742
  // player having been initialized.
743
743
  if (mediaElement) {
744
744
  shaka.Deprecate.deprecateFeature(5,
745
- 'Player',
745
+ 'Player w/ mediaElement',
746
746
  'Please migrate from initializing Player with a mediaElement; ' +
747
747
  'use the attach method instead.');
748
748
  this.attach(mediaElement, /* initializeMediaSource= */ true);
@@ -1858,19 +1858,19 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
1858
1858
  this.abrManager_ = abrFactory();
1859
1859
  if (typeof this.abrManager_.setMediaElement != 'function') {
1860
1860
  shaka.Deprecate.deprecateFeature(5,
1861
- 'AbrManager',
1861
+ 'AbrManager w/o setMediaElement',
1862
1862
  'Please use an AbrManager with setMediaElement function.');
1863
1863
  this.abrManager_.setMediaElement = () => {};
1864
1864
  }
1865
1865
  if (typeof this.abrManager_.setCmsdManager != 'function') {
1866
1866
  shaka.Deprecate.deprecateFeature(5,
1867
- 'AbrManager',
1867
+ 'AbrManager w/o setCmsdManager',
1868
1868
  'Please use an AbrManager with setCmsdManager function.');
1869
1869
  this.abrManager_.setCmsdManager = () => {};
1870
1870
  }
1871
1871
  if (typeof this.abrManager_.trySuggestStreams != 'function') {
1872
1872
  shaka.Deprecate.deprecateFeature(5,
1873
- 'AbrManager',
1873
+ 'AbrManager w/o trySuggestStreams',
1874
1874
  'Please use an AbrManager with trySuggestStreams function.');
1875
1875
  this.abrManager_.trySuggestStreams = () => {};
1876
1876
  }
@@ -6934,7 +6934,7 @@ shaka.Player.TYPICAL_BUFFERING_THRESHOLD_ = 0.5;
6934
6934
  * @export
6935
6935
  */
6936
6936
  // eslint-disable-next-line no-useless-concat
6937
- shaka.Player.version = 'v4.7.9' + '-uncompiled'; // x-release-please-version
6937
+ shaka.Player.version = 'v4.7.11' + '-uncompiled'; // x-release-please-version
6938
6938
 
6939
6939
  // Initialize the deprecation system using the version string we just set
6940
6940
  // on the player.
@@ -32,11 +32,12 @@ shaka.polyfill.MediaSource = class {
32
32
 
33
33
  if (!window.MediaSource) {
34
34
  shaka.log.info('No MSE implementation available.');
35
- } else if (window.cast && cast.__platform__ &&
36
- cast.__platform__.canDisplayType) {
35
+ } else if (shaka.util.Platform.isChromecast()) {
37
36
  shaka.log.info('Patching Chromecast MSE bugs.');
38
- // Chromecast cannot make accurate determinations via isTypeSupported.
39
- shaka.polyfill.MediaSource.patchCastIsTypeSupported_();
37
+ // Chromecast fails on some TS content, even though it is supposed to
38
+ // support it. Better to transmux.
39
+ // See https://github.com/shaka-project/shaka-player/issues/5278
40
+ shaka.polyfill.MediaSource.rejectContainer_('mp2t');
40
41
  } else if (safariVersion) {
41
42
  // NOTE: shaka.Player.isBrowserSupported() has its own restrictions on
42
43
  // Safari version.
@@ -182,38 +183,6 @@ shaka.polyfill.MediaSource = class {
182
183
  };
183
184
  }
184
185
 
185
- /**
186
- * Patch isTypeSupported() to chain to a private API on the Chromecast which
187
- * can query for support of detailed content parameters.
188
- *
189
- * @private
190
- */
191
- static patchCastIsTypeSupported_() {
192
- const originalIsTypeSupported = MediaSource.isTypeSupported;
193
-
194
- MediaSource.isTypeSupported = (mimeType) => {
195
- // Parse the basic MIME type from its parameters.
196
- const pieces = mimeType.split(/ *; */);
197
- pieces.shift(); // Remove basic MIME type from pieces.
198
-
199
- const hasCodecs = pieces.some((piece) => piece.startsWith('codecs='));
200
- if (!hasCodecs) {
201
- // Though the original reason for this special case was not documented,
202
- // it is presumed to be because the platform won't accept a MIME type
203
- // without codecs in canDisplayType. It is valid, however, in
204
- // isTypeSupported.
205
- return originalIsTypeSupported(mimeType);
206
- }
207
-
208
- // Only canDisplayType can check extended MIME type parameters on this
209
- // platform (such as frame rate, resolution, etc).
210
- // In previous versions of this polyfill, the MIME type parameters were
211
- // manipulated, filtered, or extended. This is no longer true, so we pass
212
- // the full MIME type to the platform as we received it.
213
- return cast.__platform__.canDisplayType(mimeType);
214
- };
215
- }
216
-
217
186
  /**
218
187
  * Patch isTypeSupported() to translate vp09 codec strings into vp9, to allow
219
188
  * such content to play on older smart TVs.
@@ -687,6 +687,8 @@ shaka.text.VttTextParser = class {
687
687
  refCue.fontFamily, cue.fontFamily);
688
688
  cue.fontSize = VttTextParser.getOrDefault_(
689
689
  refCue.fontSize, cue.fontSize);
690
+ cue.textShadow = VttTextParser.getOrDefault_(
691
+ refCue.textShadow, cue.textShadow);
690
692
 
691
693
  // Overwrite with new values as unable to determine
692
694
  // if new value is set or not
@@ -695,7 +697,6 @@ shaka.text.VttTextParser = class {
695
697
  cue.opacity = refCue.opacity;
696
698
  cue.rubyTag = refCue.rubyTag;
697
699
  cue.textCombineUpright = refCue.textCombineUpright;
698
- cue.textShadow = refCue.textShadow;
699
700
  cue.wrapLine = refCue.wrapLine;
700
701
  }
701
702
 
package/lib/util/error.js CHANGED
@@ -527,6 +527,7 @@ shaka.util.Error.Code = {
527
527
  * <li>Configure the server to accept a HEAD request for the manifest.
528
528
  * </ul>
529
529
  * <br> error.data[0] is the manifest URI.
530
+ * <br> error.data[1] is the detected or specified MIME type.
530
531
  */
531
532
  'UNABLE_TO_GUESS_MANIFEST_TYPE': 4000,
532
533
 
@@ -1215,7 +1215,18 @@ shaka.util.PeriodCombiner = class {
1215
1215
  return false;
1216
1216
  }
1217
1217
 
1218
- // If language-based differences haven't decided this, look at roles. If
1218
+ // If language-based differences haven't decided this, look at labels.
1219
+ // If available options differ, look does any matches with output stream.
1220
+ if (best.label !== candidate.label) {
1221
+ if (outputStream.label === best.label) {
1222
+ return false;
1223
+ }
1224
+ if (outputStream.label === candidate.label) {
1225
+ return true;
1226
+ }
1227
+ }
1228
+
1229
+ // If label-based differences haven't decided this, look at roles. If
1219
1230
  // the candidate has more roles in common with the output, upgrade to the
1220
1231
  // candidate.
1221
1232
  if (outputStream.roles.length) {
@@ -1410,6 +1421,17 @@ shaka.util.PeriodCombiner = class {
1410
1421
  return false;
1411
1422
  }
1412
1423
 
1424
+ // If language-based differences haven't decided this, look at labels.
1425
+ // If available options differ, look does any matches with output stream.
1426
+ if (best.label !== candidate.label) {
1427
+ if (outputStream.label === best.label) {
1428
+ return false;
1429
+ }
1430
+ if (outputStream.label === candidate.label) {
1431
+ return true;
1432
+ }
1433
+ }
1434
+
1413
1435
  // If the candidate has more roles in common with the output, upgrade to the
1414
1436
  // candidate.
1415
1437
  if (outputStream.roles.length) {
@@ -908,7 +908,7 @@ shaka.util.StreamUtils = class {
908
908
  // currently don't support 'fLaC', while 'flac' is supported by most
909
909
  // major browsers.
910
910
  // See https://bugs.chromium.org/p/chromium/issues/detail?id=1422728
911
- if (codecs === 'fLaC') {
911
+ if (codecs === 'fLaC' && !shaka.util.Platform.isSafari()) {
912
912
  return 'flac';
913
913
  }
914
914
 
@@ -433,7 +433,7 @@ shaka.util.TsParser = class {
433
433
  */
434
434
  parseAvcNalus(pes, nextPes) {
435
435
  shaka.Deprecate.deprecateFeature(5,
436
- 'TsParser',
436
+ 'TsParser.parseAvcNalus',
437
437
  'Please use parseNalus function instead.');
438
438
  return this.parseNalus(pes);
439
439
  }
@@ -769,7 +769,7 @@ shaka.util.TsParser = class {
769
769
  */
770
770
  getVideoResolution() {
771
771
  shaka.Deprecate.deprecateFeature(5,
772
- 'TsParser',
772
+ 'TsParser.getVideoResolution',
773
773
  'Please use getVideoInfo function instead.');
774
774
  const videoInfo = this.getVideoInfo();
775
775
  return {
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.7.9",
4
+ "version": "4.7.11",
5
5
  "homepage": "https://github.com/shaka-project/shaka-player",
6
6
  "author": "Google",
7
7
  "maintainers": [
@@ -43,13 +43,13 @@
43
43
  "karma-coverage": "^2.2.0",
44
44
  "karma-jasmine": "^4.0.1",
45
45
  "karma-jasmine-ajax": "^0.1.13",
46
- "karma-local-wd-launcher": "^1.6.6",
46
+ "karma-local-wd-launcher": "^1.6.7",
47
47
  "karma-opera-launcher": "^1.0.0",
48
48
  "karma-sourcemap-loader": "^0.3.8",
49
49
  "karma-spec-reporter": "^0.0.34",
50
50
  "karma-webdriver-launcher": "^1.0.8",
51
51
  "lcevc_dec.js": "^1.0.1",
52
- "less": "https://gitpkg.now.sh/joeyparrish/less.js/packages/less?28c63a43",
52
+ "less": "^4.2.0",
53
53
  "less-plugin-clean-css": "github:austingardner/less-plugin-clean-css#4e9e77bf",
54
54
  "material-design-lite": "^1.3.0",
55
55
  "open-sans-fonts": "^1.6.2",
@@ -24,6 +24,7 @@
24
24
  /* Set the fonts for all other content. */
25
25
  * {
26
26
  font-family: Roboto-Regular, Roboto, sans-serif, TengwarTelcontar;
27
+ -webkit-font-smoothing: antialiased;
27
28
  }
28
29
  }
29
30