shaka-player 4.2.4 → 4.3.0

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 (137) hide show
  1. package/.github/workflows/sync-labels.yaml +1 -1
  2. package/.github/workflows/update-issues.yaml +1 -1
  3. package/AUTHORS +4 -0
  4. package/CHANGELOG.md +85 -54
  5. package/CONTRIBUTORS +4 -0
  6. package/README.md +14 -0
  7. package/demo/common/assets.js +58 -0
  8. package/demo/common/message_ids.js +22 -1
  9. package/demo/config.js +89 -5
  10. package/demo/demo.less +7 -1
  11. package/demo/index.html +8 -1
  12. package/demo/locales/en.json +21 -1
  13. package/demo/locales/source.json +82 -2
  14. package/demo/main.js +57 -1
  15. package/demo/search.js +2 -0
  16. package/demo/visualizer.js +337 -0
  17. package/demo/visualizer_button.js +103 -0
  18. package/dist/controls.css +1 -1
  19. package/dist/controls.css.map +1 -1
  20. package/dist/demo.compiled.debug.js +83 -58
  21. package/dist/demo.compiled.debug.map +4 -4
  22. package/dist/demo.compiled.js +83 -58
  23. package/dist/demo.compiled.map +4 -4
  24. package/dist/demo.css +1 -1
  25. package/dist/demo.css.map +1 -1
  26. package/dist/deps.js +16 -9
  27. package/dist/locales.js +32 -32
  28. package/dist/receiver.compiled.debug.js +23 -19
  29. package/dist/receiver.compiled.debug.map +3 -3
  30. package/dist/receiver.compiled.js +23 -19
  31. package/dist/receiver.compiled.map +3 -3
  32. package/dist/shaka-player.compiled.d.ts +173 -26
  33. package/dist/shaka-player.compiled.debug.d.ts +173 -26
  34. package/dist/shaka-player.compiled.debug.externs.js +161 -31
  35. package/dist/shaka-player.compiled.debug.js +464 -401
  36. package/dist/shaka-player.compiled.debug.map +4 -4
  37. package/dist/shaka-player.compiled.externs.js +161 -31
  38. package/dist/shaka-player.compiled.js +897 -862
  39. package/dist/shaka-player.compiled.map +4 -4
  40. package/dist/shaka-player.ui.d.ts +173 -26
  41. package/dist/shaka-player.ui.debug.d.ts +173 -26
  42. package/dist/shaka-player.ui.debug.externs.js +161 -31
  43. package/dist/shaka-player.ui.debug.js +488 -422
  44. package/dist/shaka-player.ui.debug.map +4 -4
  45. package/dist/shaka-player.ui.externs.js +161 -31
  46. package/dist/shaka-player.ui.js +1053 -1018
  47. package/dist/shaka-player.ui.map +4 -4
  48. package/docs/design/lcevc-architecture.png +0 -0
  49. package/docs/design/lcevc-demo.png +0 -0
  50. package/docs/design/lcevc-integration.md +72 -0
  51. package/docs/tutorials/fairplay.md +7 -0
  52. package/docs/tutorials/faq.md +1 -1
  53. package/docs/tutorials/ui.md +7 -7
  54. package/docs/tutorials/upgrade.md +6 -0
  55. package/externs/ima.js +13 -1
  56. package/externs/lcevc.js +81 -0
  57. package/externs/mux.js +1 -42
  58. package/externs/shaka/ads.js +11 -1
  59. package/externs/shaka/manifest_parser.js +5 -1
  60. package/externs/shaka/player.js +178 -15
  61. package/lib/abr/simple_abr_manager.js +7 -0
  62. package/lib/ads/ad_manager.js +0 -8
  63. package/lib/ads/client_side_ad.js +15 -0
  64. package/lib/ads/client_side_ad_manager.js +21 -8
  65. package/lib/ads/server_side_ad.js +15 -0
  66. package/lib/ads/server_side_ad_manager.js +3 -3
  67. package/lib/cast/cast_utils.js +2 -0
  68. package/lib/cea/dummy_cea_parser.js +28 -0
  69. package/lib/cea/i_cea_parser.js +14 -2
  70. package/lib/cea/mp4_cea_parser.js +87 -5
  71. package/lib/config/auto_show_text.js +33 -0
  72. package/lib/dash/dash_parser.js +1 -1
  73. package/lib/hls/hls_parser.js +790 -374
  74. package/lib/lcevc/lcevc_dil.js +152 -0
  75. package/lib/media/closed_caption_parser.js +9 -6
  76. package/lib/media/drm_engine.js +14 -6
  77. package/lib/media/media_source_engine.js +106 -26
  78. package/lib/media/presentation_timeline.js +26 -11
  79. package/lib/media/segment_reference.js +49 -1
  80. package/lib/media/streaming_engine.js +142 -12
  81. package/lib/media/transmuxer.js +73 -18
  82. package/lib/offline/storage.js +1 -0
  83. package/lib/player.js +454 -75
  84. package/lib/polyfill/patchedmediakeys_apple.js +55 -1
  85. package/lib/text/ui_text_displayer.js +5 -5
  86. package/lib/text/vtt_text_parser.js +35 -1
  87. package/lib/util/dom_utils.js +0 -1
  88. package/lib/util/error.js +17 -0
  89. package/lib/util/fake_event.js +2 -0
  90. package/lib/util/id3_utils.js +300 -0
  91. package/lib/util/mime_utils.js +3 -6
  92. package/lib/util/mp4_box_parsers.js +15 -5
  93. package/lib/util/platform.js +9 -1
  94. package/lib/util/player_configuration.js +23 -1
  95. package/lib/util/ts_parser.js +499 -0
  96. package/maintained-branches.md +2 -2
  97. package/package.json +4 -1
  98. package/roadmap.md +5 -3
  99. package/test/ads/ad_manager_unit.js +180 -29
  100. package/test/cast/cast_utils_unit.js +3 -1
  101. package/test/dash/dash_parser_content_protection_unit.js +1 -0
  102. package/test/dash/dash_parser_live_unit.js +1 -0
  103. package/test/dash/dash_parser_manifest_unit.js +93 -1
  104. package/test/dash/dash_parser_segment_base_unit.js +1 -0
  105. package/test/dash/dash_parser_segment_list_unit.js +1 -0
  106. package/test/dash/dash_parser_segment_template_unit.js +1 -0
  107. package/test/demo/demo_unit.js +2 -1
  108. package/test/hls/hls_live_unit.js +253 -19
  109. package/test/hls/hls_parser_unit.js +500 -12
  110. package/test/media/closed_caption_parser_unit.js +2 -1
  111. package/test/media/drm_engine_integration.js +3 -1
  112. package/test/media/media_source_engine_integration.js +71 -6
  113. package/test/media/media_source_engine_unit.js +10 -5
  114. package/test/media/streaming_engine_integration.js +4 -1
  115. package/test/media/streaming_engine_unit.js +144 -1
  116. package/test/media/transmuxer_integration.js +21 -10
  117. package/test/player_integration.js +224 -82
  118. package/test/player_unit.js +5 -2
  119. package/test/polyfill/patchedmediakeys_apple_unit.js +124 -0
  120. package/test/test/assets/id3-metadata.aac +0 -0
  121. package/test/test/assets/id3-metadata.ts +0 -0
  122. package/test/test/assets/thumbnails-sprites.vtt +10 -0
  123. package/test/test/assets/thumbnails.vtt +10 -0
  124. package/test/test/util/dash_parser_util.js +2 -0
  125. package/test/test/util/fake_ad.js +21 -0
  126. package/test/test/util/fake_media_source_engine.js +7 -0
  127. package/test/test/util/id3_generator.js +100 -0
  128. package/test/test/util/manifest_generator.js +3 -6
  129. package/test/test/util/simple_fakes.js +4 -0
  130. package/test/test/util/stream_generator.js +38 -0
  131. package/test/test/util/test_scheme.js +43 -14
  132. package/test/text/vtt_text_parser_unit.js +11 -0
  133. package/test/ui/text_displayer_layout_unit.js +14 -0
  134. package/test/util/id3_utils_unit.js +116 -0
  135. package/test/util/ts_parser_unit.js +77 -0
  136. package/ui/less/containers.less +7 -0
  137. 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
