shaka-player 4.2.3 → 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 (147) hide show
  1. package/.github/workflows/sync-labels.yaml +1 -1
  2. package/.github/workflows/update-issues.yaml +1 -1
  3. package/AUTHORS +5 -0
  4. package/CHANGELOG.md +85 -39
  5. package/CONTRIBUTORS +5 -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 +18 -11
  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 +178 -27
  33. package/dist/shaka-player.compiled.debug.d.ts +178 -27
  34. package/dist/shaka-player.compiled.debug.externs.js +163 -32
  35. package/dist/shaka-player.compiled.debug.js +488 -422
  36. package/dist/shaka-player.compiled.debug.map +4 -4
  37. package/dist/shaka-player.compiled.externs.js +163 -32
  38. package/dist/shaka-player.compiled.js +895 -857
  39. package/dist/shaka-player.compiled.map +4 -4
  40. package/dist/shaka-player.ui.d.ts +178 -27
  41. package/dist/shaka-player.ui.debug.d.ts +178 -27
  42. package/dist/shaka-player.ui.debug.externs.js +163 -32
  43. package/dist/shaka-player.ui.debug.js +519 -450
  44. package/dist/shaka-player.ui.debug.map +4 -4
  45. package/dist/shaka-player.ui.externs.js +163 -32
  46. package/dist/shaka-player.ui.js +1053 -1015
  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 +4 -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_proxy.js +2 -1
  68. package/lib/cast/cast_receiver.js +19 -5
  69. package/lib/cast/cast_sender.js +2 -1
  70. package/lib/cast/cast_utils.js +18 -6
  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 +87 -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 +799 -376
  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_engine.js +112 -26
  81. package/lib/media/playhead.js +23 -1
  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 +145 -24
  85. package/lib/media/transmuxer.js +79 -18
  86. package/lib/offline/storage.js +1 -0
  87. package/lib/player.js +477 -85
  88. package/lib/polyfill/patchedmediakeys_apple.js +55 -1
  89. package/lib/text/ui_text_displayer.js +5 -5
  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/manifest_parser_utils.js +4 -0
  96. package/lib/util/mime_utils.js +3 -6
  97. package/lib/util/mp4_box_parsers.js +15 -5
  98. package/lib/util/platform.js +9 -1
  99. package/lib/util/player_configuration.js +23 -1
  100. package/lib/util/ts_parser.js +499 -0
  101. package/maintained-branches.md +2 -2
  102. package/package.json +4 -1
  103. package/roadmap.md +27 -7
  104. package/test/ads/ad_manager_unit.js +180 -29
  105. package/test/cast/cast_receiver_integration.js +97 -16
  106. package/test/cast/cast_receiver_unit.js +17 -12
  107. package/test/cast/cast_utils_unit.js +4 -1
  108. package/test/dash/dash_parser_content_protection_unit.js +1 -0
  109. package/test/dash/dash_parser_live_unit.js +1 -0
  110. package/test/dash/dash_parser_manifest_unit.js +93 -1
  111. package/test/dash/dash_parser_segment_base_unit.js +1 -0
  112. package/test/dash/dash_parser_segment_list_unit.js +1 -0
  113. package/test/dash/dash_parser_segment_template_unit.js +1 -0
  114. package/test/demo/demo_unit.js +2 -1
  115. package/test/hls/hls_live_unit.js +253 -19
  116. package/test/hls/hls_parser_unit.js +500 -12
  117. package/test/media/closed_caption_parser_unit.js +2 -1
  118. package/test/media/drm_engine_integration.js +3 -1
  119. package/test/media/media_source_engine_integration.js +102 -6
  120. package/test/media/media_source_engine_unit.js +10 -5
  121. package/test/media/playhead_unit.js +41 -0
  122. package/test/media/streaming_engine_integration.js +17 -1
  123. package/test/media/streaming_engine_unit.js +180 -24
  124. package/test/media/transmuxer_integration.js +21 -10
  125. package/test/player_integration.js +224 -82
  126. package/test/player_unit.js +92 -2
  127. package/test/polyfill/patchedmediakeys_apple_unit.js +124 -0
  128. package/test/test/assets/id3-metadata.aac +0 -0
  129. package/test/test/assets/id3-metadata.ts +0 -0
  130. package/test/test/assets/thumbnails-sprites.vtt +10 -0
  131. package/test/test/assets/thumbnails.vtt +10 -0
  132. package/test/test/util/dash_parser_util.js +2 -0
  133. package/test/test/util/fake_ad.js +21 -0
  134. package/test/test/util/fake_media_source_engine.js +7 -0
  135. package/test/test/util/id3_generator.js +100 -0
  136. package/test/test/util/manifest_generator.js +3 -6
  137. package/test/test/util/simple_fakes.js +7 -0
  138. package/test/test/util/stream_generator.js +38 -0
  139. package/test/test/util/test_scheme.js +43 -14
  140. package/test/text/vtt_text_parser_unit.js +11 -0
  141. package/test/ui/text_displayer_layout_unit.js +14 -0
  142. package/test/util/id3_utils_unit.js +116 -0
  143. package/test/util/ts_parser_unit.js +77 -0
  144. package/ui/controls.js +4 -1
  145. package/ui/less/containers.less +7 -0
  146. package/ui/settings_menu.js +11 -2
  147. 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 = {};
