shaka-player 4.2.5 → 4.3.1

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 (143) hide show
  1. package/.github/workflows/build-and-test.yaml +7 -0
  2. package/.github/workflows/sync-labels.yaml +1 -1
  3. package/.github/workflows/update-issues.yaml +1 -1
  4. package/AUTHORS +4 -0
  5. package/CHANGELOG.md +114 -74
  6. package/CONTRIBUTORS +4 -0
  7. package/README.md +14 -0
  8. package/conditional/dummy_cast_proxy.js +120 -0
  9. package/demo/common/assets.js +58 -0
  10. package/demo/common/message_ids.js +22 -1
  11. package/demo/config.js +89 -5
  12. package/demo/demo.less +7 -1
  13. package/demo/index.html +8 -1
  14. package/demo/locales/en.json +21 -1
  15. package/demo/locales/source.json +82 -2
  16. package/demo/main.js +57 -1
  17. package/demo/search.js +2 -0
  18. package/demo/visualizer.js +337 -0
  19. package/demo/visualizer_button.js +103 -0
  20. package/dist/controls.css +1 -1
  21. package/dist/controls.css.map +1 -1
  22. package/dist/demo.compiled.debug.js +107 -88
  23. package/dist/demo.compiled.debug.map +4 -4
  24. package/dist/demo.compiled.js +107 -88
  25. package/dist/demo.compiled.map +4 -4
  26. package/dist/demo.css +1 -1
  27. package/dist/demo.css.map +1 -1
  28. package/dist/deps.js +21 -13
  29. package/dist/locales.js +31 -31
  30. package/dist/receiver.compiled.debug.js +75 -77
  31. package/dist/receiver.compiled.debug.map +3 -3
  32. package/dist/receiver.compiled.js +75 -77
  33. package/dist/receiver.compiled.map +3 -3
  34. package/dist/shaka-player.compiled.d.ts +181 -27
  35. package/dist/shaka-player.compiled.debug.d.ts +181 -27
  36. package/dist/shaka-player.compiled.debug.externs.js +169 -31
  37. package/dist/shaka-player.compiled.debug.js +510 -450
  38. package/dist/shaka-player.compiled.debug.map +4 -4
  39. package/dist/shaka-player.compiled.externs.js +169 -31
  40. package/dist/shaka-player.compiled.js +912 -874
  41. package/dist/shaka-player.compiled.map +4 -4
  42. package/dist/shaka-player.ui.d.ts +181 -27
  43. package/dist/shaka-player.ui.debug.d.ts +181 -27
  44. package/dist/shaka-player.ui.debug.externs.js +169 -31
  45. package/dist/shaka-player.ui.debug.js +533 -471
  46. package/dist/shaka-player.ui.debug.map +4 -4
  47. package/dist/shaka-player.ui.externs.js +169 -31
  48. package/dist/shaka-player.ui.js +1073 -1036
  49. package/dist/shaka-player.ui.map +4 -4
  50. package/docs/design/lcevc-architecture.png +0 -0
  51. package/docs/design/lcevc-demo.png +0 -0
  52. package/docs/design/lcevc-integration.md +72 -0
  53. package/docs/tutorials/fairplay.md +7 -0
  54. package/docs/tutorials/faq.md +1 -1
  55. package/docs/tutorials/ui.md +7 -7
  56. package/docs/tutorials/upgrade.md +6 -0
  57. package/externs/ima.js +13 -1
  58. package/externs/lcevc.js +81 -0
  59. package/externs/mux.js +1 -42
  60. package/externs/shaka/ads.js +11 -1
  61. package/externs/shaka/manifest_parser.js +5 -1
  62. package/externs/shaka/mp4_parser.js +3 -0
  63. package/externs/shaka/player.js +178 -15
  64. package/lib/abr/simple_abr_manager.js +7 -0
  65. package/lib/ads/ad_manager.js +0 -8
  66. package/lib/ads/client_side_ad.js +15 -0
  67. package/lib/ads/client_side_ad_manager.js +21 -8
  68. package/lib/ads/server_side_ad.js +15 -0
  69. package/lib/ads/server_side_ad_manager.js +3 -3
  70. package/lib/cast/cast_utils.js +2 -0
  71. package/lib/cea/dummy_cea_parser.js +28 -0
  72. package/lib/cea/i_cea_parser.js +14 -2
  73. package/lib/cea/mp4_cea_parser.js +108 -5
  74. package/lib/config/auto_show_text.js +33 -0
  75. package/lib/dash/dash_parser.js +1 -1
  76. package/lib/hls/hls_parser.js +808 -384
  77. package/lib/lcevc/lcevc_dil.js +152 -0
  78. package/lib/media/closed_caption_parser.js +9 -6
  79. package/lib/media/drm_engine.js +14 -6
  80. package/lib/media/media_source_capabilities.js +36 -0
  81. package/lib/media/media_source_engine.js +113 -28
  82. package/lib/media/presentation_timeline.js +26 -11
  83. package/lib/media/segment_reference.js +49 -1
  84. package/lib/media/streaming_engine.js +142 -12
  85. package/lib/media/transmuxer.js +78 -21
  86. package/lib/offline/storage.js +1 -0
  87. package/lib/player.js +456 -77
  88. package/lib/polyfill/media_capabilities.js +9 -5
  89. package/lib/polyfill/patchedmediakeys_apple.js +63 -4
  90. package/lib/text/vtt_text_parser.js +35 -1
  91. package/lib/util/dom_utils.js +0 -1
  92. package/lib/util/error.js +17 -0
  93. package/lib/util/fake_event.js +2 -0
  94. package/lib/util/id3_utils.js +300 -0
  95. package/lib/util/mime_utils.js +3 -6
  96. package/lib/util/mp4_box_parsers.js +39 -5
  97. package/lib/util/mp4_parser.js +35 -0
  98. package/lib/util/player_configuration.js +23 -1
  99. package/lib/util/stream_utils.js +5 -3
  100. package/lib/util/ts_parser.js +499 -0
  101. package/maintained-branches.md +2 -2
  102. package/package.json +7 -4
  103. package/roadmap.md +5 -3
  104. package/test/ads/ad_manager_unit.js +182 -29
  105. package/test/cast/cast_utils_unit.js +3 -1
  106. package/test/dash/dash_parser_content_protection_unit.js +1 -0
  107. package/test/dash/dash_parser_live_unit.js +1 -0
  108. package/test/dash/dash_parser_manifest_unit.js +93 -1
  109. package/test/dash/dash_parser_segment_base_unit.js +1 -0
  110. package/test/dash/dash_parser_segment_list_unit.js +1 -0
  111. package/test/dash/dash_parser_segment_template_unit.js +1 -0
  112. package/test/demo/demo_unit.js +2 -1
  113. package/test/hls/hls_live_unit.js +253 -19
  114. package/test/hls/hls_parser_unit.js +631 -12
  115. package/test/media/closed_caption_parser_unit.js +2 -1
  116. package/test/media/drm_engine_integration.js +3 -1
  117. package/test/media/media_source_engine_integration.js +71 -6
  118. package/test/media/media_source_engine_unit.js +10 -5
  119. package/test/media/streaming_engine_integration.js +4 -1
  120. package/test/media/streaming_engine_unit.js +144 -1
  121. package/test/media/transmuxer_integration.js +21 -10
  122. package/test/player_integration.js +224 -82
  123. package/test/player_unit.js +5 -2
  124. package/test/polyfill/media_capabilities_unit.js +21 -23
  125. package/test/polyfill/patchedmediakeys_apple_unit.js +130 -0
  126. package/test/test/assets/id3-metadata.aac +0 -0
  127. package/test/test/assets/id3-metadata.ts +0 -0
  128. package/test/test/assets/thumbnails-sprites.vtt +10 -0
  129. package/test/test/assets/thumbnails.vtt +10 -0
  130. package/test/test/util/dash_parser_util.js +2 -0
  131. package/test/test/util/fake_ad.js +21 -0
  132. package/test/test/util/fake_media_source_engine.js +7 -0
  133. package/test/test/util/id3_generator.js +100 -0
  134. package/test/test/util/manifest_generator.js +3 -6
  135. package/test/test/util/simple_fakes.js +4 -0
  136. package/test/test/util/stream_generator.js +38 -0
  137. package/test/test/util/test_scheme.js +43 -14
  138. package/test/text/vtt_text_parser_unit.js +11 -0
  139. package/test/util/id3_utils_unit.js +116 -0
  140. package/test/util/ts_parser_unit.js +77 -0
  141. package/third_party/closure-uri/uri.js +1 -1
  142. package/ui/less/containers.less +7 -0
  143. package/ui/ui.js +43 -4
