shaka-player 4.13.0 → 4.13.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.
Files changed (67) hide show
  1. package/CONTRIBUTORS +1 -0
  2. package/dist/deps.js +4 -4
  3. package/dist/locales.js +36 -36
  4. package/dist/shaka-player.compiled.d.ts +1 -1
  5. package/dist/shaka-player.compiled.debug.d.ts +1 -1
  6. package/dist/shaka-player.compiled.debug.externs.js +2 -9
  7. package/dist/shaka-player.compiled.debug.js +491 -478
  8. package/dist/shaka-player.compiled.debug.map +4 -4
  9. package/dist/shaka-player.compiled.externs.js +2 -9
  10. package/dist/shaka-player.compiled.js +1455 -1443
  11. package/dist/shaka-player.compiled.map +4 -4
  12. package/dist/shaka-player.ui.d.ts +1 -1
  13. package/dist/shaka-player.ui.debug.d.ts +1 -1
  14. package/dist/shaka-player.ui.debug.externs.js +2 -9
  15. package/dist/shaka-player.ui.debug.js +544 -530
  16. package/dist/shaka-player.ui.debug.map +4 -4
  17. package/dist/shaka-player.ui.externs.js +2 -9
  18. package/dist/shaka-player.ui.js +1627 -1613
  19. package/dist/shaka-player.ui.map +4 -4
  20. package/eslint.config.mjs +14 -1
  21. package/lib/cast/cast_proxy.js +50 -12
  22. package/lib/cast/cast_receiver.js +6 -9
  23. package/lib/cast/cast_sender.js +14 -11
  24. package/lib/cast/cast_utils.js +43 -46
  25. package/lib/cea/mp4_cea_parser.js +23 -23
  26. package/lib/dash/content_protection.js +1 -1
  27. package/lib/dash/dash_parser.js +39 -29
  28. package/lib/dash/mpd_utils.js +8 -9
  29. package/lib/dash/segment_list.js +2 -2
  30. package/lib/dash/segment_template.js +9 -9
  31. package/lib/debug/log.js +16 -17
  32. package/lib/hls/hls_parser.js +122 -99
  33. package/lib/media/closed_caption_parser.js +5 -5
  34. package/lib/media/content_workarounds.js +78 -0
  35. package/lib/media/example_based_criteria.js +4 -3
  36. package/lib/media/manifest_parser.js +8 -12
  37. package/lib/media/media_source_engine.js +136 -119
  38. package/lib/media/preload_manager.js +10 -5
  39. package/lib/media/region_observer.js +9 -8
  40. package/lib/media/region_timeline.js +10 -8
  41. package/lib/media/streaming_engine.js +25 -9
  42. package/lib/mss/mss_parser.js +6 -7
  43. package/lib/net/http_plugin_utils.js +1 -1
  44. package/lib/net/networking_engine.js +7 -7
  45. package/lib/net/networking_utils.js +38 -39
  46. package/lib/offline/stream_bandwidth_estimator.js +8 -8
  47. package/lib/player.js +98 -47
  48. package/lib/polyfill/media_capabilities.js +8 -9
  49. package/lib/text/cue.js +6 -2
  50. package/lib/text/text_engine.js +7 -7
  51. package/lib/text/ttml_text_parser.js +14 -16
  52. package/lib/text/ui_text_displayer.js +25 -4
  53. package/lib/transmuxer/ac3_transmuxer.js +6 -1
  54. package/lib/transmuxer/transmuxer_engine.js +6 -6
  55. package/lib/util/manifest_parser_utils.js +7 -8
  56. package/lib/util/mp4_generator.js +23 -8
  57. package/lib/util/mp4_parser.js +10 -10
  58. package/lib/util/multi_map.js +22 -20
  59. package/lib/util/platform.js +40 -9
  60. package/lib/util/player_configuration.js +1 -1
  61. package/lib/util/stream_utils.js +35 -17
  62. package/package.json +2 -2
  63. package/project-words.txt +1 -0
  64. package/third_party/closure-uri/uri.js +13 -13
  65. package/ui/ad_statistics_button.js +17 -16
  66. package/ui/audio_language_selection.js +6 -1
  67. package/ui/statistics_button.js +36 -35
