shaka-player 3.1.4 → 3.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 (214) hide show
  1. package/.github/ISSUE_TEMPLATE/bug_report.md +1 -1
  2. package/.github/ISSUE_TEMPLATE/feature_request.md +1 -1
  3. package/.github/ISSUE_TEMPLATE/question.md +1 -1
  4. package/AUTHORS +6 -5
  5. package/CHANGELOG.md +363 -0
  6. package/CONTRIBUTORS +4 -2
  7. package/README.md +4 -4
  8. package/build/types/core +3 -0
  9. package/build/types/offline +1 -0
  10. package/build/types/polyfill +2 -0
  11. package/build/types/ui +2 -0
  12. package/demo/common/asset.js +9 -7
  13. package/demo/common/assets.js +28 -1
  14. package/demo/common/message_ids.js +15 -2
  15. package/demo/config.js +35 -2
  16. package/demo/index.html +1 -1
  17. package/demo/locales/en.json +14 -1
  18. package/demo/locales/source.json +56 -4
  19. package/demo/main.js +2 -1
  20. package/dist/controls.css +26 -2
  21. package/dist/controls.css.map +1 -1
  22. package/dist/demo.compiled.debug.js +24 -21
  23. package/dist/demo.compiled.debug.map +3 -3
  24. package/dist/demo.compiled.js +24 -21
  25. package/dist/demo.compiled.map +3 -3
  26. package/dist/deps.js +33 -25
  27. package/dist/locales.js +31 -29
  28. package/dist/receiver.compiled.debug.js +14 -12
  29. package/dist/receiver.compiled.debug.map +3 -3
  30. package/dist/receiver.compiled.js +14 -12
  31. package/dist/receiver.compiled.map +3 -3
  32. package/dist/shaka-player.compiled.d.ts +258 -20
  33. package/dist/shaka-player.compiled.debug.d.ts +258 -20
  34. package/dist/shaka-player.compiled.debug.externs.js +1005 -695
  35. package/dist/shaka-player.compiled.debug.js +720 -640
  36. package/dist/shaka-player.compiled.debug.map +4 -4
  37. package/dist/shaka-player.compiled.externs.js +1005 -695
  38. package/dist/shaka-player.compiled.js +850 -817
  39. package/dist/shaka-player.compiled.map +4 -4
  40. package/dist/shaka-player.ui.d.ts +274 -21
  41. package/dist/shaka-player.ui.debug.d.ts +274 -21
  42. package/dist/shaka-player.ui.debug.externs.js +766 -429
  43. package/dist/shaka-player.ui.debug.js +863 -765
  44. package/dist/shaka-player.ui.debug.map +4 -4
  45. package/dist/shaka-player.ui.externs.js +766 -429
  46. package/dist/shaka-player.ui.js +1042 -996
  47. package/dist/shaka-player.ui.map +4 -4
  48. package/docs/design/bg-fetch-after.gv +29 -0
  49. package/docs/design/bg-fetch-after.gv.png +0 -0
  50. package/docs/design/bg-fetch-before.gv +18 -0
  51. package/docs/design/bg-fetch-before.gv.png +0 -0
  52. package/docs/design/bg-fetch.md +134 -0
  53. package/docs/tutorials/blob-url.md +15 -0
  54. package/docs/tutorials/index.json +1 -0
  55. package/docs/tutorials/ui-customization.md +66 -0
  56. package/docs/tutorials/ui.md +5 -5
  57. package/externs/aria.js +6 -0
  58. package/externs/ima.js +3 -0
  59. package/externs/shaka/ads.js +29 -1
  60. package/externs/shaka/manifest.js +18 -2
  61. package/externs/shaka/manifest_parser.js +10 -1
  62. package/externs/shaka/net.js +20 -4
  63. package/externs/shaka/offline.js +36 -2
  64. package/externs/shaka/player.js +182 -13
  65. package/externs/shaka/text.js +24 -10
  66. package/externs/texttrack.js +3 -0
  67. package/externs/webcrypto.js +18 -0
  68. package/lib/abr/ewma.js +14 -0
  69. package/lib/abr/ewma_bandwidth_estimator.js +16 -2
  70. package/lib/abr/simple_abr_manager.js +6 -0
  71. package/lib/ads/ad_manager.js +16 -15
  72. package/lib/ads/client_side_ad.js +8 -0
  73. package/lib/ads/client_side_ad_manager.js +14 -6
  74. package/lib/ads/server_side_ad.js +7 -0
  75. package/lib/ads/server_side_ad_manager.js +19 -2
  76. package/lib/cast/cast_proxy.js +8 -0
  77. package/lib/cast/cast_utils.js +7 -1
  78. package/lib/cea/cea608_data_channel.js +56 -56
  79. package/lib/cea/cea608_memory.js +33 -33
  80. package/lib/cea/cea708_service.js +43 -43
  81. package/lib/cea/cea708_window.js +38 -38
  82. package/lib/cea/cea_decoder.js +13 -14
  83. package/lib/cea/cea_utils.js +23 -23
  84. package/lib/cea/dtvcc_packet_builder.js +7 -7
  85. package/lib/cea/i_caption_decoder.js +2 -3
  86. package/lib/cea/i_cea_parser.js +2 -2
  87. package/lib/cea/mp4_cea_parser.js +6 -6
  88. package/lib/dash/dash_parser.js +53 -14
  89. package/lib/dash/segment_base.js +25 -1
  90. package/lib/dash/segment_list.js +18 -9
  91. package/lib/dash/segment_template.js +23 -10
  92. package/lib/hls/hls_parser.js +210 -30
  93. package/lib/media/closed_caption_parser.js +1 -2
  94. package/lib/media/drm_engine.js +162 -192
  95. package/lib/media/quality_observer.js +291 -0
  96. package/lib/media/segment_index.js +9 -1
  97. package/lib/media/segment_reference.js +37 -5
  98. package/lib/media/streaming_engine.js +48 -10
  99. package/lib/net/http_fetch_plugin.js +31 -11
  100. package/lib/net/http_plugin_utils.js +1 -0
  101. package/lib/net/http_xhr_plugin.js +40 -14
  102. package/lib/net/networking_engine.js +82 -18
  103. package/lib/offline/download_info.js +68 -0
  104. package/lib/offline/download_manager.js +14 -7
  105. package/lib/offline/indexeddb/base_storage_cell.js +35 -0
  106. package/lib/offline/indexeddb/storage_mechanism.js +1 -1
  107. package/lib/offline/indexeddb/v1_storage_cell.js +1 -0
  108. package/lib/offline/indexeddb/v2_storage_cell.js +1 -0
  109. package/lib/offline/indexeddb/v5_storage_cell.js +5 -0
  110. package/lib/offline/manifest_converter.js +3 -1
  111. package/lib/offline/storage.js +404 -297
  112. package/lib/offline/stored_content_utils.js +2 -0
  113. package/lib/player.js +622 -153
  114. package/lib/polyfill/aria.js +82 -0
  115. package/lib/polyfill/random_uuid.js +52 -0
  116. package/lib/routing/walker.js +2 -3
  117. package/lib/text/cue.js +12 -0
  118. package/lib/text/srt_text_parser.js +4 -4
  119. package/lib/text/text_engine.js +2 -2
  120. package/lib/text/ttml_text_parser.js +25 -2
  121. package/lib/text/ui_text_displayer.js +2 -2
  122. package/lib/text/vtt_text_parser.js +2 -2
  123. package/lib/text/web_vtt_generator.js +55 -12
  124. package/lib/util/cmcd_manager.js +826 -0
  125. package/lib/util/error.js +12 -0
  126. package/lib/util/language_utils.js +12 -0
  127. package/lib/util/manifest_parser_utils.js +1 -0
  128. package/lib/util/mp4_box_parsers.js +20 -20
  129. package/lib/util/multi_map.js +8 -0
  130. package/lib/util/mutex.js +52 -0
  131. package/lib/util/periods.js +98 -64
  132. package/lib/util/player_configuration.js +31 -1
  133. package/lib/util/stream_utils.js +140 -85
  134. package/lib/util/xml_utils.js +31 -12
  135. package/package.json +1 -1
  136. package/roadmap.md +24 -22
  137. package/shaka-player.uncompiled.js +4 -0
  138. package/test/cast/cast_utils_unit.js +1 -0
  139. package/test/cea/cea608_memory_unit.js +1 -1
  140. package/test/cea/cea708_service_unit.js +8 -8
  141. package/test/cea/cea708_window_unit.js +6 -6
  142. package/test/cea/cea_decoder_unit.js +1 -1
  143. package/test/cea/dtvcc_packet_builder_unit.js +2 -2
  144. package/test/dash/dash_parser_content_protection_unit.js +2 -0
  145. package/test/dash/dash_parser_live_unit.js +101 -1
  146. package/test/dash/dash_parser_manifest_unit.js +78 -2
  147. package/test/dash/dash_parser_segment_base_unit.js +2 -0
  148. package/test/dash/dash_parser_segment_list_unit.js +2 -1
  149. package/test/dash/dash_parser_segment_template_unit.js +2 -1
  150. package/test/hls/hls_live_unit.js +2 -0
  151. package/test/hls/hls_parser_unit.js +252 -0
  152. package/test/media/drm_engine_integration.js +86 -12
  153. package/test/media/drm_engine_unit.js +310 -450
  154. package/test/media/quality_observer_unit.js +139 -0
  155. package/test/media/segment_reference_unit.js +16 -1
  156. package/test/media/streaming_engine_integration.js +2 -1
  157. package/test/media/streaming_engine_unit.js +2 -0
  158. package/test/net/http_plugin_unit.js +20 -15
  159. package/test/offline/manifest_convert_unit.js +2 -0
  160. package/test/offline/storage_integration.js +117 -23
  161. package/test/player_integration.js +151 -0
  162. package/test/player_src_equals_integration.js +52 -0
  163. package/test/player_unit.js +11 -33
  164. package/test/test/assets/chapters.srt +11 -0
  165. package/test/test/assets/chapters.vtt +10 -0
  166. package/test/test/util/cea_utils.js +12 -12
  167. package/test/test/util/dash_parser_util.js +4 -0
  168. package/test/test/util/fake_ad.js +7 -0
  169. package/test/test/util/fake_ad_manager.js +7 -0
  170. package/test/test/util/fake_drm_engine.js +9 -2
  171. package/test/test/util/manifest_generator.js +5 -2
  172. package/test/test/util/manifest_parser_util.js +3 -1
  173. package/test/test/util/test_scheme.js +14 -1
  174. package/test/text/ttml_text_parser_unit.js +47 -0
  175. package/test/text/web_vtt_generator_unit.js +81 -7
  176. package/test/ui/ui_unit.js +250 -0
  177. package/test/util/cmcd_manager_unit.js +277 -0
  178. package/test/util/stream_utils_unit.js +118 -10
  179. package/ui/airplay_button.js +2 -1
  180. package/ui/audio_language_selection.js +9 -5
  181. package/ui/cast_button.js +5 -6
  182. package/ui/constants.js +0 -3
  183. package/ui/context_menu.js +109 -0
  184. package/ui/controls.js +41 -7
  185. package/ui/controls.less +1 -0
  186. package/ui/enums.js +4 -0
  187. package/ui/externs/ui.js +28 -1
  188. package/ui/fast_forward_button.js +16 -8
  189. package/ui/fullscreen_button.js +2 -3
  190. package/ui/language_utils.js +1 -1
  191. package/ui/less/buttons.less +0 -4
  192. package/ui/less/containers.less +74 -0
  193. package/ui/less/overflow_menu.less +0 -10
  194. package/ui/less/tooltip.less +97 -0
  195. package/ui/locales/en.json +1 -0
  196. package/ui/locales/source.json +4 -0
  197. package/ui/loop_button.js +6 -3
  198. package/ui/mute_button.js +3 -4
  199. package/ui/overflow_menu.js +7 -28
  200. package/ui/pip_button.js +10 -7
  201. package/ui/play_button.js +2 -2
  202. package/ui/playback_rate_selection.js +11 -15
  203. package/ui/presentation_time.js +1 -3
  204. package/ui/resolution_selection.js +11 -7
  205. package/ui/rewind_button.js +17 -9
  206. package/ui/seek_bar.js +6 -6
  207. package/ui/settings_menu.js +36 -4
  208. package/ui/small_play_button.js +1 -0
  209. package/ui/spacer.js +1 -1
  210. package/ui/statistics_button.js +253 -0
  211. package/ui/text_selection.js +19 -15
  212. package/ui/ui.js +30 -0
  213. package/ui/ui_utils.js +1 -1
  214. package/ui/volume_bar.js +2 -4