@@ -20,10 +20,14 @@ shaka.ads = {};
20
20
  /** @const */
21
21
  shaka.cast = {};
22
22
  /** @const */
23
+ shaka.config = {};
24
+ /** @const */
23
25
  shaka.dash = {};
24
26
  /** @const */
25
27
  shaka.hls = {};
26
28
  /** @const */
29
+ shaka.lcevc = {};
30
+ /** @const */
27
31
  shaka.media = {};
28
32
  /** @const */
29
33
  shaka.net = {};
@@ -431,29 +435,6 @@ shaka.util.IDestroyable = class {
431
435
  */
432
436
  destroy() {}
433
437
  };
434
- /**
435
- */
436
- shaka.dependencies = class {
437
- /**
438
- * Registers a new dependency.
439
- * @param {shaka.dependencies.Allowed} key which is used for retrieving a
440
- * dependency
441
- * @param {?} dep a dependency
442
- */
443
- static add(key, dep) {}
444
- /**
445
- * Check if we have a dependency for the key.
446
- * @param {shaka.dependencies.Allowed} key key
447
- * @return {boolean}
448
- */
449
- static has(key) {}
450
- };
451
- /**
452
- * @enum {string}
453
- */
454
- shaka.dependencies.Allowed = {
455
- muxjs: 'muxjs'
456
- };
457
438
  /**
458
439
  * @summary
459
440
  * Describes an error that happened.
@@ -552,6 +533,8 @@ shaka.util.Error.Code = {
552
533
  'TEXT_ONLY_WEBVTT_SRC_EQUALS': 2013,
553
534
  'MISSING_TEXT_PLUGIN': 2014,
554
535
  'CHAPTERS_TRACK_FAILED': 2015,
536
+ 'CANNOT_ADD_EXTERNAL_THUMBNAILS_TO_SRC_EQUALS': 2016,
537
+ 'UNSUPPORTED_EXTERNAL_THUMBNAILS_URI': 2017,
555
538
  'BUFFER_READ_OUT_OF_BOUNDS': 3000,
556
539
  'JS_INTEGER_OVERFLOW': 3001,
557
540
  'EBML_OVERFLOW': 3002,
@@ -606,6 +589,7 @@ shaka.util.Error.Code = {
606
589
  'NO_WEB_CRYPTO_API': 4042,
607
590
  'HLS_AES_128_INVALID_IV_LENGTH': 4043,
608
591
  'HLS_AES_128_INVALID_KEY_LENGTH': 4044,
592
+ 'CANNOT_ADD_EXTERNAL_THUMBNAILS_TO_LIVE_STREAM': 4045,
609
593
  'STREAMING_ENGINE_STARTUP_INVALID_STATE': 5006,
610
594
  'NO_RECOGNIZED_KEY_SYSTEMS': 6000,
611
595
  'REQUESTED_KEY_SYSTEM_CONFIG_UNAVAILABLE': 6001,
@@ -787,6 +771,29 @@ shaka.util.Uint8ArrayUtils = class {
787
771
  */