@@ -347,6 +347,52 @@ shaka.media.ContentWorkarounds = class {
347
347
  boxView.setUint32(ContentWorkarounds.BOX_SIZE_OFFSET_, newBoxSize);
348
348
  }
349
349
  }
350
+
351
+ /**
352
+ * Transform the init segment into a new init segment buffer that indicates
353
+ * EC-3 as audio codec instead of AC-3. Even though any EC-3 decoder should
354
+ * be able to decode AC-3 streams, there are platforms that do not accept
355
+ * AC-3 as codec.
356
+ *
357
+ * Should only be called for MP4 init segments, and only on platforms that
358
+ * need this workaround. Returns a new buffer containing the modified init
359
+ * segment.
360
+ *
361
+ * @param {!BufferSource} initSegmentBuffer
362
+ * @return {!Uint8Array}
363
+ */
364
+ static fakeEC3(initSegmentBuffer) {
365
+ const ContentWorkarounds = shaka.media.ContentWorkarounds;
366
+ const initSegment = shaka.util.BufferUtils.toUint8(initSegmentBuffer);
367
+ const ancestorBoxes = [];
368
+
369
+ const onSimpleAncestorBox = (box) => {
370
+ ancestorBoxes.push({start: box.start, size: box.size});
371
+ shaka.util.Mp4Parser.children(box);
372
+ };
373
+
374
+ new shaka.util.Mp4Parser()
375
+ .box('moov', onSimpleAncestorBox)
376
+ .box('trak', onSimpleAncestorBox)
377
+ .box('mdia', onSimpleAncestorBox)
378
+ .box('minf', onSimpleAncestorBox)
379
+ .box('stbl', onSimpleAncestorBox)
380
+ .box('stsd', (box) => {
381
+ ancestorBoxes.push({start: box.start, size: box.size});
382
+ const stsdBoxView = shaka.util.BufferUtils.toDataView(
383
+ initSegment, box.start);
384
+ for (let i=0; i<box.size; i++) {
385
+ const codecTag = stsdBoxView.getUint32(i);
386
+ if (codecTag == ContentWorkarounds.BOX_TYPE_AC_3_) {
387
+ stsdBoxView.setUint32(i, ContentWorkarounds.BOX_TYPE_EC_3_);
388
+ } else if (codecTag == ContentWorkarounds.BOX_TYPE_DAC3_) {
389
+ stsdBoxView.setUint32(i, ContentWorkarounds.BOX_TYPE_DEC3_);
390
+ }
391
+ }
392
+ }).parse(initSegment);
393
+
394
+ return initSegment;
395
+ }
350
396
  };
351
397
 
352
398
  /**
@@ -482,3 +528,35 @@ shaka.media.ContentWorkarounds.BOX_TYPE_ENCV_ = 0x656e6376;
482
528
  * @private
483
529
  */
484
530
  shaka.media.ContentWorkarounds.BOX_TYPE_ENCA_ = 0x656e6361;
531
+
532
+ /**
533
+ * Box type for "ac-3".
534
+ *
535
+ * @const {number}
536
+ * @private
537
+ */
538
+ shaka.media.ContentWorkarounds.BOX_TYPE_AC_3_ = 0x61632d33;
539
+
540
+ /**
541
+ * Box type for "dac3".
542
+ *
543
+ * @const {number}
544
+ * @private
545
+ */
546
+ shaka.media.ContentWorkarounds.BOX_TYPE_DAC3_ = 0x64616333;
547
+
548
+ /**
549
+ * Box type for "ec-3".
550
+ *
551
+ * @const {number}
552
+ * @private
553
+ */
554
+ shaka.media.ContentWorkarounds.BOX_TYPE_EC_3_ = 0x65632d33;
555
+
556
+ /**
557
+ * Box type for "dec3".
558
+ *
559
+ * @const {number}
560
+ * @private
561
+ */
562
+ shaka.media.ContentWorkarounds.BOX_TYPE_DEC3_ = 0x64656333;
@@ -22,10 +22,11 @@ shaka.media.ExampleBasedCriteria = class {
22
22
  * } adaptationSetCriteriaFactory