@@ -213,6 +217,8 @@ shaka.util.Error.Code = {
213
217
  'TEXT_ONLY_WEBVTT_SRC_EQUALS': 2013,
214
218
  'MISSING_TEXT_PLUGIN': 2014,
215
219
  'CHAPTERS_TRACK_FAILED': 2015,
220
+ 'CANNOT_ADD_EXTERNAL_THUMBNAILS_TO_SRC_EQUALS': 2016,
221
+ 'UNSUPPORTED_EXTERNAL_THUMBNAILS_URI': 2017,
216
222
  'BUFFER_READ_OUT_OF_BOUNDS': 3000,
217
223
  'JS_INTEGER_OVERFLOW': 3001,
218
224
  'EBML_OVERFLOW': 3002,
@@ -267,6 +273,7 @@ shaka.util.Error.Code = {
267
273
  'NO_WEB_CRYPTO_API': 4042,
268
274
  'HLS_AES_128_INVALID_IV_LENGTH': 4043,
269
275
  'HLS_AES_128_INVALID_KEY_LENGTH': 4044,
276
+ 'CANNOT_ADD_EXTERNAL_THUMBNAILS_TO_LIVE_STREAM': 4045,
270
277
  'STREAMING_ENGINE_STARTUP_INVALID_STATE': 5006,
271
278
  'NO_RECOGNIZED_KEY_SYSTEMS': 6000,
272
279
  'REQUESTED_KEY_SYSTEM_CONFIG_UNAVAILABLE': 6001,
@@ -960,29 +967,6 @@ shaka.util.IDestroyable = class {
960
967
  */
961
968
  destroy() {}
962
969
  };
963
- /**
964
- */
965
- shaka.dependencies = class {
966
- /**
967
- * Registers a new dependency.
968
- * @param {shaka.dependencies.Allowed} key which is used for retrieving a
969
- * dependency
970
- * @param {?} dep a dependency
971
- */
972
- static add(key, dep) {}
973
- /**
974
- * Check if we have a dependency for the key.
975
- * @param {shaka.dependencies.Allowed} key key
976
- * @return {boolean}
977
- */
978
- static has(key) {}
979
- };
980
- /**
981
- * @enum {string}
982
- */
983
- shaka.dependencies.Allowed = {
984
- muxjs: 'muxjs'
985
- };
986
970
  /**
987
971
  * A timer allows a single function to be executed at a later time or at
988
972
  * regular intervals.
@@ -1114,6 +1098,29 @@ shaka.util.Uint8ArrayUtils = class {
1114
1098
  */
1115
1099
  static concat(...varArgs) {}
1116
1100
  };
1101
+ /**
1102
+ */
1103
+ shaka.dependencies = class {
1104
+ /**
1105
+ * Registers a new dependency.
1106
+ * @param {shaka.dependencies.Allowed} key which is used for retrieving a
1107
+ * dependency
1108
+ * @param {?} dep a dependency
1109
+ */
1110
+ static add(key, dep) {}
1111
+ /**
1112
+ * Check if we have a dependency for the key.
1113
+ * @param {shaka.dependencies.Allowed} key key
1114
+ * @return {boolean}
1115
+ */
1116
+ static has(key) {}
1117
+ };
1118
+ /**
1119
+ * @enum {string}
1120
+ */
1121
+ shaka.dependencies.Allowed = {
1122
+ muxjs: 'muxjs'
1123
+ };
1117
1124
  /**
1118
1125
  * @summary A set of utility functions for dealing with MIME types.
1119
1126
  */
@@ -1219,6 +1226,15 @@ shaka.abr.SimpleAbrManager = class {
1219
1226
  */
1220
1227
  configure(config) {}
1221
1228
  };
1229
+ /**
1230
+ * @enum {number}
1231
+ */
1232
+ shaka.config.AutoShowText = {
1233
+ 'NEVER': 0,
1234
+ 'ALWAYS': 1,
1235
+ 'IF_PREFERRED_TEXT_LANGUAGE': 2,
1236
+ 'IF_SUBTITLES_MAY_BE_NEEDED': 3
1237
+ };
1222
1238
  /**
1223
1239
  * A utility to wrap abortable operations. Note that these are not cancelable.
1224
1240
  * Cancelation implies undoing what has been done so far, whereas aborting only
@@ -1744,8 +1760,9 @@ shaka.media.InitSegmentReference = class {
1744
1760
  * segment extends to the end of the resource.
1745
1761
  * @param {null|shaka.extern.MediaQualityInfo=} mediaQuality Information about
1746
1762
  * the quality of the media associated with this init segment.
1763
+ * @param {number=} timescale
1747
1764
  */
1748
- constructor(uris, startByte, endByte, mediaQuality) {}
1765
+ constructor(uris, startByte, endByte, mediaQuality, timescale) {}
1749
1766
  /**
1750
1767
  * Returns the offset from the start of the resource to the
1751
1768
  * start of the segment.
@@ -1869,6 +1886,16 @@ shaka.media.SegmentReference = class {
1869
1886
  * Mark the reference as unavailable.
1870
1887
  */
1871
1888
  markAsUnavailable() {}
1889
+ /**
1890
+ * Set the segment's thumbnail sprite.
1891
+ * @param {shaka.media.SegmentReference.ThumbnailSprite} thumbnailSprite
1892
+ */
1893
+ setThumbnailSprite(thumbnailSprite) {}
1894
+ /**
1895
+ * Returns the segment's thumbnail sprite.
1896
+ * @return {?shaka.media.SegmentReference.ThumbnailSprite}
1897
+ */
1898
+ getThumbnailSprite() {}
1872
1899
  };