788
772
  static concat(...varArgs) {}
789
773
  };
774
+ /**
775
+ */
776
+ shaka.dependencies = class {
777
+ /**
778
+ * Registers a new dependency.
779
+ * @param {shaka.dependencies.Allowed} key which is used for retrieving a
780
+ * dependency
781
+ * @param {?} dep a dependency
782
+ */
783
+ static add(key, dep) {}
784
+ /**
785
+ * Check if we have a dependency for the key.
786
+ * @param {shaka.dependencies.Allowed} key key
787
+ * @return {boolean}
788
+ */
789
+ static has(key) {}
790
+ };
791
+ /**
792
+ * @enum {string}
793
+ */
794
+ shaka.dependencies.Allowed = {
795
+ muxjs: 'muxjs'
796
+ };
790
797
  /**
791
798
  * @summary A set of utility functions for dealing with MIME types.
792
799
  */
@@ -1035,6 +1042,15 @@ shaka.abr.SimpleAbrManager = class {
1035
1042
  */
1036
1043
  configure(config) {}
1037
1044
  };
1045
+ /**
1046
+ * @enum {number}
1047
+ */
1048
+ shaka.config.AutoShowText = {
1049
+ 'NEVER': 0,
1050
+ 'ALWAYS': 1,
1051
+ 'IF_PREFERRED_TEXT_LANGUAGE': 2,
1052
+ 'IF_SUBTITLES_MAY_BE_NEEDED': 3
1053
+ };
1038
1054
  /**
1039
1055
  * A utility to wrap abortable operations. Note that these are not cancelable.
1040
1056
  * Cancelation implies undoing what has been done so far, whereas aborting only
@@ -1572,6 +1588,14 @@ shaka.util.Mp4Parser = class {
1572
1588
  * @param {!shaka.extern.ParsedBox} box
1573
1589
  */