23
23
  */
24
24
  constructor(example, codecSwitchingStrategy, adaptationSetCriteriaFactory) {
25
- // We can't know if role and label are really important, so we don't use
26
- // role and label for this.
25
+ // We can't know if role and video label are really important, so we don't
26
+ // use role and video label for this.
27
27
  const role = '';
28
- const audioLabel = '';
28
+ const audioLabel = example.audio && example.audio.label ?
29
+ example.audio.label : '';
29
30
  const videoLabel = '';
30
31
  const hdrLevel = example.video && example.video.hdr ?
31
32
  example.video.hdr : '';
@@ -42,7 +42,7 @@ shaka.media.ManifestParser = class {
42
42
  * @export
43
43
  */
44
44
  static registerParserByMime(mimeType, parserFactory) {
45
- shaka.media.ManifestParser.parsersByMime[mimeType] = parserFactory;
45
+ shaka.media.ManifestParser.parsersByMime.set(mimeType, parserFactory);
46
46
  }
47
47
 
48
48
  /**
@@ -52,7 +52,7 @@ shaka.media.ManifestParser = class {
52
52
  * @export
53
53
  */
54
54
  static unregisterParserByMime(mimeType) {
55
- delete shaka.media.ManifestParser.parsersByMime[mimeType];
55
+ shaka.media.ManifestParser.parsersByMime.delete(mimeType);
56
56
  }
57
57
 
58
58
 
@@ -68,7 +68,7 @@ shaka.media.ManifestParser = class {
68
68
  // Make sure all registered parsers are shown, but only for MSE-enabled
69
69
  // platforms where our parsers matter.
70
70
  if (shaka.util.Platform.supportsMediaSource()) {
71
- for (const type in ManifestParser.parsersByMime) {
71
+ for (const type of ManifestParser.parsersByMime.keys()) {
72
72
  support[type] = true;
73
73
  }
74
74
  }
@@ -89,7 +89,7 @@ shaka.media.ManifestParser = class {
89
89
  // Only query our parsers for MSE-enabled platforms. Otherwise, query a
90
90
  // temporary media element for native support for these types.
91
91
  if (shaka.util.Platform.supportsMediaSource()) {
92
- support[type] = !!ManifestParser.parsersByMime[type];
92
+ support[type] = ManifestParser.parsersByMime.has(type);
93
93
  } else {
94
94
  support[type] = shaka.util.Platform.supportsMediaType(type);
95
95
  }
@@ -112,7 +112,7 @@ shaka.media.ManifestParser = class {
112
112
 
113
113
  // Try using the MIME type we were given.
114
114
  if (mimeType) {
115
- const factory = ManifestParser.parsersByMime[mimeType.toLowerCase()];
115
+ const factory = ManifestParser.parsersByMime.get(mimeType.toLowerCase());
116
116
  if (factory) {
117
117
  return factory;
118
118
  }
@@ -145,11 +145,7 @@ shaka.media.ManifestParser = class {
145
145
  return false;
146
146
  }
147
147
 
148
- if (mimeType in shaka.media.ManifestParser.parsersByMime) {
149
- return true;
150
- }
151
-
152
- return false;
148
+ return shaka.media.ManifestParser.parsersByMime.has(mimeType);
153
149
  }
154
150
  };
155
151
 
@@ -191,8 +187,8 @@ shaka.media.ManifestParser.AccessibilityPurpose = {
191
187
  /**
192
188
  * Contains the parser factory functions indexed by MIME type.
193
189
  *
194
- * @type {!Object<string, shaka.extern.ManifestParser.Factory>}
190
+ * @type {!Map<string, shaka.extern.ManifestParser.Factory>}
195
191
  */
196
- shaka.media.ManifestParser.parsersByMime = {};
192
+ shaka.media.ManifestParser.parsersByMime = new Map();
197
193
 
198
194