@@ -35,6 +35,8 @@ shaka.text = {};
35
35
  shaka.ui = {};
36
36
  /** @const */
37
37
  shaka.util = {};
38
+ /** @const */
39
+ shaka.util.CmcdManager = {};
38
40
 
39
41
  /**
40
42
  * @summary Create an Event work-alike object based on the provided dictionary.
@@ -261,6 +263,7 @@ shaka.util.Error.Code = {
261
263
  'EXPIRED': 6014,
262
264
  'SERVER_CERTIFICATE_REQUIRED': 6015,
263
265
  'INIT_DATA_TRANSFORM_ERROR': 6016,
266
+ 'SERVER_CERTIFICATE_REQUEST_FAILED': 6017,
264
267
  'LOAD_INTERRUPTED': 7000,
265
268
  'OPERATION_ABORTED': 7001,
266
269
  'NO_VIDEO_ELEMENT': 7002,
@@ -286,12 +289,156 @@ shaka.util.Error.Code = {
286
289
  'MISSING_STORAGE_CELL': 9013,
287
290
  'STORAGE_LIMIT_REACHED': 9014,
288
291
  'DOWNLOAD_SIZE_CALLBACK_ERROR': 9015,
292
+ 'MODIFY_OPERATION_NOT_SUPPORTED': 9016,
289
293
  'CS_IMA_SDK_MISSING': 10000,
290
294
  'CS_AD_MANAGER_NOT_INITIALIZED': 10001,
291
295
  'SS_IMA_SDK_MISSING': 10002,
292
296
  'SS_AD_MANAGER_NOT_INITIALIZED': 10003,
293
297
  'CURRENT_DAI_REQUEST_NOT_FINISHED': 10004
294
298
  };
299
+ /**
300
+ * @summary A set of language utility functions.
301
+ * @final
302
+ */
303
+ shaka.util.LanguageUtils = class {
304
+ /**
305
+ * Check if |locale1| and |locale2| are locale-compatible.
306
+ * Locale-compatible is defined as all components in each locale match. Since
307
+ * we only respect the language and region components, we only check that
308
+ * the language and region components match.
309
+ * Examples:
310
+ * Locale A | Locale B | Locale Compatible
311
+ * ---------------------------------------
312
+ * en-US | en-US | true
313
+ * en | en-US | false
314
+ * en-US | en-CA | false
315
+ * @param {string} locale1
316
+ * @param {string} locale2
317
+ * @return {boolean}
318
+ */
319
+ static areLocaleCompatible(locale1, locale2) {}
320
+ /**
321
+ * Check if |locale1| and |locale2| are language-compatible.
322
+ * Language compatible is when the language component of each locale matches.
323
+ * This means that no matter what region they have (or don't have) as long as
324
+ * the language components match, they are language-compatible.
325
+ * Examples:
326
+ * Locale A | Locale B | Language-Compatible
327
+ * -----------------------------------------
328
+ * en-US | en-US | true
329
+ * en-US | en | true
330
+ * en-US | en-CA | true
331
+ * en-CA | fr-CA | false
332
+ * @param {string} locale1
333
+ * @param {string} locale2
334
+ * @return {boolean}
335
+ */
336
+ static areLanguageCompatible(locale1, locale2) {}
337
+ /**
338
+ * Check if |possibleParent| is the parent locale of |possibleChild|. Because
339
+ * we do not support dialects, the parent-child relationship is a lot simpler.
340
+ * In a parent child relationship:
341
+ * - The parent and child have the same language-component
342
+ * - The parent has no region-component
343
+ * - The child has a region-component
344
+ * Example:
345
+ * Locale A | Locale B | Is A The parent of B?
346
+ * --------------------------------------------
347
+ * en-US | en-US | no
348
+ * en-US | en | no
349
+ * en | en-US | yes
350
+ * en | en | no
351
+ * en | fr | no
352
+ * @param {string} possibleParent
353
+ * @param {string} possibleChild
354
+ * @return {boolean}
355
+ */
356
+ static isParentOf(possibleParent, possibleChild) {}
357
+ /**
358
+ * Check if |localeA| shares the same parent with |localeB|. Since we don't
359
+ * support dialect, we will only look at language and region. For two locales
360
+ * to be siblings:
361
+ * - Both must have language-components
362
+ * - Both must have region-components
363
+ * - Both must have the same language-component
364
+ * Example:
365
+ * Locale A | Locale B | Siblings?
366
+ * --------------------------------------------
367
+ * en-US | en-US | yes
368
+ * en-US | en-CA | yes
369
+ * en-US | en | no
370
+ * en | en-US | no
371
+ * en | en | no
372
+ * en | fr | no
373
+ * @param {string} localeA
374
+ * @param {string} localeB
375
+ * @return {boolean}
376
+ */
377
+ static isSiblingOf(localeA, localeB) {}
378
+ /**
379
+ * Normalize a locale. This will take a locale and canonicalize it to a state
380
+ * that we are prepared to work with.
381
+ * We only support with:
382
+ * - language
383
+ * - language-REGION
384
+ * If given a dialect, we will discard it. We will convert any 3-character
385
+ * codes to 2-character codes. We will force language codes to lowercase and
386
+ * region codes to uppercase.
387
+ * @param {string} locale
388
+ * @return {string}
389
+ */
390
+ static normalize(locale) {}
391
+ /**
392
+ * Check if two language codes are siblings. Language codes are siblings if
393
+ * they share the same base language while neither one is the base language.
394
+ * For example, "en-US" and "en-CA" are siblings but "en-US" and "en" are not
395
+ * siblings.
396
+ * @param {string} a
397
+ * @param {string} b
398
+ * @return {boolean}
399
+ */
400
+ static areSiblings(a, b) {}
401
+ /**
402
+ * Compute a numerical relatedness for language codes. Language codes with a
403
+ * higher relatedness are a better match. Unrelated language codes have a
404
+ * relatedness score of 0.
405
+ * @param {string} target
406
+ * @param {string} candidate
407
+ * @return {number}
408
+ */
409
+ static relatedness(target, candidate) {}
410
+ /**
411
+ * Get the normalized base language for a language code.
412
+ * @param {string} lang
413
+ * @return {string}
414
+ */
415
+ static getBase(lang) {}
416
+ /**
417
+ * Get the normalized language of the given text stream. Will return 'und' if
418
+ * a language is not found on the text stream.
419
+ * This should always be used to get the language from a text stream.
420
+ * @param {shaka.extern.Stream} stream
421
+ * @return {string}
422
+ */
423
+ static getLocaleForText(stream) {}
424
+ /**
425
+ * Get the normalized locale for the given variant. This will look through
426
+ * the variant to find the locale that represents the content in the variant.
427
+ * This will return 'und' if no language can be found.
428
+ * This should always be used to get the locale from a variant.
429
+ * @param {shaka.extern.Variant} variant
430
+ * @return {string}
431
+ */
432
+ static getLocaleForVariant(variant) {}
433
+ /**
434
+ * Find the locale in |searchSpace| that comes closest to |target|. If no
435
+ * locale is found to be close to |target|, then |null| will be returned.
436
+ * @param {string} target
437
+ * @param {!Iterable.<string>} searchSpace
438
+ * @return {?string}
439
+ */
440
+ static findClosestLocale(target, searchSpace) {}
441
+ };
295
442
  /**
296
443
  * Localization system provided by the shaka ui library.
297
444
  * It can be used to store the various localized forms of
@@ -407,379 +554,28 @@ shaka.ui.Localization.LOCALE_CHANGED;
407
554
  */