@@ -1637,8 +1653,9 @@ shaka.media.InitSegmentReference = class {
1637
1653
  * segment extends to the end of the resource.
1638
1654
  * @param {null|shaka.extern.MediaQualityInfo=} mediaQuality Information about
1639
1655
  * the quality of the media associated with this init segment.
1656
+ * @param {number=} timescale
1640
1657
  */
1641
- constructor(uris, startByte, endByte, mediaQuality) {}
1658
+ constructor(uris, startByte, endByte, mediaQuality, timescale) {}
1642
1659
  /**
1643
1660
  * Returns the offset from the start of the resource to the
1644
1661
  * start of the segment.
@@ -1762,6 +1779,16 @@ shaka.media.SegmentReference = class {
1762
1779
  * Mark the reference as unavailable.
1763
1780
  */
1764
1781
  markAsUnavailable() {}
1782
+ /**
1783
+ * Set the segment's thumbnail sprite.
1784
+ * @param {shaka.media.SegmentReference.ThumbnailSprite} thumbnailSprite
1785
+ */
1786
+ setThumbnailSprite(thumbnailSprite) {}
1787
+ /**
1788
+ * Returns the segment's thumbnail sprite.
1789
+ * @return {?shaka.media.SegmentReference.ThumbnailSprite}
1790
+ */
1791
+ getThumbnailSprite() {}
1765
1792
  };
