shaka-player 4.5.0 → 4.6.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 (214) hide show
  1. package/.github/ISSUE_TEMPLATE/bug_report.md +1 -1
  2. package/AUTHORS +2 -0
  3. package/CHANGELOG.md +98 -0
  4. package/CODE_OF_CONDUCT.md +1 -1
  5. package/CONTRIBUTORS +2 -0
  6. package/README.md +38 -32
  7. package/demo/common/asset.js +11 -17
  8. package/demo/common/assets.js +117 -11
  9. package/demo/config.js +28 -1
  10. package/demo/custom.js +52 -38
  11. package/demo/main.js +11 -3
  12. package/demo/search.js +7 -0
  13. package/dist/controls.css +1 -1
  14. package/dist/controls.css.map +1 -1
  15. package/dist/demo.compiled.debug.js +133 -124
  16. package/dist/demo.compiled.debug.map +3 -3
  17. package/dist/demo.compiled.js +133 -124
  18. package/dist/demo.compiled.map +3 -3
  19. package/dist/deps.js +20 -18
  20. package/dist/locales.js +35 -31
  21. package/dist/receiver.compiled.debug.js +58 -50
  22. package/dist/receiver.compiled.debug.map +3 -3
  23. package/dist/receiver.compiled.js +58 -50
  24. package/dist/receiver.compiled.map +3 -3
  25. package/dist/shaka-player.compiled.d.ts +440 -390
  26. package/dist/shaka-player.compiled.debug.d.ts +440 -390
  27. package/dist/shaka-player.compiled.debug.externs.js +162 -77
  28. package/dist/shaka-player.compiled.debug.js +786 -736
  29. package/dist/shaka-player.compiled.debug.map +4 -4
  30. package/dist/shaka-player.compiled.externs.js +162 -77
  31. package/dist/shaka-player.compiled.js +1154 -1121
  32. package/dist/shaka-player.compiled.map +4 -4
  33. package/dist/shaka-player.ui.d.ts +491 -437
  34. package/dist/shaka-player.ui.debug.d.ts +491 -437
  35. package/dist/shaka-player.ui.debug.externs.js +167 -77
  36. package/dist/shaka-player.ui.debug.js +877 -811
  37. package/dist/shaka-player.ui.debug.map +4 -4
  38. package/dist/shaka-player.ui.externs.js +167 -77
  39. package/dist/shaka-player.ui.js +1362 -1318
  40. package/dist/shaka-player.ui.map +4 -4
  41. package/docs/tutorials/ad_monetization.md +54 -0
  42. package/docs/tutorials/basic-usage.md +2 -1
  43. package/docs/tutorials/errors.md +2 -1
  44. package/docs/tutorials/offline.md +10 -8
  45. package/docs/tutorials/plugins.md +5 -0
  46. package/docs/tutorials/ui-customization.md +13 -0
  47. package/docs/tutorials/ui.md +2 -1
  48. package/docs/tutorials/upgrade.md +3 -0
  49. package/externs/managedmediasource.js +24 -0
  50. package/externs/shaka/abr_manager.js +6 -2
  51. package/externs/shaka/cea.js +7 -0
  52. package/externs/shaka/codecs.js +5 -3
  53. package/externs/shaka/manifest.js +21 -5
  54. package/externs/shaka/manifest_parser.js +17 -0
  55. package/externs/shaka/net.js +2 -2
  56. package/externs/shaka/offline.js +9 -2
  57. package/externs/shaka/player.js +53 -7
  58. package/externs/shaka/text.js +3 -1
  59. package/externs/shaka/transmuxer.js +1 -1
  60. package/lib/abr/simple_abr_manager.js +25 -8
  61. package/lib/ads/media_tailor_ad_manager.js +14 -3
  62. package/lib/cast/cast_receiver.js +1 -1
  63. package/lib/cea/cea_decoder.js +28 -0
  64. package/lib/cea/dummy_caption_decoder.js +5 -0
  65. package/lib/dash/dash_parser.js +249 -83
  66. package/lib/dash/mpd_utils.js +52 -31
  67. package/lib/dash/segment_base.js +4 -5
  68. package/lib/dash/segment_list.js +5 -4
  69. package/lib/dash/segment_template.js +83 -26
  70. package/lib/hls/hls_classes.js +28 -43
  71. package/lib/hls/hls_parser.js +761 -649
  72. package/lib/hls/hls_utils.js +64 -5
  73. package/lib/hls/manifest_text_parser.js +7 -11
  74. package/lib/media/adaptation_set.js +20 -13
  75. package/lib/media/adaptation_set_criteria.js +70 -18
  76. package/lib/media/closed_caption_parser.js +13 -0
  77. package/lib/media/content_workarounds.js +6 -0
  78. package/lib/media/drm_engine.js +8 -13
  79. package/lib/media/manifest_parser.js +8 -113
  80. package/lib/media/media_source_capabilities.js +10 -3
  81. package/lib/media/media_source_engine.js +75 -21
  82. package/lib/media/play_rate_controller.js +8 -38
  83. package/lib/media/presentation_timeline.js +7 -1
  84. package/lib/media/quality_observer.js +1 -1
  85. package/lib/media/segment_index.js +5 -5
  86. package/lib/media/segment_prefetch.js +92 -24
  87. package/lib/media/segment_reference.js +67 -1
  88. package/lib/media/segment_utils.js +343 -0
  89. package/lib/media/stall_detector.js +0 -3
  90. package/lib/media/streaming_engine.js +41 -21
  91. package/lib/mss/mss_parser.js +18 -2
  92. package/lib/net/networking_engine.js +66 -12
  93. package/lib/net/networking_utils.js +95 -0
  94. package/lib/offline/indexeddb/v1_storage_cell.js +2 -0
  95. package/lib/offline/indexeddb/v2_storage_cell.js +2 -0
  96. package/lib/offline/manifest_converter.js +2 -0
  97. package/lib/offline/offline_manifest_parser.js +10 -0
  98. package/lib/offline/storage.js +11 -7
  99. package/lib/player.js +993 -1502
  100. package/lib/polyfill/mediasource.js +22 -1
  101. package/lib/text/mp4_ttml_parser.js +2 -2
  102. package/lib/text/srt_text_parser.js +2 -2
  103. package/lib/text/stub_text_displayer.js +51 -0
  104. package/lib/text/text_engine.js +3 -2
  105. package/lib/text/ttml_text_parser.js +28 -5
  106. package/lib/text/ui_text_displayer.js +4 -0
  107. package/lib/text/vtt_text_parser.js +7 -2
  108. package/lib/transmuxer/aac_transmuxer.js +1 -1
  109. package/lib/transmuxer/ac3_transmuxer.js +1 -1
  110. package/lib/transmuxer/ec3_transmuxer.js +1 -1
  111. package/lib/transmuxer/h264.js +5 -4
  112. package/lib/transmuxer/h265.js +5 -4
  113. package/lib/transmuxer/mp3_transmuxer.js +1 -1
  114. package/lib/transmuxer/mpeg_ts_transmuxer.js +1 -1
  115. package/lib/transmuxer/mss_transmuxer.js +1 -1
  116. package/lib/transmuxer/ts_transmuxer.js +33 -13
  117. package/lib/util/buffer_utils.js +26 -4
  118. package/lib/util/content_steering_manager.js +358 -0
  119. package/lib/util/error.js +2 -6
  120. package/lib/util/fairplay_utils.js +1 -1
  121. package/lib/util/fake_event.js +5 -1
  122. package/lib/util/id3_utils.js +50 -1
  123. package/lib/util/manifest_parser_utils.js +12 -8
  124. package/lib/util/mp4_generator.js +2 -4
  125. package/lib/util/mutex.js +59 -0
  126. package/lib/util/object_utils.js +1 -1
  127. package/lib/util/periods.js +154 -179
  128. package/lib/util/platform.js +4 -3
  129. package/lib/util/player_configuration.js +35 -6
  130. package/lib/util/stream_utils.js +105 -98
  131. package/lib/util/ts_parser.js +124 -73
  132. package/lib/util/uint8array_utils.js +5 -1
  133. package/lib/util/xml_utils.js +5 -0
  134. package/maintained-branches.md +2 -2
  135. package/package.json +1 -1
  136. package/roadmap.md +15 -5
  137. package/shaka-player.uncompiled.js +0 -1
  138. package/test/abr/simple_abr_manager_unit.js +33 -33
  139. package/test/ads/ad_manager_unit.js +3 -2
  140. package/test/cast/cast_receiver_integration.js +3 -4
  141. package/test/cast/cast_utils_unit.js +2 -0
  142. package/test/cea/cea_decoder_unit.js +7 -0
  143. package/test/codec_switching/codec_switching_integration.js +2 -1
  144. package/test/dash/dash_parser_integration.js +2 -1
  145. package/test/dash/dash_parser_live_unit.js +0 -19
  146. package/test/dash/dash_parser_manifest_unit.js +494 -2
  147. package/test/dash/mpd_utils_unit.js +61 -30
  148. package/test/hls/hls_live_unit.js +12 -3
  149. package/test/hls/hls_parser_unit.js +377 -27
  150. package/test/hls/manifest_text_parser_unit.js +32 -99
  151. package/test/media/adaptation_set_criteria_unit.js +172 -21
  152. package/test/media/adaptation_set_unit.js +1 -0
  153. package/test/media/content_workarounds_unit.js +1 -1
  154. package/test/media/drm_engine_unit.js +3 -3
  155. package/test/media/media_source_engine_unit.js +1 -1
  156. package/test/media/play_rate_controller_unit.js +0 -48
  157. package/test/media/segment_index_unit.js +2 -1
  158. package/test/mss/mss_player_integration.js +3 -2
  159. package/test/net/networking_engine_unit.js +3 -3
  160. package/test/{media/manifest_parser_unit.js → net/networking_utils_unit.js} +2 -2
  161. package/test/offline/manifest_convert_unit.js +9 -0
  162. package/test/offline/offline_integration.js +2 -1
  163. package/test/offline/storage_integration.js +21 -9
  164. package/test/player_external.js +4 -2
  165. package/test/player_integration.js +15 -4
  166. package/test/player_load_graph_integration.js +47 -151
  167. package/test/player_src_equals_external.js +1 -0
  168. package/test/player_src_equals_integration.js +71 -4
  169. package/test/player_unit.js +80 -27
  170. package/test/test/util/fake_media_source_engine.js +5 -0
  171. package/test/test/util/fake_networking_engine.js +9 -1
  172. package/test/test/util/fake_segment_prefetch.js +3 -0
  173. package/test/test/util/manifest_generator.js +4 -0
  174. package/test/test/util/manifest_parser_util.js +14 -2
  175. package/test/test/util/offline_utils.js +1 -0
  176. package/test/test/util/simple_fakes.js +2 -2
  177. package/test/test/util/streaming_engine_util.js +3 -0
  178. package/test/test/util/test_scheme.js +6 -0
  179. package/test/test/util/ui_utils.js +4 -3
  180. package/test/text/mp4_ttml_parser_unit.js +4 -4
  181. package/test/text/srt_text_parser_unit.js +1 -1
  182. package/test/text/text_displayer_layout_unit.js +1 -1
  183. package/test/text/text_engine_unit.js +6 -0
  184. package/test/text/ttml_text_parser_unit.js +33 -2
  185. package/test/transmuxer/transmuxer_engine_integration.js +9 -0
  186. package/test/transmuxer/transmuxer_integration.js +33 -3
  187. package/test/ui/ad_ui_unit.js +2 -2
  188. package/test/ui/ui_customization_unit.js +17 -16
  189. package/test/ui/ui_integration.js +30 -20
  190. package/test/ui/ui_unit.js +25 -19
  191. package/test/util/buffer_utils_unit.js +1 -1
  192. package/test/util/content_steering_manager_unit.js +427 -0
  193. package/test/util/id3_utils_unit.js +52 -0
  194. package/test/util/stream_utils_unit.js +17 -113
  195. package/test/util/ts_parser_unit.js +3 -3
  196. package/third_party/closure-uri/uri.js +13 -1
  197. package/ui/audio_language_selection.js +9 -2
  198. package/ui/externs/ui.js +17 -2
  199. package/ui/language_utils.js +43 -8
  200. package/ui/less/range_elements.less +33 -0
  201. package/ui/locales/en.json +1 -0
  202. package/ui/locales/es-419.json +1 -0
  203. package/ui/locales/es.json +1 -0
  204. package/ui/locales/source.json +4 -0
  205. package/ui/localization.js +10 -0
  206. package/ui/remote_button.js +3 -1
  207. package/ui/resolution_selection.js +47 -10
  208. package/ui/seek_bar.js +296 -3
  209. package/ui/text_selection.js +2 -1
  210. package/ui/ui.js +6 -2
  211. package/lib/routing/node.js +0 -23
  212. package/lib/routing/payload.js +0 -47
  213. package/lib/routing/walker.js +0 -587
  214. package/test/routing/walker_unit.js +0 -505