1873
1900
  /**
1874
1901
  * Rather than using booleans to communicate what the state of the reference,
@@ -1880,6 +1907,64 @@ shaka.media.SegmentReference.Status = {
1880
1907
  UNAVAILABLE: 1,
1881
1908
  MISSING: 2
1882
1909
  };
1910
+ /**
1911
+ * @typedef {{
1912
+ * height: number,
1913
+ * positionX: number,
1914
+ * positionY: number,
1915
+ * width: number
1916
+ * }}
1917
+ * @property {number} height
1918
+ * The thumbnail height in px.
1919
+ * @property {number} positionX
1920
+ * The thumbnail left position in px.
1921
+ * @property {number} positionY
1922
+ * The thumbnail top position in px.
1923
+ * @property {number} width
1924
+ * The thumbnail width in px.
1925
+ */
1926
+ shaka.media.SegmentReference.ThumbnailSprite;
1927
+ /**
1928
+ * @summary A set of Id3Utils utility functions.
1929
+ */
1930
+ shaka.util.Id3Utils = class {
1931
+ /**
1932
+ * Returns an array of ID3 frames found in all the ID3 tags in the id3Data
1933
+ * @param {Uint8Array} id3Data - The ID3 data containing one or more ID3 tags
1934
+ * @return {!Array.<shaka.extern.MetadataFrame>}
1935
+ */
1936
+ static getID3Frames(id3Data) {}
1937
+ };
1938
+ /**
1939
+ * @see https://en.wikipedia.org/wiki/MPEG_transport_stream
1940
+ */
1941
+ shaka.util.TsParser = class {
1942
+ /** */
1943
+ constructor() {}
1944
+ };
1945
+ /**
1946
+ * @summary
1947
+ * lcevcDil - (MPEG-5 Part 2 LCEVC - Decoder Integration Layer) provides
1948
+ * all the operations related to the enhancement and rendering
1949
+ * of LCEVC enabled streams and on to a canvas.
1950
+ * @implements {shaka.util.IReleasable}
1951
+ */
1952
+ shaka.lcevc.Dil = class {
1953
+ /**
1954
+ * @param {HTMLVideoElement} media The video element that will be attached to
1955
+ * LCEVC Dil for input.
1956
+ * @param {HTMLCanvasElement} canvas The canvas element that will be attached
1957
+ * to LCEVC Dil to render the enhanced frames.
1958
+ * @param {shaka.extern.LcevcConfiguration} dilConfig The LCEVC DIL
1959
+ * config object to initialize the LCEVC DIL.
1960
+ */
1961
+ constructor(media, canvas, dilConfig) {}
1962
+ /**
1963
+ * Close LCEVC Dil.
1964
+ * @override
1965
+ */
1966
+ release() {}
1967
+ };
1883
1968
  /**
1884
1969
  * PresentationTimeline.
1885
1970
  */