408
555
  shaka.ui.Localization.LOCALE_UPDATED;
409
556
  /**
410
- * @summary A set of BufferSource utility functions.
557
+ * @implements {shaka.extern.Cue}
411
558
  */
412
- shaka.util.BufferUtils = class {
413
- /**
414
- * Compare two buffers for equality. For buffers of different types, this
415
- * compares the underlying buffers as binary data.
416
- * @param {?BufferSource} arr1
417
- * @param {?BufferSource} arr2
418
- * @return {boolean}
419
- */
420
- static equal(arr1, arr2) {}
421
- /**
422
- * Gets an ArrayBuffer that contains the data from the given TypedArray. Note
423
- * this will allocate a new ArrayBuffer if the object is a partial view of
424
- * the data.
425
- * @param {!BufferSource} view
426
- * @return {!ArrayBuffer}
427
- */
428
- static toArrayBuffer(view) {}
429
- /**
430
- * Creates a new Uint8Array view on the same buffer. This clamps the values
431
- * to be within the same view (i.e. you can't use this to move past the end
432
- * of the view, even if the underlying buffer is larger). However, you can
433
- * pass a negative offset to access the data before the view.
434
- * @param {BufferSource} data
435
- * @param {number=} offset The offset from the beginning of this data's view
436
- * to start the new view at.
437
- * @param {number=} length The byte length of the new view.
438
- * @return {!Uint8Array}
439
- */
440
- static toUint8(data, offset, length) {}
559
+ shaka.text.Cue = class {
441
560
  /**
442
- * Creates a DataView over the given buffer.
443
- * @see toUint8
444
- * @param {BufferSource} buffer
445
- * @param {number=} offset
446
- * @param {number=} length
447
- * @return {!DataView}
561
+ * @param {number} startTime
562
+ * @param {number} endTime
563
+ * @param {string} payload
448
564
  */
449
- static toDataView(buffer, offset, length) {}
565
+ constructor(startTime, endTime, payload) {}
450
566
  };
451
567
  /**
452
- * @namespace shaka.util.StringUtils
453
- * @summary A set of string utility functions.
454
- */
455
- shaka.util.StringUtils = class {
456
- /**
457
- * Creates a string from the given buffer as UTF-8 encoding.
458
- * @param {?BufferSource} data
459
- * @return {string}
460
- */
461
- static fromUTF8(data) {}
462
- /**
463
- * Creates a string from the given buffer as UTF-16 encoding.
464
- * @param {?BufferSource} data
465
- * @param {boolean} littleEndian
466
- true to read little endian, false to read big.
467
- * @param {boolean=} noThrow true to avoid throwing in cases where we may
468
- * expect invalid input. If noThrow is true and the data has an odd
469
- * length,it will be truncated.
470
- * @return {string}
471
- */
472
- static fromUTF16(data, littleEndian, noThrow) {}
473
- /**
474
- * Creates a string from the given buffer, auto-detecting the encoding that is
475
- * being used. If it cannot detect the encoding, it will throw an exception.
476
- * @param {?BufferSource} data
477
- * @return {string}
478
- */
479
- static fromBytesAutoDetect(data) {}
480
- /**
481
- * Creates a ArrayBuffer from the given string, converting to UTF-8 encoding.
482
- * @param {string} str
483
- * @return {!ArrayBuffer}
484
- */
485
- static toUTF8(str) {}
486
- /**
487
- * Creates a ArrayBuffer from the given string, converting to UTF-16 encoding.
488
- * @param {string} str
489
- * @param {boolean} littleEndian
490
- * @return {!ArrayBuffer}
491
- */
492
- static toUTF16(str, littleEndian) {}
493
- /**
494
- * Resets the fromCharCode method's implementation.
495
- * For debug use.
496
- */
497
- static resetFromCharCode() {}
498
- };
568
+ * @override
569
+ */
570
+ shaka.text.Cue.prototype.startTime;
499
571
  /**
500
- * @summary DataViewReader abstracts a DataView object.
501
- */
502
- shaka.util.DataViewReader = class {
503
- /**
504
- * @param {BufferSource} data
505
- * @param {shaka.util.DataViewReader.Endianness} endianness The endianness.
506
- */
507
- constructor(data, endianness) {}
508
- /**
509
- * @return {boolean} True if the reader has more data, false otherwise.
510
- */
511
- hasMoreData() {}
512
- /**
513
- * Gets the current byte position.
514
- * @return {number}
515
- */
516
- getPosition() {}
517
- /**
518
- * Gets the byte length of the DataView.
519
- * @return {number}
520
- */
521
- getLength() {}
522
- /**
523
- * Reads an unsigned 8 bit integer, and advances the reader.
524
- * @return {number} The integer.
525
- */
526
- readUint8() {}
527
- /**
528
- * Reads an unsigned 16 bit integer, and advances the reader.
529
- * @return {number} The integer.
530
- */
531
- readUint16() {}
532
- /**
533
- * Reads an unsigned 32 bit integer, and advances the reader.
534
- * @return {number} The integer.
535
- */
536
- readUint32() {}
537
- /**
538
- * Reads a signed 32 bit integer, and advances the reader.
539
- * @return {number} The integer.
540
- */
541
- readInt32() {}
542
- /**
543
- * Reads an unsigned 64 bit integer, and advances the reader.
544
- * @return {number} The integer.
545
- */
546
- readUint64() {}
547
- /**
548
- * Reads the specified number of raw bytes.
549
- * @param {number} bytes The number of bytes to read.
550
- * @return {!Uint8Array}
551
- */
552
- readBytes(bytes) {}
553
- /**
554
- * Skips the specified number of bytes.
555
- * @param {number} bytes The number of bytes to skip.
556
- */
557
- skip(bytes) {}
558
- /**
559
- * Rewinds the specified number of bytes.
560
- * @param {number} bytes The number of bytes to rewind.
561
- */
562
- rewind(bytes) {}
563
- /**
564
- * Seeks to a specified position.
565
- * @param {number} position The desired byte position within the DataView.
566
- */
567
- seek(position) {}
568
- /**
569
- * Keeps reading until it reaches a byte that equals to zero. The text is
570
- * assumed to be UTF-8.
571
- * @return {string}
572
- */
573
- readTerminatedString() {}
574
- };
572
+ * @override
573
+ */
574
+ shaka.text.Cue.prototype.direction;
575
575
  /**
576
- * Endianness.
577
- * @enum {number}
578
- */
579
- shaka.util.DataViewReader.Endianness = {
580
- 'BIG_ENDIAN': 0,
581
- 'LITTLE_ENDIAN': 1
582
- };
583
- /**
584
- */
585
- shaka.util.Mp4Parser = class {
586
- /** */
587
- constructor() {}
588
- /**
589
- * Declare a box type as a Box.
590
- * @param {string} type
591
- * @param {!shaka.util.Mp4Parser.CallbackType} definition
592
- * @return {!shaka.util.Mp4Parser}
593
- */
594
- box(type, definition) {}
595
- /**
596
- * Declare a box type as a Full Box.
597
- * @param {string} type
598
- * @param {!shaka.util.Mp4Parser.CallbackType} definition
599
- * @return {!shaka.util.Mp4Parser}
600
- */
601
- fullBox(type, definition) {}
602
- /**
603
- * Stop parsing. Useful for extracting information from partial segments and
604
- * avoiding an out-of-bounds error once you find what you are looking for.
605
- */
606
- stop() {}
607
- /**
608
- * Parse the given data using the added callbacks.
609
- * @param {!BufferSource} data
610
- * @param {boolean=} partialOkay If true, allow reading partial payloads
611
- * from some boxes. If the goal is a child box, we can sometimes find it
612
- * without enough data to find all child boxes.
613
- * @param {boolean=} stopOnPartial If true, stop reading if an incomplete
614
- * box is detected.
615
- */
616
- parse(data, partialOkay, stopOnPartial) {}
617
- /**
618
- * Parse the next box on the current level.
619
- * @param {number} absStart The absolute start position in the original
620
- * byte array.
621
- * @param {!shaka.util.DataViewReader} reader
622
- * @param {boolean=} partialOkay If true, allow reading partial payloads
623
- * from some boxes. If the goal is a child box, we can sometimes find it
624
- * without enough data to find all child boxes.
625
- * @param {boolean=} stopOnPartial If true, stop reading if an incomplete
626
- * box is detected.
627
- */
628
- parseNext(absStart, reader, partialOkay, stopOnPartial) {}
629
- /**
630
- * A callback that tells the Mp4 parser to treat the body of a box as a series
631
- * of boxes. The number of boxes is limited by the size of the parent box.
632
- * @param {!shaka.extern.ParsedBox} box
633
- */
634
- static children(box) {}
635
- /**
636
- * A callback that tells the Mp4 parser to treat the body of a box as a sample
637
- * description. A sample description box has a fixed number of children. The
638
- * number of children is represented by a 4 byte unsigned integer. Each child
639
- * is a box.
640
- * @param {!shaka.extern.ParsedBox} box
641
- */
642
- static sampleDescription(box) {}
643
- /**
644
- * Create a callback that tells the Mp4 parser to treat the body of a box as a
645
- * binary blob and to parse the body's contents using the provided callback.
646
- * @param {function(!Uint8Array)} callback
647
- * @return {!shaka.util.Mp4Parser.CallbackType}
648
- */
649
- static allData(callback) {}
650
- /**
651
- * Convert an integer type from a box into an ascii string name.
652
- * Useful for debugging.
653
- * @param {number} type The type of the box, a uint32.
654
- * @return {string}
655
- */
656
- static typeToString(type) {}
657
- /**
658
- * Find the header size of the box.
659
- * Useful for modifying boxes in place or finding the exact offset of a field.
660
- * @param {shaka.extern.ParsedBox} box
661
- * @return {number}
662
- */
663
- static headerSize(box) {}
664
- };
665
- /**
666
- * @typedef {function(!shaka.extern.ParsedBox)}
667
- */
668
- shaka.util.Mp4Parser.CallbackType;
669
- /**
670
- * A timer allows a single function to be executed at a later time or at
671
- * regular intervals.
672
- * @final
673
- */
674
- shaka.util.Timer = class {
675
- /**
676
- * Create a new timer. A timer is committed to a single callback function.
677
- * While there is no technical reason to do this, it is far easier to
678
- * understand and use timers when they are connected to one functional idea.
679
- * @param {function()} onTick
680
- */
681
- constructor(onTick) {}
682
- /**
683
- * Have the timer call |onTick| now.
684
- * @return {!shaka.util.Timer}
685
- */
686
- tickNow() {}
687
- /**
688
- * Have the timer call |onTick| after |seconds| has elapsed unless |stop| is
689
- * called first.
690
- * @param {number} seconds
691
- * @return {!shaka.util.Timer}
692
- */
693
- tickAfter(seconds) {}
694
- /**
695
- * Have the timer call |onTick| every |seconds| until |stop| is called.
696
- * @param {number} seconds
697
- * @return {!shaka.util.Timer}
698
- */
699
- tickEvery(seconds) {}
700
- /**
701
- * Stop the timer and clear the previous behaviour. The timer is still usable
702
- * after calling |stop|.
703
- */
704
- stop() {}
705
- };
706
- /**
707
- * @summary A set of Uint8Array utility functions.
708
- */
709
- shaka.util.Uint8ArrayUtils = class {
710
- /**
711
- * Compare two Uint8Arrays for equality.
712
- * @param {Uint8Array} arr1
713
- * @param {Uint8Array} arr2
714
- * @return {boolean}
715
- * @deprecated
716
- */
717
- static equal(arr1, arr2) {}
718
- /**
719
- * Convert a buffer to a base64 string. The output will be standard
720
- * alphabet as opposed to base64url safe alphabet.
721
- * @param {BufferSource} data
722
- * @return {string}
723
- */
724
- static toStandardBase64(data) {}
725
- /**
726
- * Convert a buffer to a base64 string. The output will always use the
727
- * alternate encoding/alphabet also known as "base64url".
728
- * @param {BufferSource} data
729
- * @param {boolean=} padding If true, pad the output with equals signs.
730
- * Defaults to true.
731
- * @return {string}
732
- */
733
- static toBase64(data, padding) {}
734
- /**
735
- * Convert a base64 string to a Uint8Array. Accepts either the standard
736
- * alphabet or the alternate "base64url" alphabet.
737
- * @param {string} str
738
- * @return {!Uint8Array}
739
- */
740
- static fromBase64(str) {}
741
- /**
742
- * Convert a hex string to a Uint8Array.
743
- * @param {string} str
744
- * @return {!Uint8Array}
745
- */
746
- static fromHex(str) {}
747
- /**
748
- * Convert a buffer to a hex string.
749
- * @param {BufferSource} data
750
- * @return {string}
751
- */
752
- static toHex(data) {}
753
- /**
754
- * Concatenate buffers.
755
- * @param {...BufferSource} varArgs
756
- * @return {!Uint8Array}
757
- */
758
- static concat(...varArgs) {}
759
- };
760
- /**
761
- * @implements {shaka.extern.Cue}
762
- */
763
- shaka.text.Cue = class {
764
- /**
765
- * @param {number} startTime
766
- * @param {number} endTime
767
- * @param {string} payload
768
- */
769
- constructor(startTime, endTime, payload) {}
770
- };
771
- /**
772
- * @override
773
- */
774
- shaka.text.Cue.prototype.startTime;
775
- /**
776
- * @override
777
- */
778
- shaka.text.Cue.prototype.direction;
779
- /**
780
- * @override
781
- */
782
- shaka.text.Cue.prototype.endTime;
576
+ * @override
577
+ */
578
+ shaka.text.Cue.prototype.endTime;
783
579
  /**
784
580
  * @override
785
581
  * @type {string}
@@ -847,6 +643,14 @@ shaka.text.Cue.prototype.backgroundImage;
847
643
  * @override
848
644
  */
849
645
  shaka.text.Cue.prototype.border;
646
+ /**
647
+ * @override
648
+ */
649
+ shaka.text.Cue.prototype.textStrokeColor;
650
+ /**
651
+ * @override
652
+ */
653
+ shaka.text.Cue.prototype.textStrokeWidth;
850
654
  /**
851
655
  * @override
852
656
  */
@@ -1085,6 +889,48 @@ shaka.text.CueRegion.scrollMode = {
1085
889
  'NONE': '',
1086
890
  'UP': 'up'
1087
891
  };
892
+ /**
893
+ * @summary A set of BufferSource utility functions.
894
+ */
895
+ shaka.util.BufferUtils = class {
896
+ /**
897
+ * Compare two buffers for equality. For buffers of different types, this
898
+ * compares the underlying buffers as binary data.
899
+ * @param {?BufferSource} arr1
900
+ * @param {?BufferSource} arr2
901
+ * @return {boolean}
902
+ */
903
+ static equal(arr1, arr2) {}
904
+ /**
905
+ * Gets an ArrayBuffer that contains the data from the given TypedArray. Note
906
+ * this will allocate a new ArrayBuffer if the object is a partial view of
907
+ * the data.
908
+ * @param {!BufferSource} view
909
+ * @return {!ArrayBuffer}
910
+ */
911
+ static toArrayBuffer(view) {}
912
+ /**
913
+ * Creates a new Uint8Array view on the same buffer. This clamps the values
914
+ * to be within the same view (i.e. you can't use this to move past the end
915
+ * of the view, even if the underlying buffer is larger). However, you can
916
+ * pass a negative offset to access the data before the view.
917
+ * @param {BufferSource} data
918
+ * @param {number=} offset The offset from the beginning of this data's view
919
+ * to start the new view at.
920
+ * @param {number=} length The byte length of the new view.
921
+ * @return {!Uint8Array}
922
+ */
923
+ static toUint8(data, offset, length) {}
924
+ /**
925
+ * Creates a DataView over the given buffer.
926
+ * @see toUint8
927
+ * @param {BufferSource} buffer
928
+ * @param {number=} offset
929
+ * @param {number=} length
930
+ * @return {!DataView}
931
+ */
932
+ static toDataView(buffer, offset, length) {}
933
+ };
1088
934
  /**
1089
935
  * An interface to standardize how objects are destroyed.
1090
936
  * @interface
@@ -1121,6 +967,108 @@ shaka.dependencies = class {
1121
967
  shaka.dependencies.Allowed = {
1122
968
  muxjs: 'muxjs'
1123
969
  };
970
+ /**
971
+ * @namespace shaka.util.StringUtils
972
+ * @summary A set of string utility functions.
973
+ */
974
+ shaka.util.StringUtils = class {
975
+ /**
976
+ * Creates a string from the given buffer as UTF-8 encoding.
977
+ * @param {?BufferSource} data
978
+ * @return {string}
979
+ */
980
+ static fromUTF8(data) {}
981
+ /**
982
+ * Creates a string from the given buffer as UTF-16 encoding.
983
+ * @param {?BufferSource} data
984
+ * @param {boolean} littleEndian
985
+ true to read little endian, false to read big.
986
+ * @param {boolean=} noThrow true to avoid throwing in cases where we may
987
+ * expect invalid input. If noThrow is true and the data has an odd
988
+ * length,it will be truncated.
989
+ * @return {string}
990
+ */
991
+ static fromUTF16(data, littleEndian, noThrow) {}
992
+ /**
993
+ * Creates a string from the given buffer, auto-detecting the encoding that is
994
+ * being used. If it cannot detect the encoding, it will throw an exception.
995
+ * @param {?BufferSource} data
996
+ * @return {string}
997
+ */
998
+ static fromBytesAutoDetect(data) {}
999
+ /**
1000
+ * Creates a ArrayBuffer from the given string, converting to UTF-8 encoding.
1001
+ * @param {string} str
1002
+ * @return {!ArrayBuffer}
1003
+ */
1004
+ static toUTF8(str) {}
1005
+ /**
1006
+ * Creates a ArrayBuffer from the given string, converting to UTF-16 encoding.
1007
+ * @param {string} str
1008
+ * @param {boolean} littleEndian
1009
+ * @return {!ArrayBuffer}
1010
+ */
1011
+ static toUTF16(str, littleEndian) {}
1012
+ /**
1013
+ * Resets the fromCharCode method's implementation.
1014
+ * For debug use.
1015
+ */
1016
+ static resetFromCharCode() {}
1017
+ };
1018
+ /**
1019
+ * @summary A set of Uint8Array utility functions.
1020
+ */
1021
+ shaka.util.Uint8ArrayUtils = class {
1022
+ /**
1023
+ * Compare two Uint8Arrays for equality.
1024
+ * @param {Uint8Array} arr1
1025
+ * @param {Uint8Array} arr2
1026
+ * @return {boolean}
1027
+ * @deprecated
1028
+ */
1029
+ static equal(arr1, arr2) {}
1030
+ /**
1031
+ * Convert a buffer to a base64 string. The output will be standard
1032
+ * alphabet as opposed to base64url safe alphabet.
1033
+ * @param {BufferSource} data
1034
+ * @return {string}
1035
+ */
1036
+ static toStandardBase64(data) {}
1037
+ /**
1038
+ * Convert a buffer to a base64 string. The output will always use the
1039
+ * alternate encoding/alphabet also known as "base64url".
1040
+ * @param {BufferSource} data
1041
+ * @param {boolean=} padding If true, pad the output with equals signs.
1042
+ * Defaults to true.
1043
+ * @return {string}
1044
+ */
1045
+ static toBase64(data, padding) {}
1046
+ /**
1047
+ * Convert a base64 string to a Uint8Array. Accepts either the standard
1048
+ * alphabet or the alternate "base64url" alphabet.
1049
+ * @param {string} str
1050
+ * @return {!Uint8Array}
1051
+ */
1052
+ static fromBase64(str) {}
1053
+ /**
1054
+ * Convert a hex string to a Uint8Array.
1055
+ * @param {string} str
1056
+ * @return {!Uint8Array}
1057
+ */
1058
+ static fromHex(str) {}
1059
+ /**
1060
+ * Convert a buffer to a hex string.
1061
+ * @param {BufferSource} data
1062
+ * @return {string}
1063
+ */
1064
+ static toHex(data) {}
1065
+ /**
1066
+ * Concatenate buffers.
1067
+ * @param {...BufferSource} varArgs
1068
+ * @return {!Uint8Array}
1069
+ */
1070
+ static concat(...varArgs) {}
1071
+ };
1124
1072
  /**
1125
1073
  * @summary Manages text parsers and cues.
1126
1074
  * @implements {shaka.util.IDestroyable}
@@ -1147,70 +1095,42 @@ shaka.text.TextEngine = class {
1147
1095
  destroy() {}
1148
1096
  };
1149
1097
  /**
1150
- * An interface to standardize how objects release internal references
1151
- * synchronously. If an object needs to asynchronously release references, then
1152
- * it should use 'shaka.util.IDestroyable'.
1153
- * @interface
1154
- */
1155
- shaka.util.IReleasable = class {
1156
- /**
1157
- * Request that this object release all internal references.
1158
- */
1159
- release() {}
1160
- };
1161
- /**
1162
- * @summary
1163
- * An EventManager maintains a collection of "event
1164
- * bindings" between event targets and event listeners.
1165
- * @implements {shaka.util.IReleasable}
1098
+ * A timer allows a single function to be executed at a later time or at
1099
+ * regular intervals.
1100
+ * @final
1166
1101
  */
1167
- shaka.util.EventManager = class {
1168
- /** */
1169
- constructor() {}
1102
+ shaka.util.Timer = class {
1170
1103
  /**
1171
- * Detaches all event listeners.
1172
- * @override
1104
+ * Create a new timer. A timer is committed to a single callback function.
1105
+ * While there is no technical reason to do this, it is far easier to
1106
+ * understand and use timers when they are connected to one functional idea.
1107
+ * @param {function()} onTick
1173
1108
  */
1174
- release() {}
1109
+ constructor(onTick) {}
1175
1110
  /**
1176
- * Attaches an event listener to an event target.
1177
- * @param {EventTarget} target The event target.
1178
- * @param {string} type The event type.
1179
- * @param {shaka.util.EventManager.ListenerType} listener The event listener.
1180
- * @param {(boolean|!AddEventListenerOptions)=} options An object that
1181
- * specifies characteristics about the event listener.
1182
- * The passive option, if true, indicates that this function will never
1183
- * call preventDefault(), which improves scrolling performance.
1111
+ * Have the timer call |onTick| now.
1112
+ * @return {!shaka.util.Timer}
1184
1113
  */
1185
- listen(target, type, listener, options) {}
1114
+ tickNow() {}
1186
1115
  /**
1187
- * Attaches an event listener to an event target. The listener will be
1188
- * removed when the first instance of the event is fired.
1189
- * @param {EventTarget} target The event target.
1190
- * @param {string} type The event type.
1191
- * @param {shaka.util.EventManager.ListenerType} listener The event listener.
1192
- * @param {(boolean|!AddEventListenerOptions)=} options An object that
1193
- * specifies characteristics about the event listener.
1194
- * The passive option, if true, indicates that this function will never
1195
- * call preventDefault(), which improves scrolling performance.
1116
+ * Have the timer call |onTick| after |seconds| has elapsed unless |stop| is
1117
+ * called first.
1118
+ * @param {number} seconds
1119
+ * @return {!shaka.util.Timer}
1196
1120
  */
1197
- listenOnce(target, type, listener, options) {}
1121
+ tickAfter(seconds) {}
1198
1122
  /**
1199
- * Detaches an event listener from an event target.
1200
- * @param {EventTarget} target The event target.
1201
- * @param {string} type The event type.
1202
- * @param {shaka.util.EventManager.ListenerType=} listener The event listener.
1123
+ * Have the timer call |onTick| every |seconds| until |stop| is called.
1124
+ * @param {number} seconds
1125
+ * @return {!shaka.util.Timer}
1203
1126
  */
1204
- unlisten(target, type, listener) {}
1127
+ tickEvery(seconds) {}
1205
1128
  /**
1206
- * Detaches all event listeners from all targets.
1129
+ * Stop the timer and clear the previous behaviour. The timer is still usable
1130
+ * after calling |stop|.
1207
1131
  */
1208
- removeAll() {}
1132
+ stop() {}
1209
1133
  };
1210
- /**
1211
- * @typedef {function(!Event)}
1212
- */
1213
- shaka.util.EventManager.ListenerType;
1214
1134
  /**
1215
1135
  * @summary
1216
1136
  * <p>
@@ -1371,8 +1291,12 @@ shaka.net.NetworkingEngine = class extends shaka.util.FakeEventTarget {
1371
1291
  * @param {function(number, number)=} onProgressUpdated Called when a progress
1372
1292
  * event is triggered. Passed the duration, in milliseconds, that the
1373
1293
  * request took, and the number of bytes transferred.
1294
+ * @param {shaka.net.NetworkingEngine.OnHeadersReceived=} onHeadersReceived
1295
+ * Called when the headers are received for a download.
1296
+ * @param {shaka.net.NetworkingEngine.OnDownloadFailed=} onDownloadFailed
1297
+ * Called when a download fails, for any reason.
1374
1298
  */
1375
- constructor(onProgressUpdated) {}
1299
+ constructor(onProgressUpdated, onHeadersReceived, onDownloadFailed) {}
1376
1300
  /**
1377
1301
  * @param {boolean} forceHTTPS
1378
1302
  */
@@ -1497,7 +1421,8 @@ shaka.net.NetworkingEngine.RequestType = {
1497
1421
  'SEGMENT': 1,
1498
1422
  'LICENSE': 2,
1499
1423
  'APP': 3,
1500
- 'TIMING': 4
1424
+ 'TIMING': 4,
1425
+ 'SERVER_CERTIFICATE': 5
1501
1426
  };
1502
1427
  /**
1503
1428
  * Priority level for network scheme plugins.
@@ -1510,6 +1435,92 @@ shaka.net.NetworkingEngine.PluginPriority = {
1510
1435
  'PREFERRED': 2,
1511
1436
  'APPLICATION': 3
1512
1437
  };
1438
+ /**
1439
+ * @typedef {function(
1440
+ * !Object.<string, string>,
1441
+ * !shaka.extern.Request,
1442
+ * !shaka.net.NetworkingEngine.RequestType)}
1443
+ * @description
1444
+ * A callback function that passes the shaka.extern.HeadersReceived along to
1445
+ * the player, plus some extra data.
1446
+ */
1447
+ shaka.net.NetworkingEngine.OnHeadersReceived;
1448
+ /**
1449
+ * @typedef {function(
1450
+ * !shaka.extern.Request,
1451
+ * ?shaka.util.Error,
1452
+ * number,
1453
+ * boolean)}
1454
+ * @description
1455
+ * A callback function that notifies the player when a download fails, for any
1456
+ * reason (e.g. even if the download was aborted).
1457
+ */
1458
+ shaka.net.NetworkingEngine.OnDownloadFailed;
1459
+ /**
1460
+ * An interface to standardize how objects release internal references
1461
+ * synchronously. If an object needs to asynchronously release references, then
1462
+ * it should use 'shaka.util.IDestroyable'.
1463
+ * @interface
1464
+ */
1465
+ shaka.util.IReleasable = class {
1466
+ /**
1467
+ * Request that this object release all internal references.
1468
+ */
1469
+ release() {}
1470
+ };
1471
+ /**
1472
+ * @summary
1473
+ * An EventManager maintains a collection of "event
1474
+ * bindings" between event targets and event listeners.
1475
+ * @implements {shaka.util.IReleasable}
1476
+ */
1477
+ shaka.util.EventManager = class {
1478
+ /** */
1479
+ constructor() {}
1480
+ /**
1481
+ * Detaches all event listeners.
1482
+ * @override
1483
+ */
1484
+ release() {}
1485
+ /**
1486
+ * Attaches an event listener to an event target.
1487
+ * @param {EventTarget} target The event target.
1488
+ * @param {string} type The event type.
1489
+ * @param {shaka.util.EventManager.ListenerType} listener The event listener.
1490
+ * @param {(boolean|!AddEventListenerOptions)=} options An object that
1491
+ * specifies characteristics about the event listener.
1492
+ * The passive option, if true, indicates that this function will never
1493
+ * call preventDefault(), which improves scrolling performance.
1494
+ */
1495
+ listen(target, type, listener, options) {}
1496
+ /**
1497
+ * Attaches an event listener to an event target. The listener will be
1498
+ * removed when the first instance of the event is fired.
1499
+ * @param {EventTarget} target The event target.
1500
+ * @param {string} type The event type.
1501
+ * @param {shaka.util.EventManager.ListenerType} listener The event listener.
1502
+ * @param {(boolean|!AddEventListenerOptions)=} options An object that
1503
+ * specifies characteristics about the event listener.
1504
+ * The passive option, if true, indicates that this function will never
1505
+ * call preventDefault(), which improves scrolling performance.
1506
+ */
1507
+ listenOnce(target, type, listener, options) {}
1508
+ /**
1509
+ * Detaches an event listener from an event target.
1510
+ * @param {EventTarget} target The event target.
1511
+ * @param {string} type The event type.
1512
+ * @param {shaka.util.EventManager.ListenerType=} listener The event listener.
1513
+ */
1514
+ unlisten(target, type, listener) {}
1515
+ /**
1516
+ * Detaches all event listeners from all targets.
1517
+ */
1518
+ removeAll() {}
1519
+ };
1520
+ /**
1521
+ * @typedef {function(!Event)}
1522
+ */
1523
+ shaka.util.EventManager.ListenerType;
1513
1524
  /**
1514
1525
  * @summary A set of FairPlay utility functions.
1515
1526
  */
@@ -1563,6 +1574,176 @@ shaka.media.ManifestParser = class {
1563
1574
  */
1564
1575
  static unregisterParserByMime(mimeType) {}
1565
1576
  };
1577
+ /**
1578
+ * @summary DataViewReader abstracts a DataView object.
1579
+ */
1580
+ shaka.util.DataViewReader = class {
1581
+ /**
1582
+ * @param {BufferSource} data
1583
+ * @param {shaka.util.DataViewReader.Endianness} endianness The endianness.
1584
+ */
1585
+ constructor(data, endianness) {}
1586
+ /**
1587
+ * @return {boolean} True if the reader has more data, false otherwise.
1588
+ */
1589
+ hasMoreData() {}
1590
+ /**
1591
+ * Gets the current byte position.
1592
+ * @return {number}
1593
+ */
1594
+ getPosition() {}
1595
+ /**
1596
+ * Gets the byte length of the DataView.
1597
+ * @return {number}
1598
+ */
1599
+ getLength() {}
1600
+ /**
1601
+ * Reads an unsigned 8 bit integer, and advances the reader.
1602
+ * @return {number} The integer.
1603
+ */
1604
+ readUint8() {}
1605
+ /**
1606
+ * Reads an unsigned 16 bit integer, and advances the reader.
1607
+ * @return {number} The integer.
1608
+ */
1609
+ readUint16() {}
1610
+ /**
1611
+ * Reads an unsigned 32 bit integer, and advances the reader.
1612
+ * @return {number} The integer.
1613
+ */
1614
+ readUint32() {}
1615
+ /**
1616
+ * Reads a signed 32 bit integer, and advances the reader.
1617
+ * @return {number} The integer.
1618
+ */
1619
+ readInt32() {}
1620
+ /**
1621
+ * Reads an unsigned 64 bit integer, and advances the reader.
1622
+ * @return {number} The integer.
1623
+ */
1624
+ readUint64() {}
1625
+ /**
1626
+ * Reads the specified number of raw bytes.
1627
+ * @param {number} bytes The number of bytes to read.
1628
+ * @return {!Uint8Array}
1629
+ */
1630
+ readBytes(bytes) {}
1631
+ /**
1632
+ * Skips the specified number of bytes.
1633
+ * @param {number} bytes The number of bytes to skip.
1634
+ */
1635
+ skip(bytes) {}
1636
+ /**
1637
+ * Rewinds the specified number of bytes.
1638
+ * @param {number} bytes The number of bytes to rewind.
1639
+ */
1640
+ rewind(bytes) {}
1641
+ /**
1642
+ * Seeks to a specified position.
1643
+ * @param {number} position The desired byte position within the DataView.
1644
+ */
1645
+ seek(position) {}
1646
+ /**
1647
+ * Keeps reading until it reaches a byte that equals to zero. The text is
1648
+ * assumed to be UTF-8.
1649
+ * @return {string}
1650
+ */
1651
+ readTerminatedString() {}
1652
+ };
1653
+ /**
1654
+ * Endianness.
1655
+ * @enum {number}
1656
+ */
1657
+ shaka.util.DataViewReader.Endianness = {
1658
+ 'BIG_ENDIAN': 0,
1659
+ 'LITTLE_ENDIAN': 1
1660
+ };
1661
+ /**
1662
+ */
1663
+ shaka.util.Mp4Parser = class {
1664
+ /** */
1665
+ constructor() {}
1666
+ /**
1667
+ * Declare a box type as a Box.
1668
+ * @param {string} type
1669
+ * @param {!shaka.util.Mp4Parser.CallbackType} definition
1670
+ * @return {!shaka.util.Mp4Parser}
1671
+ */
1672
+ box(type, definition) {}
1673
+ /**
1674
+ * Declare a box type as a Full Box.
1675
+ * @param {string} type
1676
+ * @param {!shaka.util.Mp4Parser.CallbackType} definition
1677
+ * @return {!shaka.util.Mp4Parser}
1678
+ */
1679
+ fullBox(type, definition) {}
1680
+ /**
1681
+ * Stop parsing. Useful for extracting information from partial segments and
1682
+ * avoiding an out-of-bounds error once you find what you are looking for.
1683
+ */
1684
+ stop() {}
1685
+ /**
1686
+ * Parse the given data using the added callbacks.
1687
+ * @param {!BufferSource} data
1688
+ * @param {boolean=} partialOkay If true, allow reading partial payloads
1689
+ * from some boxes. If the goal is a child box, we can sometimes find it
1690
+ * without enough data to find all child boxes.
1691
+ * @param {boolean=} stopOnPartial If true, stop reading if an incomplete
1692
+ * box is detected.
1693
+ */
1694
+ parse(data, partialOkay, stopOnPartial) {}
1695
+ /**
1696
+ * Parse the next box on the current level.
1697
+ * @param {number} absStart The absolute start position in the original
1698
+ * byte array.
1699
+ * @param {!shaka.util.DataViewReader} reader
1700
+ * @param {boolean=} partialOkay If true, allow reading partial payloads
1701
+ * from some boxes. If the goal is a child box, we can sometimes find it
1702
+ * without enough data to find all child boxes.
1703
+ * @param {boolean=} stopOnPartial If true, stop reading if an incomplete
1704
+ * box is detected.
1705
+ */
1706
+ parseNext(absStart, reader, partialOkay, stopOnPartial) {}
1707
+ /**
1708
+ * A callback that tells the Mp4 parser to treat the body of a box as a series
1709
+ * of boxes. The number of boxes is limited by the size of the parent box.
1710
+ * @param {!shaka.extern.ParsedBox} box
1711
+ */
1712
+ static children(box) {}
1713
+ /**
1714
+ * A callback that tells the Mp4 parser to treat the body of a box as a sample
1715
+ * description. A sample description box has a fixed number of children. The
1716
+ * number of children is represented by a 4 byte unsigned integer. Each child
1717
+ * is a box.
1718
+ * @param {!shaka.extern.ParsedBox} box
1719
+ */
1720
+ static sampleDescription(box) {}
1721
+ /**
1722
+ * Create a callback that tells the Mp4 parser to treat the body of a box as a
1723
+ * binary blob and to parse the body's contents using the provided callback.
1724
+ * @param {function(!Uint8Array)} callback
1725
+ * @return {!shaka.util.Mp4Parser.CallbackType}
1726
+ */
1727
+ static allData(callback) {}
1728
+ /**
1729
+ * Convert an integer type from a box into an ascii string name.
1730
+ * Useful for debugging.
1731
+ * @param {number} type The type of the box, a uint32.
1732
+ * @return {string}
1733
+ */
1734
+ static typeToString(type) {}
1735
+ /**
1736
+ * Find the header size of the box.
1737
+ * Useful for modifying boxes in place or finding the exact offset of a field.
1738
+ * @param {shaka.extern.ParsedBox} box
1739
+ * @return {number}
1740
+ */
1741
+ static headerSize(box) {}
1742
+ };
1743
+ /**
1744
+ * @typedef {function(!shaka.extern.ParsedBox)}
1745
+ */
1746
+ shaka.util.Mp4Parser.CallbackType;
1566
1747
  /**
1567
1748
  * Creates an InitSegmentReference, which provides the location to an
1568
1749
  * initialization segment.
@@ -1573,11 +1754,13 @@ shaka.media.InitSegmentReference = class {
1573
1754
  * of the resource containing the segment.
1574
1755
  * @param {number} startByte The offset from the start of the resource to the
1575
1756
  * start of the segment.
1576
- * @param {?number} endByte The offset from the start of the resource to the
1577
- * end of the segment, inclusive. A value of null indicates that the
1757
+ * @param {?number} endByte The offset from the start of the resource
1758
+ * to the end of the segment, inclusive. A value of null indicates that the
1578
1759
  * segment extends to the end of the resource.
1760
+ * @param {null|shaka.extern.MediaQualityInfo=} mediaQuality Information about
1761
+ * the quality of the media associated with this init segment.
1579
1762
  */
1580
- constructor(uris, startByte, endByte) {}
1763
+ constructor(uris, startByte, endByte, mediaQuality) {}
1581
1764
  /**
1582
1765
  * Returns the offset from the start of the resource to the
1583
1766
  * start of the segment.
@@ -1633,9 +1816,13 @@ shaka.media.SegmentReference = class {
1633
1816
  * presentation. Any content from after this time will be removed by
1634
1817
  * MediaSource.
1635
1818
  * @param {!Array.<!shaka.media.SegmentReference>=} partialReferences
1636
- A list of SegmentReferences for the partial segments.
1819
+ * A list of SegmentReferences for the partial segments.
1820
+ * @param {?string=} tilesLayout
1821
+ * The value is a grid-item-dimension consisting of two positive decimal
1822
+ * integers in the format: column-x-row ('4x3'). It describes the
1823
+ * arrangement of Images in a Grid. The minimum valid LAYOUT is '1x1'.
1637
1824
  */
1638
- constructor(startTime, endTime, uris, startByte, endByte, initSegmentReference, timestampOffset, appendWindowStart, appendWindowEnd, partialReferences) {}
1825
+ constructor(startTime, endTime, uris, startByte, endByte, initSegmentReference, timestampOffset, appendWindowStart, appendWindowEnd, partialReferences, tilesLayout) {}
1639
1826
  /**
1640
1827
  * Creates and returns the URIs of the resource containing the segment.
1641
1828
  * @return {!Array.<string>}
@@ -1664,6 +1851,11 @@ shaka.media.SegmentReference = class {
1664
1851
  * @return {?number}
1665
1852
  */
1666
1853
  getEndByte() {}
1854
+ /**
1855
+ * Returns the segment's tiles layout. Only defined in image segments.
1856
+ * @return {?string}
1857
+ */
1858
+ getTilesLayout() {}
1667
1859
  };
1668
1860
  /**
1669
1861
  * PresentationTimeline.
@@ -2099,6 +2291,46 @@ shaka.text.UITextDisplayer = class {
2099
2291
  */
2100
2292
  shaka.text.WebVttGenerator = class {
2101
2293
  };
2294
+ /**
2295
+ * @typedef {{
2296
+ * type: string,
2297
+ * init: boolean,
2298
+ * duration: number,
2299
+ * mimeType: string,
2300
+ * codecs: string,
2301
+ * bandwidth: (number|undefined)
2302
+ * }}
2303
+ * @property {string} type
2304
+ * The media type
2305
+ * @property {boolean} init
2306
+ * Flag indicating whether the segment is an init segment
2307
+ * @property {number} duration
2308
+ * The duration of the segment in seconds
2309
+ * @property {string} mimeType
2310
+ * The segment's mime type
2311
+ * @property {string} codecs
2312
+ * The segment's codecs
2313
+ * @property {(number|undefined)} bandwidth
2314
+ * The segment's variation bandwidth
2315
+ */
2316
+ shaka.util.CmcdManager.SegmentInfo;
2317
+ /**
2318
+ * @typedef {{
2319
+ * format: shaka.util.CmcdManager.StreamingFormat
2320
+ * }}
2321
+ * @property {shaka.util.CmcdManager.StreamingFormat} format
2322
+ * The manifest's stream format
2323
+ */
2324
+ shaka.util.CmcdManager.ManifestInfo;
2325
+ /**
2326
+ * @enum {string}
2327
+ */
2328
+ shaka.util.CmcdManager.StreamingFormat = {
2329
+ DASH: 'd',
2330
+ HLS: 'h',
2331
+ SMOOTH: 's',
2332
+ OTHER: 'o'
2333
+ };
2102
2334
  /** */
2103
2335
  shaka.util.ConfigUtils = class {
2104
2336
  /**
@@ -2238,6 +2470,14 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
2238
2470
  * @return {!Promise}
2239
2471
  */
2240
2472
  unload(initializeMediaSource) {}
2473
+ /**
2474
+ * Provides a way to update the stream start position during the media loading
2475
+ * process. Can for example be called from the <code>manifestparsed</code>
2476
+ * event handler to update the start position based on information in the
2477
+ * manifest.
2478
+ * @param {number} startTime
2479
+ */
2480
+ updateStartTime(startTime) {}
2241
2481
  /**
2242
2482
  * Tell the player to load the content at <code>assetUri</code> and start
2243
2483
  * playback at <code>startTime</code>. Before calling <code>load</code>,
@@ -2285,6 +2525,11 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
2285
2525
  * @return {shaka.extern.PlayerConfiguration}
2286
2526
  */
2287
2527
  getConfiguration() {}
2528
+ /**
2529
+ * Returns the ratio of video length buffered compared to buffering Goal
2530
+ * @return {number}
2531
+ */
2532
+ getBufferFullness() {}
2288
2533
  /**
2289
2534
  * Reset configuration to default.
2290
2535
  */
@@ -2347,6 +2592,10 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
2347
2592
  * @return {{start: number, end: number}}
2348
2593
  */
2349
2594
  seekRange() {}
2595
+ /**
2596
+ * Go to live in a live stream.
2597
+ */
2598
+ goToLive() {}
2350
2599
  /**
2351
2600
  * Get the key system currently used by EME. If EME is not being used, this
2352
2601
  * will return an empty string. If the player has not loaded content, this
@@ -2528,6 +2777,17 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
2528
2777
  * @return {boolean}
2529
2778
  */
2530
2779
  isTextTrackVisible() {}
2780
+ /**
2781
+ * Return a list of chapters tracks.
2782
+ * @return {!Array.<shaka.extern.Track>}
2783
+ */
2784
+ getChaptersTracks() {}
2785
+ /**
2786
+ * This returns the list of chapters.
2787
+ * @param {string} language
2788
+ * @return {!Array.<shaka.extern.Chapter>}
2789
+ */
2790
+ getChapters(language) {}
2531
2791
  /**
2532
2792
  * Enable or disable the text displayer. If the player is in an unloaded
2533
2793
  * state, the request will be applied next time content is loaded.
@@ -2591,6 +2851,16 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
2591
2851
  * @return {!Promise.<shaka.extern.Track>}
2592
2852
  */
2593
2853
  addTextTrackAsync(uri, language, kind, mimeType, codec, label, forced) {}
2854
+ /**
2855
+ * Adds the given chapters track to the loaded manifest. <code>load()</code>
2856
+ * must resolve before calling. The presentation must have a duration.
2857
+ * This returns the created track.
2858
+ * @param {string} uri
2859
+ * @param {string} language
2860
+ * @param {string=} mimeType
2861
+ * @return {!Promise.<shaka.extern.Track>}
2862
+ */
2863
+ addChaptersTrack(uri, language, mimeType) {}
2594
2864
  /**
2595
2865
  * Set the maximum resolution that the platform's hardware can handle.
2596
2866
  * This will be called automatically by <code>shaka.cast.CastReceiver</code>
@@ -2717,6 +2987,10 @@ shaka.ads.ClientSideAd = class {
2717
2987
  * @override
2718
2988
  */
2719
2989
  isMuted() {}
2990
+ /**
2991
+ * @override
2992
+ */
2993
+ isLinear() {}
2720
2994
  /**
2721
2995
  * @override
2722
2996
  */
@@ -2799,6 +3073,10 @@ shaka.ads.ServerSideAd = class {
2799
3073
  * @override
2800
3074
  */
2801
3075
  isMuted() {}
3076
+ /**
3077
+ * @override
3078
+ */
3079
+ isLinear() {}
2802
3080
  /**
2803
3081
  * @override
2804
3082
  */
@@ -2863,6 +3141,11 @@ shaka.ads.AdManager = class extends shaka.util.FakeEventTarget {
2863
3141
  * @override
2864
3142
  */
2865
3143
  replaceServerSideAdTagParameters(adTagParameters) {}
3144
+ /**
3145
+ * @return {!Array.<!shaka.extern.AdCuePoint>}
3146
+ * @override
3147
+ */
3148
+ getServerSideCuePoints() {}
2866
3149
  /**
2867
3150
  * @return {shaka.extern.AdsStats}
2868
3151
  * @override
@@ -3264,9 +3547,11 @@ shaka.net.HttpFetchPlugin = class {
3264
3547
  * @param {shaka.net.NetworkingEngine.RequestType} requestType
3265
3548
  * @param {shaka.extern.ProgressUpdated} progressUpdated Called when a
3266
3549
  * progress event happened.
3550
+ * @param {shaka.extern.HeadersReceived} headersReceived Called when the
3551
+ * headers for the download are received, but before the body is.
3267
3552
  * @return {!shaka.extern.IAbortableOperation.<shaka.extern.Response>}
3268
3553
  */
3269
- static parse(uri, request, requestType, progressUpdated) {}
3554
+ static parse(uri, request, requestType, progressUpdated, headersReceived) {}
3270
3555
  /**
3271
3556
  * Determine if the Fetch API is supported in the browser. Note: this is
3272
3557
  * deliberately exposed as a method to allow the client app to use the same
@@ -3285,9 +3570,11 @@ shaka.net.HttpXHRPlugin = class {
3285
3570
  * @param {shaka.net.NetworkingEngine.RequestType} requestType
3286
3571
  * @param {shaka.extern.ProgressUpdated} progressUpdated Called when a
3287
3572
  * progress event happened.
3573
+ * @param {shaka.extern.HeadersReceived} headersReceived Called when the
3574
+ * headers for the download are received, but before the body is.
3288
3575
  * @return {!shaka.extern.IAbortableOperation.<shaka.extern.Response>}
3289
3576
  */
3290
- static parse(uri, request, requestType, progressUpdated) {}
3577
+ static parse(uri, request, requestType, progressUpdated, headersReceived) {}
3291
3578
  };
3292
3579
  /**
3293
3580
  * StorageMuxer is responsible for managing StorageMechanisms and addressing
@@ -3478,6 +3765,20 @@ shaka.polyfill = class {
3478
3765
  */
3479
3766
  static register(polyfill, priority) {}
3480
3767
  };
3768
+ /**
3769
+ * @summary A polyfill to add support for the ARIAMixin interface mixin, for
3770
+ * browsers that do not implement it (e.g. Firefox).
3771
+ * Note that IE also does not support ARIAMixin, but this polyfill does not work
3772
+ * for that platform, as it relies on getters and setters.
3773
+ * @see https://w3c.github.io/aria/#ARIAMixin
3774
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/Element
3775
+ */
3776
+ shaka.polyfill.Aria = class {
3777
+ /**
3778
+ * Install the polyfill if needed.
3779
+ */
3780
+ static install() {}
3781
+ };
3481
3782
  /**
3482
3783
  * @summary A polyfill to add support for EncryptionScheme queries in EME.
3483
3784
  * @see https://wicg.github.io/encrypted-media-encryption-scheme/
@@ -3600,6 +3901,15 @@ shaka.polyfill.PiPWebkit = class {
3600
3901
  */
3601
3902
  static install() {}
3602
3903
  };
3904
+ /**
3905
+ * @summary A polyfill to provide window.crypto.randomUUID in all browsers.
3906
+ */
3907
+ shaka.polyfill.RandomUUID = class {
3908
+ /**
3909
+ * Install the polyfill if needed.
3910
+ */
3911
+ static install() {}
3912
+ };
3603
3913
  /**
3604
3914
  * @summary A polyfill to provide navigator.storage.estimate in old
3605
3915
  * webkit browsers.
@@ -3739,8 +4049,8 @@ shaka.text.SrtTextParser = class {
3739
4049
  parseMedia(data, time) {}
3740
4050
  /**
3741
4051
  * Convert a SRT format to WebVTT
3742
- * @param {!string} data
3743
- * @return {!string}
4052
+ * @param {string} data
4053
+ * @return {string}
3744
4054
  */
3745
4055
  static srt2webvtt(data) {}
3746
4056
  };