1574
1590
  static sampleDescription(box) {}
1591
+ /**
1592
+ * A callback that tells the Mp4 parser to treat the body of a box as a visual
1593
+ * sample entry. A visual sample entry has some fixed-sized fields
1594
+ * describing the video codec parameters, followed by an arbitrary number of
1595
+ * appended children. Each child is a box.
1596
+ * @param {!shaka.extern.ParsedBox} box
1597
+ */
1598
+ static visualSampleEntry(box) {}
1575
1599
  /**
1576
1600
  * Create a callback that tells the Mp4 parser to treat the body of a box as a
1577
1601
  * binary blob and to parse the body's contents using the provided callback.
@@ -1637,8 +1661,9 @@ shaka.media.InitSegmentReference = class {
1637
1661
  * segment extends to the end of the resource.
1638
1662
  * @param {null|shaka.extern.MediaQualityInfo=} mediaQuality Information about
1639
1663
  * the quality of the media associated with this init segment.
1664
+ * @param {number=} timescale
1640
1665
  */
1641
- constructor(uris, startByte, endByte, mediaQuality) {}
1666
+ constructor(uris, startByte, endByte, mediaQuality, timescale) {}
1642
1667
  /**
1643
1668
  * Returns the offset from the start of the resource to the
1644
1669
  * start of the segment.
@@ -1762,6 +1787,16 @@ shaka.media.SegmentReference = class {
1762
1787
  * Mark the reference as unavailable.
1763
1788
  */
1764
1789
  markAsUnavailable() {}
1790
+ /**
1791
+ * Set the segment's thumbnail sprite.
1792
+ * @param {shaka.media.SegmentReference.ThumbnailSprite} thumbnailSprite
1793
+ */
1794
+ setThumbnailSprite(thumbnailSprite) {}
1795
+ /**
1796
+ * Returns the segment's thumbnail sprite.
1797
+ * @return {?shaka.media.SegmentReference.ThumbnailSprite}
1798
+ */
1799
+ getThumbnailSprite() {}
1765
1800
  };