1766
1793
  /**
1767
1794
  * Rather than using booleans to communicate what the state of the reference,
@@ -1773,6 +1800,64 @@ shaka.media.SegmentReference.Status = {
1773
1800
  UNAVAILABLE: 1,
1774
1801
  MISSING: 2
1775
1802
  };
1803
+ /**
1804
+ * @typedef {{
1805
+ * height: number,
1806
+ * positionX: number,
1807
+ * positionY: number,
1808
+ * width: number
1809
+ * }}
1810
+ * @property {number} height
1811
+ * The thumbnail height in px.
1812
+ * @property {number} positionX
1813
+ * The thumbnail left position in px.
1814
+ * @property {number} positionY
1815
+ * The thumbnail top position in px.
1816
+ * @property {number} width
1817
+ * The thumbnail width in px.
1818
+ */
1819
+ shaka.media.SegmentReference.ThumbnailSprite;
1820
+ /**
1821
+ * @summary A set of Id3Utils utility functions.
1822
+ */
1823
+ shaka.util.Id3Utils = class {
1824
+ /**
1825
+ * Returns an array of ID3 frames found in all the ID3 tags in the id3Data
1826
+ * @param {Uint8Array} id3Data - The ID3 data containing one or more ID3 tags
1827
+ * @return {!Array.<shaka.extern.MetadataFrame>}
1828
+ */
1829
+ static getID3Frames(id3Data) {}
1830
+ };
1831
+ /**
1832
+ * @see https://en.wikipedia.org/wiki/MPEG_transport_stream
1833
+ */
1834
+ shaka.util.TsParser = class {
1835
+ /** */
1836
+ constructor() {}
1837
+ };
1838
+ /**
1839
+ * @summary
1840
+ * lcevcDil - (MPEG-5 Part 2 LCEVC - Decoder Integration Layer) provides
1841
+ * all the operations related to the enhancement and rendering
1842
+ * of LCEVC enabled streams and on to a canvas.
1843
+ * @implements {shaka.util.IReleasable}
1844
+ */
1845
+ shaka.lcevc.Dil = class {
1846
+ /**
1847
+ * @param {HTMLVideoElement} media The video element that will be attached to
1848
+ * LCEVC Dil for input.
1849
+ * @param {HTMLCanvasElement} canvas The canvas element that will be attached
1850
+ * to LCEVC Dil to render the enhanced frames.
1851
+ * @param {shaka.extern.LcevcConfiguration} dilConfig The LCEVC DIL
1852
+ * config object to initialize the LCEVC DIL.
1853
+ */
1854
+ constructor(media, canvas, dilConfig) {}
1855
+ /**
1856
+ * Close LCEVC Dil.
1857
+ * @override
1858
+ */
1859
+ release() {}
1860
+ };
1776
1861
  /**
1777
1862
  * PresentationTimeline.
1778
1863
  */
