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 = {};
@@ -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
@@ -1679,6 +1695,14 @@ shaka.util.Mp4Parser = class {
1679
1695
  * @param {!shaka.extern.ParsedBox} box
1680
1696
  */
1681
1697
  static sampleDescription(box) {}
1698
+ /**
1699
+ * A callback that tells the Mp4 parser to treat the body of a box as a visual
1700
+ * sample entry. A visual sample entry has some fixed-sized fields
1701
+ * describing the video codec parameters, followed by an arbitrary number of
1702
+ * appended children. Each child is a box.
1703
+ * @param {!shaka.extern.ParsedBox} box
1704
+ */
1705
+ static visualSampleEntry(box) {}
1682
1706
  /**
1683
1707
  * Create a callback that tells the Mp4 parser to treat the body of a box as a
1684
1708
  * binary blob and to parse the body's contents using the provided callback.
@@ -1744,8 +1768,9 @@ shaka.media.InitSegmentReference = class {
1744
1768
  * segment extends to the end of the resource.
1745
1769
  * @param {null|shaka.extern.MediaQualityInfo=} mediaQuality Information about
1746
1770
  * the quality of the media associated with this init segment.
1771
+ * @param {number=} timescale
1747
1772
  */
1748
- constructor(uris, startByte, endByte, mediaQuality) {}
1773
+ constructor(uris, startByte, endByte, mediaQuality, timescale) {}
1749
1774
  /**
1750
1775
  * Returns the offset from the start of the resource to the
1751
1776
  * start of the segment.
@@ -1869,6 +1894,16 @@ shaka.media.SegmentReference = class {
1869
1894
  * Mark the reference as unavailable.
1870
1895
  */
1871
1896
  markAsUnavailable() {}
1897
+ /**
1898
+ * Set the segment's thumbnail sprite.
1899
+ * @param {shaka.media.SegmentReference.ThumbnailSprite} thumbnailSprite
1900
+ */
1901
+ setThumbnailSprite(thumbnailSprite) {}
1902
+ /**
1903
+ * Returns the segment's thumbnail sprite.
1904
+ * @return {?shaka.media.SegmentReference.ThumbnailSprite}
1905
+ */
1906
+ getThumbnailSprite() {}
1872
1907
  };
1873
1908
  /**
1874
1909
  * Rather than using booleans to communicate what the state of the reference,
@@ -1880,6 +1915,64 @@ shaka.media.SegmentReference.Status = {
1880
1915
  UNAVAILABLE: 1,
1881
1916
  MISSING: 2
1882
1917
  };
1918
+ /**
1919
+ * @typedef {{
1920
+ * height: number,
1921
+ * positionX: number,
1922
+ * positionY: number,
1923
+ * width: number
1924
+ * }}
1925
+ * @property {number} height
1926
+ * The thumbnail height in px.
1927
+ * @property {number} positionX
1928
+ * The thumbnail left position in px.
1929
+ * @property {number} positionY
1930
+ * The thumbnail top position in px.
1931
+ * @property {number} width
1932
+ * The thumbnail width in px.
1933
+ */
1934
+ shaka.media.SegmentReference.ThumbnailSprite;
1935
+ /**
1936
+ * @summary A set of Id3Utils utility functions.
1937
+ */
1938
+ shaka.util.Id3Utils = class {
1939
+ /**
1940
+ * Returns an array of ID3 frames found in all the ID3 tags in the id3Data
1941
+ * @param {Uint8Array} id3Data - The ID3 data containing one or more ID3 tags
1942
+ * @return {!Array.<shaka.extern.MetadataFrame>}
1943
+ */
1944
+ static getID3Frames(id3Data) {}
1945
+ };
1946
+ /**
1947
+ * @see https://en.wikipedia.org/wiki/MPEG_transport_stream
1948
+ */
1949
+ shaka.util.TsParser = class {
1950
+ /** */
1951
+ constructor() {}
1952
+ };
1953
+ /**
1954
+ * @summary
1955
+ * lcevcDil - (MPEG-5 Part 2 LCEVC - Decoder Integration Layer) provides
1956
+ * all the operations related to the enhancement and rendering
1957
+ * of LCEVC enabled streams and on to a canvas.
1958
+ * @implements {shaka.util.IReleasable}
1959
+ */
1960
+ shaka.lcevc.Dil = class {
1961
+ /**
1962
+ * @param {HTMLVideoElement} media The video element that will be attached to
1963
+ * LCEVC Dil for input.
1964
+ * @param {HTMLCanvasElement} canvas The canvas element that will be attached
1965
+ * to LCEVC Dil to render the enhanced frames.
1966
+ * @param {shaka.extern.LcevcConfiguration} dilConfig The LCEVC DIL
1967
+ * config object to initialize the LCEVC DIL.
1968
+ */
1969
+ constructor(media, canvas, dilConfig) {}
1970
+ /**
1971
+ * Close LCEVC Dil.
1972
+ * @override
1973
+ */
1974
+ release() {}
1975
+ };
1883
1976
  /**
1884
1977
  * PresentationTimeline.
1885
1978
  */