@@ -3849,6 +4159,22 @@ shaka.ui.BigPlayButton = class extends shaka.ui.PlayButton {
3849
4159
  */
3850
4160
  constructor(parent, controls) {}
3851
4161
  };
4162
+ /**
4163
+ * @extends {shaka.ui.Element}
4164
+ * @final
4165
+ */
4166
+ shaka.ui.ContextMenu = class extends shaka.ui.Element {
4167
+ /**
4168
+ * @param {!HTMLElement} parent
4169
+ * @param {!shaka.ui.Controls} controls
4170
+ */
4171
+ constructor(parent, controls) {}
4172
+ /**
4173
+ * @param {string} name
4174
+ * @param {!shaka.extern.IUIElement.Factory} factory
4175
+ */
4176
+ static registerElement(name, factory) {}
4177
+ };
3852
4178
  /**
3853
4179
  * A range element, built to work across browsers.
3854
4180
  * In particular, getting styles to work right on IE requires a specific
@@ -4312,6 +4638,17 @@ shaka.ui.Spacer = class extends shaka.ui.Element {
4312
4638
  */
4313
4639
  constructor(parent, controls) {}
4314
4640
  };
4641
+ /**
4642
+ * @extends {shaka.ui.Element}
4643
+ * @final
4644
+ */
4645
+ shaka.ui.StatisticsButton = class extends shaka.ui.Element {
4646
+ /**
4647
+ * @param {!HTMLElement} parent
4648
+ * @param {!shaka.ui.Controls} controls
4649
+ */
4650
+ constructor(parent, controls) {}
4651
+ };
4315
4652
  /**
4316
4653
  * @extends {shaka.ui.SettingsMenu}
4317
4654
  * @final