@@ -1904,6 +1989,12 @@ shaka.media.PresentationTimeline = class {
1904
1989
  * @return {number} The presentation's max segment duration in seconds.
1905
1990
  */
1906
1991
  getMaxSegmentDuration() {}
1992
+ /**
1993
+ * Sets the presentation's start time.
1994
+ * @param {number} presentationStartTime The wall-clock time, in seconds,
1995
+ * when the presentation started or will start. Only required for live.
1996
+ */
1997
+ setPresentationStartTime(presentationStartTime) {}
1907
1998
  /**
1908
1999
  * Sets the presentation's duration.
1909
2000
  * @param {number} duration The presentation's duration in seconds.
@@ -1945,10 +2036,10 @@ shaka.media.PresentationTimeline = class {
1945
2036
  */
1946
2037
  getDelay() {}
1947
2038
  /**
1948
- * Gives PresentationTimeline a Stream's segments so it can size and position
2039
+ * Gives PresentationTimeline an array of segments so it can size and position
1949
2040
  * the segment availability window, and account for missing segment
1950
- * information. This function should be called once for each Stream (no more,
1951
- * no less).
2041
+ * information. These segments do not necessarily need to all be from the
2042
+ * same stream.
1952
2043
  * @param {!Array.<!shaka.media.SegmentReference>} references
1953
2044
  */
1954
2045
  notifySegments(references) {}
@@ -2451,6 +2542,12 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
2451
2542
  * @return {!Promise}
2452
2543
  */
2453
2544
  attach(mediaElement, initializeMediaSource) {}
2545
+ /**
2546
+ * Calling <code>attachCanvas</code> will tell the player to set canvas
2547
+ * element for LCEVC decoding.
2548
+ * @param {HTMLCanvasElement} canvas
2549
+ */
2550
+ attachCanvas(canvas) {}
2454
2551
  /**
2455
2552
  * Tell the player to stop using its current media element. If the player is:
2456
2553
  * <ul>
@@ -2765,12 +2862,13 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
2765
2862
  getTextLanguages() {}
2766
2863
  /**
2767
2864
  * Sets the current audio language and current variant role to the selected
2768
- * language and role, and chooses a new variant if need be. If the player has
2769
- * not loaded any content, this will be a no-op.
2865
+ * language, role and channel count, and chooses a new variant if need be.
2866
+ * If the player has not loaded any content, this will be a no-op.
2770
2867
  * @param {string} language
2771
2868
  * @param {string=} role
2869
+ * @param {number=} channelsCount
2772
2870
  */
2773
- selectAudioLanguage(language, role) {}
2871
+ selectAudioLanguage(language, role, channelsCount) {}
2774
2872
  /**
2775
2873
  * Sets the current text language and current text role to the selected
2776
2874
  * language and role, and chooses a new variant if need be. If the player has
@@ -2851,6 +2949,17 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
2851
2949
  * @return {!Promise.<shaka.extern.Track>}
2852
2950
  */
2853
2951
  addTextTrackAsync(uri, language, kind, mimeType, codec, label, forced) {}
2952
+ /**
2953
+ * Adds the given thumbnails track to the loaded manifest.
2954
+ * <code>load()</code> must resolve before calling. The presentation must
2955
+ * have a duration.
2956
+ * This returns the created track, which can immediately be used by the
2957
+ * application.
2958
+ * @param {string} uri
2959
+ * @param {string=} mimeType
2960
+ * @return {!Promise.<shaka.extern.Track>}
2961
+ */
2962
+ addThumbnailsTrack(uri, mimeType) {}
2854
2963
  /**
2855
2964
  * Adds the given chapters track to the loaded manifest. <code>load()</code>
2856
2965
  * must resolve before calling. The presentation must have a duration.
@@ -2879,9 +2988,10 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
2879
2988
  * <p>
2880
2989
  * If the player has loaded content, and streaming seen an error, but the
2881
2990
  * could not resume streaming, this will return <code>false</code>.
2991
+ * @param {number=} retryDelaySeconds
2882
2992
  * @return {boolean}
2883
2993
  */
2884
- retryStreaming() {}
2994
+ retryStreaming(retryDelaySeconds) {}
2885
2995
  /**
2886
2996
  * Get the manifest that the player has loaded. If the player has not loaded
2887
2997
  * any content, this will return <code>null</code>.
@@ -3008,6 +3118,14 @@ shaka.ads.ClientSideAd = class {
3008
3118
  * @override
3009
3119
  */
3010
3120
  getPositionInSequence() {}
3121
+ /**
3122
+ * @override
3123
+ */
3124
+ getTitle() {}
3125
+ /**
3126
+ * @override
3127
+ */
3128
+ getDescription() {}
3011
3129
  /**
3012
3130
  * @override
3013
3131
  */
@@ -3094,6 +3212,14 @@ shaka.ads.ServerSideAd = class {
3094
3212
  * @override
3095
3213
  */
3096
3214
  getPositionInSequence() {}
3215
+ /**
3216
+ * @override
3217
+ */
3218
+ getTitle() {}
3219
+ /**
3220
+ * @override
3221
+ */
3222
+ getDescription() {}
3097
3223
  /**
3098
3224
  * @override
3099
3225
  */
@@ -3848,8 +3974,13 @@ shaka.polyfill.Orientation = class {
3848
3974
  shaka.polyfill.PatchedMediaKeysApple = class {
3849
3975
  /**
3850
3976
  * Installs the polyfill if needed.
3977
+ * @param {boolean} enableUninstall enables uninstalling the polyfill
3851
3978
  */
3852
- static install() {}
3979
+ static install(enableUninstall) {}
3980
+ /**
3981
+ * Uninstalls the polyfill if needed and enabled.
3982
+ */
3983
+ static uninstall() {}
3853
3984
  };
3854
3985
  /**
3855
3986
  * @summary A polyfill to stub out