@@ -60,13 +60,6 @@ shaka.util.IReleasable = class {
60
60
  */
61
61
  release() {}
62
62
  };
63
- /**
64
- * @enum {string}
65
- */
66
- shaka.config.CodecSwitchingStrategy = {
67
- RELOAD: 'reload',
68
- SMOOTH: 'smooth'
69
- };
70
63
  /**
71
64
  * @summary A set of BufferSource utility functions.
72
65
  */
@@ -100,6 +93,18 @@ shaka.util.BufferUtils = class {
100
93
  * @return {!Uint8Array}
101
94
  */
102
95
  static toUint8(data, offset, length) {}
96
+ /**
97
+ * Creates a new Uint16Array view on the same buffer. This clamps the values
98
+ * to be within the same view (i.e. you can't use this to move past the end
99
+ * of the view, even if the underlying buffer is larger). However, you can
100
+ * pass a negative offset to access the data before the view.
101
+ * @param {BufferSource} data
102
+ * @param {number=} offset The offset from the beginning of this data's view
103
+ * to start the new view at.
104
+ * @param {number=} length The byte length of the new view.
105
+ * @return {!Uint16Array}
106
+ */
107
+ static toUint16(data, offset, length) {}
103
108
  /**
104
109
  * Creates a DataView over the given buffer.
105
110
  * @see toUint8
@@ -745,7 +750,6 @@ shaka.util.Error.Code = {
745
750
  'TEXT_ONLY_WEBVTT_SRC_EQUALS': 2013,
746
751
  'MISSING_TEXT_PLUGIN': 2014,
747
752
  'CHAPTERS_TRACK_FAILED': 2015,
748
- 'CANNOT_ADD_EXTERNAL_THUMBNAILS_TO_SRC_EQUALS': 2016,
749
753
  'UNSUPPORTED_EXTERNAL_THUMBNAILS_URI': 2017,
750
754
  'BUFFER_READ_OUT_OF_BOUNDS': 3000,
751
755
  'JS_INTEGER_OVERFLOW': 3001,
@@ -1140,9 +1144,11 @@ shaka.abr.SimpleAbrManager = class {
1140
1144
  */
1141
1145
  init(switchCallback) {}
1142
1146
  /**
1147
+ * @param {boolean=} preferFastSwitching
1148
+ * @return {shaka.extern.Variant}
1143
1149
  * @override
1144
1150
  */
1145
- chooseVariant() {}
1151
+ chooseVariant(preferFastSwitching) {}
1146
1152
  /**
1147
1153
  * @override
1148
1154
  */
@@ -1154,7 +1160,7 @@ shaka.abr.SimpleAbrManager = class {
1154
1160
  /**
1155
1161
  * @override
1156
1162
  */
1157
- segmentDownloaded(deltaTimeMs, numBytes) {}
1163
+ segmentDownloaded(deltaTimeMs, numBytes, allowSwitch) {}
1158
1164
  /**
1159
1165
  * @override
1160
1166
  */
@@ -1185,6 +1191,13 @@ shaka.config.AutoShowText = {
1185
1191
  'IF_PREFERRED_TEXT_LANGUAGE': 2,
1186
1192
  'IF_SUBTITLES_MAY_BE_NEEDED': 3
1187
1193
  };
1194
+ /**
1195
+ * @enum {string}
1196
+ */
1197
+ shaka.config.CodecSwitchingStrategy = {
1198
+ RELOAD: 'reload',
1199
+ SMOOTH: 'smooth'
1200
+ };
1188
1201
  /**
1189
1202
  * A utility to wrap abortable operations. Note that these are not cancelable.
1190
1203
  * Cancelation implies undoing what has been done so far, whereas aborting only
@@ -1344,17 +1357,20 @@ shaka.util.FakeEventTarget.ListenerType;
1344
1357
  */
1345
1358
  shaka.net.NetworkingEngine = class extends shaka.util.FakeEventTarget {
1346
1359
  /**
1347
- * @param {function(number, number)=} onProgressUpdated Called when a progress
1348
- * event is triggered. Passed the duration, in milliseconds, that the
1349
- * request took, and the number of bytes transferred.
1360
+ * @param {function(number, number, boolean)=} onProgressUpdated Called when
1361
+ * a progress event is triggered. Passed the duration, in milliseconds,
1362
+ * that the request took, the number of bytes transferred, and the boolean
1363
+ * of whether the switching is allowed.
1350
1364
  * @param {shaka.net.NetworkingEngine.OnHeadersReceived=} onHeadersReceived
1351
1365
  * Called when the headers are received for a download.
1352
1366
  * @param {shaka.net.NetworkingEngine.OnDownloadFailed=} onDownloadFailed
1353
1367
  * Called when a download fails, for any reason.
1354
1368
  * @param {shaka.net.NetworkingEngine.OnRequest=} onRequest
1355
1369
  * Called when a request is made
1370
+ * @param {shaka.net.NetworkingEngine.OnRetry=} onRetry
1371
+ * Called when a request retry is made
1356
1372
  */
1357
- constructor(onProgressUpdated, onHeadersReceived, onDownloadFailed, onRequest) {}
1373
+ constructor(onProgressUpdated, onHeadersReceived, onDownloadFailed, onRequest, onRetry) {}
1358
1374
  /**
1359
1375
  * @param {boolean} forceHTTPS
1360
1376
  */
@@ -1483,7 +1499,8 @@ shaka.net.NetworkingEngine.RequestType = {
1483
1499
  'TIMING': 4,
1484
1500
  'SERVER_CERTIFICATE': 5,
1485
1501
  'KEY': 6,
1486
- 'ADS': 7
1502
+ 'ADS': 7,
1503
+ 'CONTENT_STEERING': 8
1487
1504
  };
1488
1505
  /**
1489
1506
  * A more advanced form of the RequestType structure, meant to describe
@@ -1542,6 +1559,17 @@ shaka.net.NetworkingEngine.OnDownloadFailed;
1542
1559
  * A callback function called on every request
1543
1560
  */
1544
1561
  shaka.net.NetworkingEngine.OnRequest;
1562
+ /**
1563
+ * @typedef {function(
1564
+ * !shaka.net.NetworkingEngine.RequestType,
1565
+ * (shaka.extern.RequestContext|undefined),
1566
+ * string,
1567
+ * string)}
1568
+ * @description
1569
+ * A callback function called on every request retry. The first string is the
1570
+ * new URI and the second string is the old URI.
1571
+ */
1572
+ shaka.net.NetworkingEngine.OnRetry;
1545
1573
  /**
1546
1574
  * @summary
1547
1575
  * An EventManager maintains a collection of "event
@@ -1993,8 +2021,10 @@ shaka.media.SegmentReference = class {
1993
2021
  * not available.
1994
2022
  * @param {?shaka.extern.aes128Key=} aes128Key
1995
2023
  * The segment's AES-128-CBC full segment encryption key and iv.
2024
+ * @param {boolean=} allPartialSegments
2025
+ * Indicate if the segment has all partial segments
1996
2026
  */
1997
- constructor(startTime, endTime, uris, startByte, endByte, initSegmentReference, timestampOffset, appendWindowStart, appendWindowEnd, partialReferences, tilesLayout, tileDuration, syncTime, status, aes128Key) {}
2027
+ constructor(startTime, endTime, uris, startByte, endByte, initSegmentReference, timestampOffset, appendWindowStart, appendWindowEnd, partialReferences, tilesLayout, tileDuration, syncTime, status, aes128Key, allPartialSegments) {}
1998
2028
  /**
1999
2029
  * Creates and returns the URIs of the resource containing the segment.
2000
2030
  * @return {!Array.<string>}
@@ -2061,6 +2091,24 @@ shaka.media.SegmentReference = class {
2061
2091
  * @return {boolean}
2062
2092
  */
2063
2093
  isIndependent() {}
2094
+ /**
2095
+ * Mark the reference as partial.
2096
+ */
2097
+ markAsPartial() {}
2098
+ /**
2099
+ * Returns true if the segment is partial.
2100
+ * @return {boolean}
2101
+ */
2102
+ isPartial() {}
2103
+ /**
2104
+ * Mark the reference as being the last part of the full segment
2105
+ */
2106
+ markAsLastPartial() {}
2107
+ /**
2108
+ * Returns true if reference as being the last part of the full segment.
2109
+ * @return {boolean}
2110
+ */
2111
+ isLastPartial() {}
2064
2112
  /**
2065
2113
  * Mark the reference as byterange optimization.
2066
2114
  * The "byterange optimization" means that it is playable using MP4 low
@@ -2184,11 +2232,10 @@ shaka.util.TsParser = class {
2184
2232
  * The code is based on hls.js
2185
2233
  * Credit to https://github.com/video-dev/hls.js/blob/master/src/demux/tsdemuxer.ts
2186
2234
  * @param {shaka.extern.MPEG_PES} pes
2187
- * @param {?shaka.extern.MPEG_PES=} nextPes
2188
2235
  * @param {?shaka.extern.VideoNalu=} lastNalu
2189
2236
  * @return {!Array.<shaka.extern.VideoNalu>}
2190
2237
  */
2191
- parseNalus(pes, nextPes, lastNalu) {}
2238
+ parseNalus(pes, lastNalu) {}
2192
2239
  /**
2193
2240
  * Return the ID3 metadata
2194
2241
  * @return {!Array.<shaka.extern.ID3Metadata>}
@@ -2201,14 +2248,16 @@ shaka.util.TsParser = class {
2201
2248
  getAudioData() {}
2202
2249
  /**
2203
2250
  * Return the audio data
2251
+ * @param {boolean=} naluProcessing
2204
2252
  * @return {!Array.<shaka.extern.MPEG_PES>}
2205
2253
  */
2206
- getVideoData() {}
2254
+ getVideoData(naluProcessing) {}
2207
2255
  /**
2208
2256
  * Return the start time for the audio and video
2209
- * @return {{audio: ?number, video: ?number}}
2257
+ * @param {string} contentType
2258
+ * @return {?number}
2210
2259
  */
2211
- getStartTime() {}
2260
+ getStartTime(contentType) {}
2212
2261
  /**
2213
2262
  * Return the audio and video codecs
2214
2263
  * @return {{audio: ?string, video: ?string}}
@@ -2460,7 +2509,9 @@ shaka.media.PresentationTimeline = class {
2460
2509
  * @typedef {{
2461
2510
  * start: number,
2462
2511
  * unscaledStart: number,
2463
- * end: number
2512
+ * end: number,
2513
+ * partialSegments: number,
2514
+ * segmentPosition: number
2464
2515
  * }}
2465
2516
  * @description
2466
2517
  * Defines a time range of a media segment. Times are in seconds.
@@ -2470,6 +2521,10 @@ shaka.media.PresentationTimeline = class {
2470
2521
  * The start time of the range in representation timescale units.
2471
2522
  * @property {number} end
2472
2523
  * The end time (exclusive) of the range.
2524
+ * @property {number} partialSegments
2525
+ * The number of partial segments
2526
+ * @property {number} segmentPosition
2527
+ * The segment position of the timeline entry as it appears in the manifest
2473
2528
  */
2474
2529
  shaka.media.PresentationTimeline.TimeRange;
2475
2530
  /**
@@ -2689,6 +2744,32 @@ shaka.text.SimpleTextDisplayer = class {
2689
2744
  */
2690
2745
  setTextVisibility(on) {}
2691
2746
  };
2747
+ /**
2748
+ * A stub text displayer plugin that does nothing
2749
+ * @implements {shaka.extern.TextDisplayer}
2750
+ */
2751
+ shaka.text.StubTextDisplayer = class {
2752
+ /**
2753
+ * @override
2754
+ */
2755
+ remove(start, end) {}
2756
+ /**
2757
+ * @override
2758
+ */
2759
+ append(cues) {}
2760
+ /**
2761
+ * @override
2762
+ */
2763
+ destroy() {}
2764
+ /**
2765
+ * @override
2766
+ */
2767
+ isTextVisible() {}
2768
+ /**
2769
+ * @override
2770
+ */
2771
+ setTextVisibility(on) {}
2772
+ };
2692
2773
  /** */
2693
2774
  shaka.util.Dom = class {
2694
2775
  /**
@@ -2936,16 +3017,9 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
2936
3017
  */
2937
3018
  static probeSupport(promptsOkay) {}
2938
3019
  /**
2939
- * Tell the player to use <code>mediaElement</code> for all <code>load</code>
2940
- * requests until <code>detach</code> or <code>destroy</code> are called.
2941
- * <p>
2942
- * Calling <code>attach</code> with <code>initializedMediaSource=true</code>
2943
- * will tell the player to take the initial load step and initialize media
2944
- * source.
2945
- * <p>
2946
- * Calls to <code>attach</code> will interrupt any in-progress calls to
2947
- * <code>load</code> but cannot interrupt calls to <code>attach</code>,
2948
- * <code>detach</code>, or <code>unload</code>.
3020
+ * Attaches the player to a media element.
3021
+ * If the player was already attached to a media element, first detaches from
3022
+ * that media element.
2949
3023
  * @param {!HTMLMediaElement} mediaElement
2950
3024
  * @param {boolean=} initializeMediaSource
2951
3025
  * @return {!Promise}
@@ -2958,35 +3032,15 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
2958
3032
  */
2959
3033
  attachCanvas(canvas) {}
2960
3034
  /**
2961
- * Tell the player to stop using its current media element. If the player is:
2962
- * <ul>
2963
- * <li>detached, this will do nothing,
2964
- * <li>attached, this will release the media element,
2965
- * <li>loading, this will abort loading, unload, and release the media
2966
- * element,
2967
- * <li>playing content, this will stop playback, unload, and release the
2968
- * media element.
2969
- * </ul>
2970
- * <p>
2971
- * Calls to <code>detach</code> will interrupt any in-progress calls to
2972
- * <code>load</code> but cannot interrupt calls to <code>attach</code>,
2973
- * <code>detach</code>, or <code>unload</code>.
3035
+ * Detach the player from the current media element. Leaves the player in a
3036
+ * state where it cannot play media, until it has been attached to something
3037
+ * else.
3038
+ * @param {boolean=} keepAdManager
2974
3039
  * @return {!Promise}
2975
3040
  */
2976
- detach() {}
3041
+ detach(keepAdManager) {}
2977
3042
  /**
2978
- * Tell the player to either return to:
2979
- * <ul>
2980
- * <li>detached (when it does not have a media element),
2981
- * <li>attached (when it has a media element and
2982
- * <code>initializedMediaSource=false</code>)
2983
- * <li>media source initialized (when it has a media element and
2984
- * <code>initializedMediaSource=true</code>)
2985
- * </ul>
2986
- * <p>
2987
- * Calls to <code>unload</code> will interrupt any in-progress calls to
2988
- * <code>load</code> but cannot interrupt calls to <code>attach</code>,
2989
- * <code>detach</code>, or <code>unload</code>.
3043
+ * Unloads the currently playing stream, if any.
2990
3044
  * @param {boolean=} initializeMediaSource
2991
3045
  * @param {boolean=} keepAdManager
2992
3046
  * @return {!Promise}
@@ -3001,22 +3055,21 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
3001
3055
  */
3002
3056
  updateStartTime(startTime) {}
3003
3057
  /**
3004
- * Tell the player to load the content at <code>assetUri</code> and start
3005
- * playback at <code>startTime</code>. Before calling <code>load</code>,
3006
- * a call to <code>attach</code> must have succeeded.
3007
- * <p>
3008
- * Calls to <code>load</code> will interrupt any in-progress calls to
3009
- * <code>load</code> but cannot interrupt calls to <code>attach</code>,
3010
- * <code>detach</code>, or <code>unload</code>.
3058
+ * Loads a new stream.
3059
+ * If another stream was already playing, first unloads that stream.
3011
3060
  * @param {string} assetUri
3012
3061
  * @param {?number=} startTime
3013
3062
  * When <code>startTime</code> is <code>null</code> or
3014
3063
  * <code>undefined</code>, playback will start at the default start time (0
3015
3064
  * for VOD and liveEdge for LIVE).
3016
- * @param {string=} mimeType
3065
+ * @param {?string=} mimeType
3017
3066
  * @return {!Promise}
3018
3067
  */
3019
3068
  load(assetUri, startTime, mimeType) {}
3069
+ /**
3070
+ * Releases all of the mutexes of the player. Meant for use by the tests.
3071
+ */
3072
+ releaseAllMutexes() {}
3020
3073
  /**
3021
3074
  * Changes configuration settings on the Player. This checks the names of
3022
3075
  * keys and the types of values to avoid coding errors. If there are errors,
@@ -3115,7 +3168,8 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
3115
3168
  isAudioOnly() {}
3116
3169
  /**
3117
3170
  * Get the range of time (in seconds) that seeking is allowed. If the player
3118
- * has not loaded content, this will return a range from 0 to 0.
3171
+ * has not loaded content and the manifest is HLS, this will return a range
3172
+ * from 0 to 0.
3119
3173
  * @return {{start: number, end: number}}
3120
3174
  */
3121
3175
  seekRange() {}
@@ -3213,6 +3267,13 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
3213
3267
  * @return {!Array.<shaka.extern.Track>}
3214
3268
  */
3215
3269
  getImageTracks() {}
3270
+ /**
3271
+ * Returns Thumbnail objects for each thumbnail for a given image track ID.
3272
+ * If the player has not loaded content, this will return a null.
3273
+ * @param {number} trackId
3274
+ * @return {!Promise.<?Array<!shaka.extern.Thumbnail>>}
3275
+ */
3276
+ getAllThumbnails(trackId) {}
3216
3277
  /**
3217
3278
  * Return a Thumbnail object from a image track Id and time.
3218
3279
  * If the player has not loaded content, this will return a null.
@@ -4337,6 +4398,14 @@ shaka.dash.DashParser = class {
4337
4398
  * @override
4338
4399
  */
4339
4400
  onExpirationUpdated(sessionId, expiration) {}
4401
+ /**
4402
+ * @override
4403
+ */
4404
+ onInitialVariantChosen(variant) {}
4405
+ /**
4406
+ * @override
4407
+ */
4408
+ banLocation(uri) {}
4340
4409
  };
4341
4410
  /**
4342
4411
  */
@@ -4406,6 +4475,14 @@ shaka.hls.HlsParser = class {
4406
4475
  * @override
4407
4476
  */
4408
4477
  onExpirationUpdated(sessionId, expiration) {}
4478
+ /**
4479
+ * @override
4480
+ */
4481
+ onInitialVariantChosen(variant) {}
4482
+ /**
4483
+ * @override
4484
+ */
4485
+ banLocation(uri) {}
4409
4486
  };
4410
4487
  /**
4411
4488
  * Creates a new MSS parser.
@@ -4434,6 +4511,14 @@ shaka.mss.MssParser = class {
4434
4511
  * @override
4435
4512
  */
4436
4513
  onExpirationUpdated(sessionId, expiration) {}
4514
+ /**
4515
+ * @override
4516
+ */
4517
+ onInitialVariantChosen(variant) {}
4518
+ /**
4519
+ * @override
4520
+ */
4521
+ banLocation(uri) {}
4437
4522
  };
4438
4523
  /**
4439
4524
  * @summary A networking plugin to handle http and https URIs via the Fetch API.
@@ -4906,7 +4991,7 @@ shaka.text.TtmlTextParser = class {
4906
4991
  /**
4907
4992
  * @override
4908
4993
  */
4909
- parseMedia(data, time) {}
4994
+ parseMedia(data, time, uri) {}
4910
4995
  };