1766
1801
  /**
1767
1802
  * Rather than using booleans to communicate what the state of the reference,
@@ -1773,6 +1808,64 @@ shaka.media.SegmentReference.Status = {
1773
1808
  UNAVAILABLE: 1,
1774
1809
  MISSING: 2
1775
1810
  };
1811
+ /**
1812
+ * @typedef {{
1813
+ * height: number,
1814
+ * positionX: number,
1815
+ * positionY: number,
1816
+ * width: number
1817
+ * }}
1818
+ * @property {number} height
1819
+ * The thumbnail height in px.
1820
+ * @property {number} positionX
1821
+ * The thumbnail left position in px.
1822
+ * @property {number} positionY
1823
+ * The thumbnail top position in px.
1824
+ * @property {number} width
1825
+ * The thumbnail width in px.
1826
+ */
1827
+ shaka.media.SegmentReference.ThumbnailSprite;
1828
+ /**
1829
+ * @summary A set of Id3Utils utility functions.
1830
+ */
1831
+ shaka.util.Id3Utils = class {
1832
+ /**
1833
+ * Returns an array of ID3 frames found in all the ID3 tags in the id3Data
1834
+ * @param {Uint8Array} id3Data - The ID3 data containing one or more ID3 tags
1835
+ * @return {!Array.<shaka.extern.MetadataFrame>}
1836
+ */
1837
+ static getID3Frames(id3Data) {}
1838
+ };
1839
+ /**
1840
+ * @see https://en.wikipedia.org/wiki/MPEG_transport_stream
1841
+ */
1842
+ shaka.util.TsParser = class {
1843
+ /** */
1844
+ constructor() {}
1845
+ };
1846
+ /**
1847
+ * @summary
1848
+ * lcevcDil - (MPEG-5 Part 2 LCEVC - Decoder Integration Layer) provides
1849
+ * all the operations related to the enhancement and rendering
1850
+ * of LCEVC enabled streams and on to a canvas.
1851
+ * @implements {shaka.util.IReleasable}
1852
+ */
1853
+ shaka.lcevc.Dil = class {
1854
+ /**
1855
+ * @param {HTMLVideoElement} media The video element that will be attached to
1856
+ * LCEVC Dil for input.
1857
+ * @param {HTMLCanvasElement} canvas The canvas element that will be attached
1858
+ * to LCEVC Dil to render the enhanced frames.
1859
+ * @param {shaka.extern.LcevcConfiguration} dilConfig The LCEVC DIL
1860
+ * config object to initialize the LCEVC DIL.
1861
+ */
1862
+ constructor(media, canvas, dilConfig) {}
1863
+ /**
1864
+ * Close LCEVC Dil.
1865
+ * @override
1866
+ */
1867
+ release() {}
1868
+ };
1776
1869
  /**
1777
1870
  * PresentationTimeline.
1778
1871
  */