@@ -1904,6 +1997,12 @@ shaka.media.PresentationTimeline = class {
1904
1997
  * @return {number} The presentation's max segment duration in seconds.
1905
1998
  */
1906
1999
  getMaxSegmentDuration() {}
2000
+ /**
2001
+ * Sets the presentation's start time.
2002
+ * @param {number} presentationStartTime The wall-clock time, in seconds,
2003
+ * when the presentation started or will start. Only required for live.
2004
+ */
2005
+ setPresentationStartTime(presentationStartTime) {}
1907
2006
  /**
1908
2007
  * Sets the presentation's duration.
1909
2008
  * @param {number} duration The presentation's duration in seconds.
@@ -1945,10 +2044,10 @@ shaka.media.PresentationTimeline = class {
1945
2044
  */
1946
2045
  getDelay() {}
1947
2046
  /**
1948
- * Gives PresentationTimeline a Stream's segments so it can size and position
2047
+ * Gives PresentationTimeline an array of segments so it can size and position
1949
2048
  * 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).
2049
+ * information. These segments do not necessarily need to all be from the
2050
+ * same stream.
1952
2051
  * @param {!Array.<!shaka.media.SegmentReference>} references
1953
2052
  */
1954
2053
  notifySegments(references) {}
@@ -2530,6 +2629,12 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
2530
2629
  * @return {!Promise}
2531
2630
  */
2532
2631
  attach(mediaElement, initializeMediaSource) {}
2632
+ /**
2633
+ * Calling <code>attachCanvas</code> will tell the player to set canvas
2634
+ * element for LCEVC decoding.
2635
+ * @param {HTMLCanvasElement} canvas
2636
+ */
2637
+ attachCanvas(canvas) {}
2533
2638
  /**
2534
2639
  * Tell the player to stop using its current media element. If the player is:
2535
2640
  * <ul>
@@ -2844,12 +2949,13 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
2844
2949
  getTextLanguages() {}
2845
2950
  /**
2846
2951
  * Sets the current audio language and current variant role to the selected
2847
- * language and role, and chooses a new variant if need be. If the player has
2848
- * not loaded any content, this will be a no-op.
2952
+ * language, role and channel count, and chooses a new variant if need be.
2953
+ * If the player has not loaded any content, this will be a no-op.
2849
2954
  * @param {string} language
2850
2955
  * @param {string=} role
2956
+ * @param {number=} channelsCount
2851
2957
  */
2852
- selectAudioLanguage(language, role) {}
2958
+ selectAudioLanguage(language, role, channelsCount) {}
2853
2959
  /**
2854
2960
  * Sets the current text language and current text role to the selected
2855
2961
  * language and role, and chooses a new variant if need be. If the player has
@@ -2930,6 +3036,17 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
2930
3036
  * @return {!Promise.<shaka.extern.Track>}
2931
3037
  */
2932
3038
  addTextTrackAsync(uri, language, kind, mimeType, codec, label, forced) {}
3039
+ /**
3040
+ * Adds the given thumbnails track to the loaded manifest.
3041
+ * <code>load()</code> must resolve before calling. The presentation must
3042
+ * have a duration.
3043
+ * This returns the created track, which can immediately be used by the
3044
+ * application.
3045
+ * @param {string} uri
3046
+ * @param {string=} mimeType
3047
+ * @return {!Promise.<shaka.extern.Track>}
3048
+ */
3049
+ addThumbnailsTrack(uri, mimeType) {}
2933
3050
  /**
2934
3051
  * Adds the given chapters track to the loaded manifest. <code>load()</code>
2935
3052
  * must resolve before calling. The presentation must have a duration.
@@ -3088,6 +3205,14 @@ shaka.ads.ClientSideAd = class {
3088
3205
  * @override
3089
3206
  */
3090
3207
  getPositionInSequence() {}
3208
+ /**
3209
+ * @override
3210
+ */
3211
+ getTitle() {}
3212
+ /**
3213
+ * @override
3214
+ */
3215
+ getDescription() {}
3091
3216
  /**
3092
3217
  * @override
3093
3218
  */
@@ -3174,6 +3299,14 @@ shaka.ads.ServerSideAd = class {
3174
3299
  * @override
3175
3300
  */
3176
3301
  getPositionInSequence() {}
3302
+ /**
3303
+ * @override
3304
+ */
3305
+ getTitle() {}
3306
+ /**
3307
+ * @override
3308
+ */
3309
+ getDescription() {}
3177
3310
  /**
3178
3311
  * @override
3179
3312
  */
@@ -3942,8 +4075,13 @@ shaka.polyfill.Orientation = class {
3942
4075
  shaka.polyfill.PatchedMediaKeysApple = class {
3943
4076
  /**
3944
4077
  * Installs the polyfill if needed.
4078
+ * @param {boolean=} enableUninstall enables uninstalling the polyfill
3945
4079
  */
3946
- static install() {}
4080
+ static install(enableUninstall) {}
4081
+ /**
4082
+ * Uninstalls the polyfill if needed and enabled.
4083
+ */
4084
+ static uninstall() {}
3947
4085
  };
3948
4086
  /**
3949
4087
  * @summary A polyfill to stub out