@@ -1797,6 +1882,12 @@ shaka.media.PresentationTimeline = class {
1797
1882
  * @return {number} The presentation's max segment duration in seconds.
1798
1883
  */
1799
1884
  getMaxSegmentDuration() {}
1885
+ /**
1886
+ * Sets the presentation's start time.
1887
+ * @param {number} presentationStartTime The wall-clock time, in seconds,
1888
+ * when the presentation started or will start. Only required for live.
1889
+ */
1890
+ setPresentationStartTime(presentationStartTime) {}
1800
1891
  /**
1801
1892
  * Sets the presentation's duration.
1802
1893
  * @param {number} duration The presentation's duration in seconds.
@@ -1838,10 +1929,10 @@ shaka.media.PresentationTimeline = class {
1838
1929
  */
1839
1930
  getDelay() {}
1840
1931
  /**
1841
- * Gives PresentationTimeline a Stream's segments so it can size and position
1932
+ * Gives PresentationTimeline an array of segments so it can size and position
1842
1933
  * 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).
1934
+ * information. These segments do not necessarily need to all be from the
1935
+ * same stream.
1845
1936
  * @param {!Array.<!shaka.media.SegmentReference>} references
1846
1937
  */
1847
1938
  notifySegments(references) {}
@@ -2344,6 +2435,12 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
2344
2435
  * @return {!Promise}
2345
2436
  */
2346
2437
  attach(mediaElement, initializeMediaSource) {}
2438
+ /**
2439
+ * Calling <code>attachCanvas</code> will tell the player to set canvas
2440
+ * element for LCEVC decoding.
2441
+ * @param {HTMLCanvasElement} canvas
2442
+ */
2443
+ attachCanvas(canvas) {}
2347
2444
  /**
2348
2445
  * Tell the player to stop using its current media element. If the player is:
2349
2446
  * <ul>
@@ -2658,12 +2755,13 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
2658
2755
  getTextLanguages() {}
2659
2756
  /**
2660
2757
  * Sets the current audio language and current variant role to the selected
2661
- * language and role, and chooses a new variant if need be. If the player has
2662
- * not loaded any content, this will be a no-op.
2758
+ * language, role and channel count, and chooses a new variant if need be.
2759
+ * If the player has not loaded any content, this will be a no-op.
2663
2760
  * @param {string} language
2664
2761
  * @param {string=} role
2762
+ * @param {number=} channelsCount
2665
2763
  */
2666
- selectAudioLanguage(language, role) {}
2764
+ selectAudioLanguage(language, role, channelsCount) {}
2667
2765
  /**
2668
2766
  * Sets the current text language and current text role to the selected
2669
2767
  * language and role, and chooses a new variant if need be. If the player has
@@ -2744,6 +2842,17 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
2744
2842
  * @return {!Promise.<shaka.extern.Track>}
2745
2843
  */
2746
2844
  addTextTrackAsync(uri, language, kind, mimeType, codec, label, forced) {}
2845
+ /**
2846
+ * Adds the given thumbnails track to the loaded manifest.
2847
+ * <code>load()</code> must resolve before calling. The presentation must
2848
+ * have a duration.
2849
+ * This returns the created track, which can immediately be used by the
2850
+ * application.
2851
+ * @param {string} uri
2852
+ * @param {string=} mimeType
2853
+ * @return {!Promise.<shaka.extern.Track>}
2854
+ */
2855
+ addThumbnailsTrack(uri, mimeType) {}
2747
2856
  /**
2748
2857
  * Adds the given chapters track to the loaded manifest. <code>load()</code>
2749
2858
  * must resolve before calling. The presentation must have a duration.
@@ -2902,6 +3011,14 @@ shaka.ads.ClientSideAd = class {
2902
3011
  * @override
2903
3012
  */
2904
3013
  getPositionInSequence() {}
3014
+ /**
3015
+ * @override
3016
+ */
3017
+ getTitle() {}
3018
+ /**
3019
+ * @override
3020
+ */
3021
+ getDescription() {}
2905
3022
  /**
2906
3023
  * @override
2907
3024
  */
@@ -2988,6 +3105,14 @@ shaka.ads.ServerSideAd = class {
2988
3105
  * @override
2989
3106
  */
2990
3107
  getPositionInSequence() {}
3108
+ /**
3109
+ * @override
3110
+ */
3111
+ getTitle() {}
3112
+ /**
3113
+ * @override
3114
+ */
3115
+ getDescription() {}
2991
3116
  /**
2992
3117
  * @override
2993
3118
  */
@@ -3742,8 +3867,13 @@ shaka.polyfill.Orientation = class {
3742
3867
  shaka.polyfill.PatchedMediaKeysApple = class {
3743
3868
  /**
3744
3869
  * Installs the polyfill if needed.
3870
+ * @param {boolean} enableUninstall enables uninstalling the polyfill
3745
3871
  */
3746
- static install() {}
3872
+ static install(enableUninstall) {}
3873
+ /**
3874
+ * Uninstalls the polyfill if needed and enabled.
3875
+ */
3876
+ static uninstall() {}
3747
3877
  };
3748
3878
  /**
3749
3879
  * @summary A polyfill to stub out