@@ -1797,6 +1890,12 @@ shaka.media.PresentationTimeline = class {
1797
1890
  * @return {number} The presentation's max segment duration in seconds.
1798
1891
  */
1799
1892
  getMaxSegmentDuration() {}
1893
+ /**
1894
+ * Sets the presentation's start time.
1895
+ * @param {number} presentationStartTime The wall-clock time, in seconds,
1896
+ * when the presentation started or will start. Only required for live.
1897
+ */
1898
+ setPresentationStartTime(presentationStartTime) {}
1800
1899
  /**
1801
1900
  * Sets the presentation's duration.
1802
1901
  * @param {number} duration The presentation's duration in seconds.
@@ -1838,10 +1937,10 @@ shaka.media.PresentationTimeline = class {
1838
1937
  */
1839
1938
  getDelay() {}
1840
1939
  /**
1841
- * Gives PresentationTimeline a Stream's segments so it can size and position
1940
+ * Gives PresentationTimeline an array of segments so it can size and position
1842
1941
  * the segment availability window, and account for missing segment
1843
- * information. This function should be called once for each Stream (no more,
1844
- * no less).
1942
+ * information. These segments do not necessarily need to all be from the
1943
+ * same stream.
1845
1944
  * @param {!Array.<!shaka.media.SegmentReference>} references
1846
1945
  */
1847
1946
  notifySegments(references) {}
@@ -2423,6 +2522,12 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
2423
2522
  * @return {!Promise}
2424
2523
  */
2425
2524
  attach(mediaElement, initializeMediaSource) {}
2525
+ /**
2526
+ * Calling <code>attachCanvas</code> will tell the player to set canvas
2527
+ * element for LCEVC decoding.
2528
+ * @param {HTMLCanvasElement} canvas
2529
+ */
2530
+ attachCanvas(canvas) {}
2426
2531
  /**
2427
2532
  * Tell the player to stop using its current media element. If the player is:
2428
2533
  * <ul>
@@ -2737,12 +2842,13 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
2737
2842
  getTextLanguages() {}
2738
2843
  /**
2739
2844
  * Sets the current audio language and current variant role to the selected
2740
- * language and role, and chooses a new variant if need be. If the player has
2741
- * not loaded any content, this will be a no-op.
2845
+ * language, role and channel count, and chooses a new variant if need be.
2846
+ * If the player has not loaded any content, this will be a no-op.
2742
2847
  * @param {string} language
2743
2848
  * @param {string=} role
2849
+ * @param {number=} channelsCount
2744
2850
  */
2745
- selectAudioLanguage(language, role) {}
2851
+ selectAudioLanguage(language, role, channelsCount) {}
2746
2852
  /**
2747
2853
  * Sets the current text language and current text role to the selected
2748
2854
  * language and role, and chooses a new variant if need be. If the player has
@@ -2823,6 +2929,17 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
2823
2929
  * @return {!Promise.<shaka.extern.Track>}
2824
2930
  */
2825
2931
  addTextTrackAsync(uri, language, kind, mimeType, codec, label, forced) {}
2932
+ /**
2933
+ * Adds the given thumbnails track to the loaded manifest.
2934
+ * <code>load()</code> must resolve before calling. The presentation must
2935
+ * have a duration.
2936
+ * This returns the created track, which can immediately be used by the
2937
+ * application.
2938
+ * @param {string} uri
2939
+ * @param {string=} mimeType
2940
+ * @return {!Promise.<shaka.extern.Track>}
2941
+ */
2942
+ addThumbnailsTrack(uri, mimeType) {}
2826
2943
  /**
2827
2944
  * Adds the given chapters track to the loaded manifest. <code>load()</code>
2828
2945
  * must resolve before calling. The presentation must have a duration.
@@ -2981,6 +3098,14 @@ shaka.ads.ClientSideAd = class {
2981
3098
  * @override
2982
3099
  */
2983
3100
  getPositionInSequence() {}
3101
+ /**
3102
+ * @override
3103
+ */
3104
+ getTitle() {}
3105
+ /**
3106
+ * @override
3107
+ */
3108
+ getDescription() {}
2984
3109
  /**
2985
3110
  * @override
2986
3111
  */
@@ -3067,6 +3192,14 @@ shaka.ads.ServerSideAd = class {
3067
3192
  * @override
3068
3193
  */
3069
3194
  getPositionInSequence() {}
3195
+ /**
3196
+ * @override
3197
+ */
3198
+ getTitle() {}
3199
+ /**
3200
+ * @override
3201
+ */
3202
+ getDescription() {}
3070
3203
  /**
3071
3204
  * @override
3072
3205
  */
@@ -3835,8 +3968,13 @@ shaka.polyfill.Orientation = class {
3835
3968
  shaka.polyfill.PatchedMediaKeysApple = class {
3836
3969
  /**
3837
3970
  * Installs the polyfill if needed.
3971
+ * @param {boolean=} enableUninstall enables uninstalling the polyfill
3838
3972
  */
3839
- static install() {}
3973
+ static install(enableUninstall) {}
3974
+ /**
3975
+ * Uninstalls the polyfill if needed and enabled.
3976
+ */
3977
+ static uninstall() {}
3840
3978
  };
3841
3979
  /**
3842
3980
  * @summary A polyfill to stub out