4911
4996
  /**
4912
4997
  * @implements {shaka.extern.TextParser}
@@ -4929,7 +5014,7 @@ shaka.text.Mp4TtmlParser = class {
4929
5014
  /**
4930
5015
  * @override
4931
5016
  */
4932
- parseMedia(data, time) {}
5017
+ parseMedia(data, time, uri) {}
4933
5018
  };
4934
5019
  /**
4935
5020
  * @implements {shaka.extern.TextParser}
@@ -5019,7 +5104,7 @@ shaka.text.SrtTextParser = class {
5019
5104
  /**
5020
5105
  * @override
5021
5106
  */
5022
- parseMedia(data, time) {}
5107
+ parseMedia(data, time, uri) {}
5023
5108
  /**
5024
5109
  * Convert a SRT format to WebVTT
5025
5110
  * @param {string} data
@@ -5077,7 +5162,7 @@ shaka.transmuxer.AacTransmuxer = class {
5077
5162
  /**
5078
5163
  * @override
5079
5164
  */
5080
- getOrginalMimeType() {}
5165
+ getOriginalMimeType() {}
5081
5166
  /**
5082
5167
  * @override
5083
5168
  */
@@ -5110,7 +5195,7 @@ shaka.transmuxer.Ac3Transmuxer = class {
5110
5195
  /**
5111
5196
  * @override
5112
5197
  */
5113
- getOrginalMimeType() {}
5198
+ getOriginalMimeType() {}
5114
5199
  /**
5115
5200
  * @override
5116
5201
  */
@@ -5143,7 +5228,7 @@ shaka.transmuxer.Ec3Transmuxer = class {
5143
5228
  /**
5144
5229
  * @override
5145
5230
  */
5146
- getOrginalMimeType() {}
5231
+ getOriginalMimeType() {}
5147
5232
  /**
5148
5233
  * @override
5149
5234
  */
@@ -5176,7 +5261,7 @@ shaka.transmuxer.Mp3Transmuxer = class {
5176
5261
  /**
5177
5262
  * @override
5178
5263
  */
5179
- getOrginalMimeType() {}
5264
+ getOriginalMimeType() {}
5180
5265
  /**
5181
5266
  * @override
5182
5267
  */
@@ -5209,7 +5294,7 @@ shaka.transmuxer.MpegTsTransmuxer = class {
5209
5294
  /**
5210
5295
  * @override
5211
5296
  */
5212
- getOrginalMimeType() {}
5297
+ getOriginalMimeType() {}
5213
5298
  /**
5214
5299
  * @override
5215
5300
  */
@@ -5242,7 +5327,7 @@ shaka.transmuxer.MssTransmuxer = class {
5242
5327
  /**
5243
5328
  * @override
5244
5329
  */
5245
- getOrginalMimeType() {}
5330
+ getOriginalMimeType() {}
5246
5331
  /**
5247
5332
  * @override
5248
5333
  */
@@ -5275,7 +5360,7 @@ shaka.transmuxer.TsTransmuxer = class {
5275
5360
  /**
5276
5361
  * @override
5277
5362
  */
5278
- getOrginalMimeType() {}
5363
+ getOriginalMimeType() {}
5279
5364
  /**
5280
5365
  * @override
5281
5366
  */