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
@@ -33,554 +33,9 @@ shaka.offline = {};
33
33
  shaka.text = {};
34
34
  /** @const */
35
35
  shaka.util = {};
36
-
37
- /**
38
- * @summary A set of BufferSource utility functions.
39
- */
40
- shaka.util.BufferUtils = class {
41
- /**
42
- * Compare two buffers for equality. For buffers of different types, this
43
- * compares the underlying buffers as binary data.
44
- * @param {?BufferSource} arr1
45
- * @param {?BufferSource} arr2
46
- * @return {boolean}
47
- */
48
- static equal(arr1, arr2) {}
49
- /**
50
- * Gets an ArrayBuffer that contains the data from the given TypedArray. Note
51
- * this will allocate a new ArrayBuffer if the object is a partial view of
52
- * the data.
53
- * @param {!BufferSource} view
54
- * @return {!ArrayBuffer}
55
- */
56
- static toArrayBuffer(view) {}
57
- /**
58
- * Creates a new Uint8Array view on the same buffer. This clamps the values
59
- * to be within the same view (i.e. you can't use this to move past the end
60
- * of the view, even if the underlying buffer is larger). However, you can
61
- * pass a negative offset to access the data before the view.
62
- * @param {BufferSource} data
63
- * @param {number=} offset The offset from the beginning of this data's view
64
- * to start the new view at.
65
- * @param {number=} length The byte length of the new view.
66
- * @return {!Uint8Array}
67
- */
68
- static toUint8(data, offset, length) {}
69
- /**
70
- * Creates a DataView over the given buffer.
71
- * @see toUint8
72
- * @param {BufferSource} buffer
73
- * @param {number=} offset
74
- * @param {number=} length
75
- * @return {!DataView}
76
- */
77
- static toDataView(buffer, offset, length) {}
78
- };
79
- /**
80
- * @summary
81
- * Describes an error that happened.
82
- * @description
83
- * This uses numerical codes to describe
84
- * which error happened.
85
- * Some error are caused by errors from the browser. In these cases, the error
86
- * object is provided as part of the <code>data</code> field. System codes come
87
- * from the browser and may or may not be documented. Here are some places
88
- * where the errors may be documented:
89
- * <ul>
90
- * <li><a href="https://developer.mozilla.org/en-US/docs/Web/API/MediaError">MediaError</a>
91
- * <li><a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Status">HTTP Codes</a>
92
- * <li><a href="https://hresult.info">Edge/PlayReady errors</a>
93
- * </ul>
94
- * @implements {shaka.extern.Error}
95
- * @extends {Error}
96
- */
97
- shaka.util.Error = class {
98
- /**
99
- * @param {shaka.util.Error.Severity} severity
100
- * @param {shaka.util.Error.Category} category
101
- * @param {shaka.util.Error.Code} code
102
- * @param {...*} varArgs
103
- */
104
- constructor(severity, category, code, ...varArgs) {}
105
- };
106
- /**
107
- * @override
108
- */
109
- shaka.util.Error.prototype.severity;
110
- /**
111
- * @override
112
- */
113
- shaka.util.Error.prototype.category;
114
- /**
115
- * @override
116
- */
117
- shaka.util.Error.prototype.code;
118
- /**
119
- * @override
120
- */
121
- shaka.util.Error.prototype.data;
122
- /**
123
- * @override
124
- */
125
- shaka.util.Error.prototype.handled;
126
- /**
127
- * @enum {number}
128
- */
129
- shaka.util.Error.Severity = {
130
- 'RECOVERABLE': 1,
131
- 'CRITICAL': 2
132
- };
133
- /**
134
- * @enum {number}
135
- */
136
- shaka.util.Error.Category = {
137
- 'NETWORK': 1,
138
- 'TEXT': 2,
139
- 'MEDIA': 3,
140
- 'MANIFEST': 4,
141
- 'STREAMING': 5,
142
- 'DRM': 6,
143
- 'PLAYER': 7,
144
- 'CAST': 8,
145
- 'STORAGE': 9,
146
- 'ADS': 10
147
- };
148
- /**
149
- * @enum {number}
150
- */
151
- shaka.util.Error.Code = {
152
- 'UNSUPPORTED_SCHEME': 1000,
153
- 'BAD_HTTP_STATUS': 1001,
154
- 'HTTP_ERROR': 1002,
155
- 'TIMEOUT': 1003,
156
- 'MALFORMED_DATA_URI': 1004,
157
- 'REQUEST_FILTER_ERROR': 1006,
158
- 'RESPONSE_FILTER_ERROR': 1007,
159
- 'MALFORMED_TEST_URI': 1008,
160
- 'UNEXPECTED_TEST_REQUEST': 1009,
161
- 'ATTEMPTS_EXHAUSTED': 1010,
162
- 'INVALID_TEXT_HEADER': 2000,
163
- 'INVALID_TEXT_CUE': 2001,
164
- 'UNABLE_TO_DETECT_ENCODING': 2003,
165
- 'BAD_ENCODING': 2004,
166
- 'INVALID_XML': 2005,
167
- 'INVALID_MP4_TTML': 2007,
168
- 'INVALID_MP4_VTT': 2008,
169
- 'UNABLE_TO_EXTRACT_CUE_START_TIME': 2009,
170
- 'INVALID_MP4_CEA': 2010,
171
- 'TEXT_COULD_NOT_GUESS_MIME_TYPE': 2011,
172
- 'CANNOT_ADD_EXTERNAL_TEXT_TO_SRC_EQUALS': 2012,
173
- 'TEXT_ONLY_WEBVTT_SRC_EQUALS': 2013,
174
- 'MISSING_TEXT_PLUGIN': 2014,
175
- 'BUFFER_READ_OUT_OF_BOUNDS': 3000,
176
- 'JS_INTEGER_OVERFLOW': 3001,
177
- 'EBML_OVERFLOW': 3002,
178
- 'EBML_BAD_FLOATING_POINT_SIZE': 3003,
179
- 'MP4_SIDX_WRONG_BOX_TYPE': 3004,
180
- 'MP4_SIDX_INVALID_TIMESCALE': 3005,
181
- 'MP4_SIDX_TYPE_NOT_SUPPORTED': 3006,
182
- 'WEBM_CUES_ELEMENT_MISSING': 3007,
183
- 'WEBM_EBML_HEADER_ELEMENT_MISSING': 3008,
184
- 'WEBM_SEGMENT_ELEMENT_MISSING': 3009,
185
- 'WEBM_INFO_ELEMENT_MISSING': 3010,
186
- 'WEBM_DURATION_ELEMENT_MISSING': 3011,
187
- 'WEBM_CUE_TRACK_POSITIONS_ELEMENT_MISSING': 3012,
188
- 'WEBM_CUE_TIME_ELEMENT_MISSING': 3013,
189
- 'MEDIA_SOURCE_OPERATION_FAILED': 3014,
190
- 'MEDIA_SOURCE_OPERATION_THREW': 3015,
191
- 'VIDEO_ERROR': 3016,
192
- 'QUOTA_EXCEEDED_ERROR': 3017,
193
- 'TRANSMUXING_FAILED': 3018,
194
- 'CONTENT_TRANSFORMATION_FAILED': 3019,
195
- 'UNABLE_TO_GUESS_MANIFEST_TYPE': 4000,
196
- 'DASH_INVALID_XML': 4001,
197
- 'DASH_NO_SEGMENT_INFO': 4002,
198
- 'DASH_EMPTY_ADAPTATION_SET': 4003,
199
- 'DASH_EMPTY_PERIOD': 4004,
200
- 'DASH_WEBM_MISSING_INIT': 4005,
201
- 'DASH_UNSUPPORTED_CONTAINER': 4006,
202
- 'DASH_PSSH_BAD_ENCODING': 4007,
203
- 'DASH_NO_COMMON_KEY_SYSTEM': 4008,
204
- 'DASH_MULTIPLE_KEY_IDS_NOT_SUPPORTED': 4009,
205
- 'DASH_CONFLICTING_KEY_IDS': 4010,
206
- 'RESTRICTIONS_CANNOT_BE_MET': 4012,
207
- 'HLS_PLAYLIST_HEADER_MISSING': 4015,
208
- 'INVALID_HLS_TAG': 4016,
209
- 'HLS_INVALID_PLAYLIST_HIERARCHY': 4017,
210
- 'DASH_DUPLICATE_REPRESENTATION_ID': 4018,
211
- 'HLS_MULTIPLE_MEDIA_INIT_SECTIONS_FOUND': 4020,
212
- 'HLS_MASTER_PLAYLIST_NOT_PROVIDED': 4022,
213
- 'HLS_REQUIRED_ATTRIBUTE_MISSING': 4023,
214
- 'HLS_REQUIRED_TAG_MISSING': 4024,
215
- 'HLS_COULD_NOT_GUESS_CODECS': 4025,
216
- 'HLS_KEYFORMATS_NOT_SUPPORTED': 4026,
217
- 'DASH_UNSUPPORTED_XLINK_ACTUATE': 4027,
218
- 'DASH_XLINK_DEPTH_LIMIT': 4028,
219
- 'HLS_COULD_NOT_PARSE_SEGMENT_START_TIME': 4030,
220
- 'CONTENT_UNSUPPORTED_BY_BROWSER': 4032,
221
- 'CANNOT_ADD_EXTERNAL_TEXT_TO_LIVE_STREAM': 4033,
222
- 'HLS_AES_128_ENCRYPTION_NOT_SUPPORTED': 4034,
223
- 'HLS_INTERNAL_SKIP_STREAM': 4035,
224
- 'NO_VARIANTS': 4036,
225
- 'PERIOD_FLATTENING_FAILED': 4037,
226
- 'INCONSISTENT_DRM_ACROSS_PERIODS': 4038,
227
- 'HLS_VARIABLE_NOT_FOUND': 4039,
228
- 'STREAMING_ENGINE_STARTUP_INVALID_STATE': 5006,
229
- 'NO_RECOGNIZED_KEY_SYSTEMS': 6000,
230
- 'REQUESTED_KEY_SYSTEM_CONFIG_UNAVAILABLE': 6001,
231
- 'FAILED_TO_CREATE_CDM': 6002,
232
- 'FAILED_TO_ATTACH_TO_VIDEO': 6003,
233
- 'INVALID_SERVER_CERTIFICATE': 6004,
234
- 'FAILED_TO_CREATE_SESSION': 6005,
235
- 'FAILED_TO_GENERATE_LICENSE_REQUEST': 6006,
236
- 'LICENSE_REQUEST_FAILED': 6007,
237
- 'LICENSE_RESPONSE_REJECTED': 6008,
238
- 'ENCRYPTED_CONTENT_WITHOUT_DRM_INFO': 6010,
239
- 'NO_LICENSE_SERVER_GIVEN': 6012,
240
- 'OFFLINE_SESSION_REMOVED': 6013,
241
- 'EXPIRED': 6014,
242
- 'SERVER_CERTIFICATE_REQUIRED': 6015,
243
- 'INIT_DATA_TRANSFORM_ERROR': 6016,
244
- 'LOAD_INTERRUPTED': 7000,
245
- 'OPERATION_ABORTED': 7001,
246
- 'NO_VIDEO_ELEMENT': 7002,
247
- 'OBJECT_DESTROYED': 7003,
248
- 'CONTENT_NOT_LOADED': 7004,
249
- 'CAST_API_UNAVAILABLE': 8000,
250
- 'NO_CAST_RECEIVERS': 8001,
251
- 'ALREADY_CASTING': 8002,
252
- 'UNEXPECTED_CAST_ERROR': 8003,
253
- 'CAST_CANCELED_BY_USER': 8004,
254
- 'CAST_CONNECTION_TIMED_OUT': 8005,
255
- 'CAST_RECEIVER_APP_UNAVAILABLE': 8006,
256
- 'STORAGE_NOT_SUPPORTED': 9000,
257
- 'INDEXED_DB_ERROR': 9001,
258
- 'DEPRECATED_OPERATION_ABORTED': 9002,
259
- 'REQUESTED_ITEM_NOT_FOUND': 9003,
260
- 'MALFORMED_OFFLINE_URI': 9004,
261
- 'CANNOT_STORE_LIVE_OFFLINE': 9005,
262
- 'NO_INIT_DATA_FOR_OFFLINE': 9007,
263
- 'LOCAL_PLAYER_INSTANCE_REQUIRED': 9008,
264
- 'NEW_KEY_OPERATION_NOT_SUPPORTED': 9011,
265
- 'KEY_NOT_FOUND': 9012,
266
- 'MISSING_STORAGE_CELL': 9013,
267
- 'STORAGE_LIMIT_REACHED': 9014,
268
- 'DOWNLOAD_SIZE_CALLBACK_ERROR': 9015,
269
- 'CS_IMA_SDK_MISSING': 10000,
270
- 'CS_AD_MANAGER_NOT_INITIALIZED': 10001,
271
- 'SS_IMA_SDK_MISSING': 10002,
272
- 'SS_AD_MANAGER_NOT_INITIALIZED': 10003,
273
- 'CURRENT_DAI_REQUEST_NOT_FINISHED': 10004
274
- };
275
- /**
276
- * @namespace shaka.util.StringUtils
277
- * @summary A set of string utility functions.
278
- */
279
- shaka.util.StringUtils = class {
280
- /**
281
- * Creates a string from the given buffer as UTF-8 encoding.
282
- * @param {?BufferSource} data
283
- * @return {string}
284
- */
285
- static fromUTF8(data) {}
286
- /**
287
- * Creates a string from the given buffer as UTF-16 encoding.
288
- * @param {?BufferSource} data
289
- * @param {boolean} littleEndian
290
- true to read little endian, false to read big.
291
- * @param {boolean=} noThrow true to avoid throwing in cases where we may
292
- * expect invalid input. If noThrow is true and the data has an odd
293
- * length,it will be truncated.
294
- * @return {string}
295
- */
296
- static fromUTF16(data, littleEndian, noThrow) {}
297
- /**
298
- * Creates a string from the given buffer, auto-detecting the encoding that is
299
- * being used. If it cannot detect the encoding, it will throw an exception.
300
- * @param {?BufferSource} data
301
- * @return {string}
302
- */
303
- static fromBytesAutoDetect(data) {}
304
- /**
305
- * Creates a ArrayBuffer from the given string, converting to UTF-8 encoding.
306
- * @param {string} str
307
- * @return {!ArrayBuffer}
308
- */
309
- static toUTF8(str) {}
310
- /**
311
- * Creates a ArrayBuffer from the given string, converting to UTF-16 encoding.
312
- * @param {string} str
313
- * @param {boolean} littleEndian
314
- * @return {!ArrayBuffer}
315
- */
316
- static toUTF16(str, littleEndian) {}
317
- /**
318
- * Resets the fromCharCode method's implementation.
319
- * For debug use.
320
- */
321
- static resetFromCharCode() {}
322
- };
323
- /**
324
- * @summary DataViewReader abstracts a DataView object.
325
- */
326
- shaka.util.DataViewReader = class {
327
- /**
328
- * @param {BufferSource} data
329
- * @param {shaka.util.DataViewReader.Endianness} endianness The endianness.
330
- */
331
- constructor(data, endianness) {}
332
- /**
333
- * @return {boolean} True if the reader has more data, false otherwise.
334
- */
335
- hasMoreData() {}
336
- /**
337
- * Gets the current byte position.
338
- * @return {number}
339
- */
340
- getPosition() {}
341
- /**
342
- * Gets the byte length of the DataView.
343
- * @return {number}
344
- */
345
- getLength() {}
346
- /**
347
- * Reads an unsigned 8 bit integer, and advances the reader.
348
- * @return {number} The integer.
349
- */
350
- readUint8() {}
351
- /**
352
- * Reads an unsigned 16 bit integer, and advances the reader.
353
- * @return {number} The integer.
354
- */
355
- readUint16() {}
356
- /**
357
- * Reads an unsigned 32 bit integer, and advances the reader.
358
- * @return {number} The integer.
359
- */
360
- readUint32() {}
361
- /**
362
- * Reads a signed 32 bit integer, and advances the reader.
363
- * @return {number} The integer.
364
- */
365
- readInt32() {}
366
- /**
367
- * Reads an unsigned 64 bit integer, and advances the reader.
368
- * @return {number} The integer.
369
- */
370
- readUint64() {}
371
- /**
372
- * Reads the specified number of raw bytes.
373
- * @param {number} bytes The number of bytes to read.
374
- * @return {!Uint8Array}
375
- */
376
- readBytes(bytes) {}
377
- /**
378
- * Skips the specified number of bytes.
379
- * @param {number} bytes The number of bytes to skip.
380
- */
381
- skip(bytes) {}
382
- /**
383
- * Rewinds the specified number of bytes.
384
- * @param {number} bytes The number of bytes to rewind.
385
- */
386
- rewind(bytes) {}
387
- /**
388
- * Seeks to a specified position.
389
- * @param {number} position The desired byte position within the DataView.
390
- */
391
- seek(position) {}
392
- /**
393
- * Keeps reading until it reaches a byte that equals to zero. The text is
394
- * assumed to be UTF-8.
395
- * @return {string}
396
- */
397
- readTerminatedString() {}
398
- };
399
- /**
400
- * Endianness.
401
- * @enum {number}
402
- */
403
- shaka.util.DataViewReader.Endianness = {
404
- 'BIG_ENDIAN': 0,
405
- 'LITTLE_ENDIAN': 1
406
- };
407
- /**
408
- */
409
- shaka.util.Mp4Parser = class {
410
- /** */
411
- constructor() {}
412
- /**
413
- * Declare a box type as a Box.
414
- * @param {string} type
415
- * @param {!shaka.util.Mp4Parser.CallbackType} definition
416
- * @return {!shaka.util.Mp4Parser}
417
- */
418
- box(type, definition) {}
419
- /**
420
- * Declare a box type as a Full Box.
421
- * @param {string} type
422
- * @param {!shaka.util.Mp4Parser.CallbackType} definition
423
- * @return {!shaka.util.Mp4Parser}
424
- */
425
- fullBox(type, definition) {}
426
- /**
427
- * Stop parsing. Useful for extracting information from partial segments and
428
- * avoiding an out-of-bounds error once you find what you are looking for.
429
- */
430
- stop() {}
431
- /**
432
- * Parse the given data using the added callbacks.
433
- * @param {!BufferSource} data
434
- * @param {boolean=} partialOkay If true, allow reading partial payloads
435
- * from some boxes. If the goal is a child box, we can sometimes find it
436
- * without enough data to find all child boxes.
437
- * @param {boolean=} stopOnPartial If true, stop reading if an incomplete
438
- * box is detected.
439
- */
440
- parse(data, partialOkay, stopOnPartial) {}
441
- /**
442
- * Parse the next box on the current level.
443
- * @param {number} absStart The absolute start position in the original
444
- * byte array.
445
- * @param {!shaka.util.DataViewReader} reader
446
- * @param {boolean=} partialOkay If true, allow reading partial payloads
447
- * from some boxes. If the goal is a child box, we can sometimes find it
448
- * without enough data to find all child boxes.
449
- * @param {boolean=} stopOnPartial If true, stop reading if an incomplete
450
- * box is detected.
451
- */
452
- parseNext(absStart, reader, partialOkay, stopOnPartial) {}
453
- /**
454
- * A callback that tells the Mp4 parser to treat the body of a box as a series
455
- * of boxes. The number of boxes is limited by the size of the parent box.
456
- * @param {!shaka.extern.ParsedBox} box
457
- */
458
- static children(box) {}
459
- /**
460
- * A callback that tells the Mp4 parser to treat the body of a box as a sample
461
- * description. A sample description box has a fixed number of children. The
462
- * number of children is represented by a 4 byte unsigned integer. Each child
463
- * is a box.
464
- * @param {!shaka.extern.ParsedBox} box
465
- */
466
- static sampleDescription(box) {}
467
- /**
468
- * Create a callback that tells the Mp4 parser to treat the body of a box as a
469
- * binary blob and to parse the body's contents using the provided callback.
470
- * @param {function(!Uint8Array)} callback
471
- * @return {!shaka.util.Mp4Parser.CallbackType}
472
- */
473
- static allData(callback) {}
474
- /**
475
- * Convert an integer type from a box into an ascii string name.
476
- * Useful for debugging.
477
- * @param {number} type The type of the box, a uint32.
478
- * @return {string}
479
- */
480
- static typeToString(type) {}
481
- /**
482
- * Find the header size of the box.
483
- * Useful for modifying boxes in place or finding the exact offset of a field.
484
- * @param {shaka.extern.ParsedBox} box
485
- * @return {number}
486
- */
487
- static headerSize(box) {}
488
- };
489
- /**
490
- * @typedef {function(!shaka.extern.ParsedBox)}
491
- */
492
- shaka.util.Mp4Parser.CallbackType;
493
- /**
494
- * A timer allows a single function to be executed at a later time or at
495
- * regular intervals.
496
- * @final
497
- */
498
- shaka.util.Timer = class {
499
- /**
500
- * Create a new timer. A timer is committed to a single callback function.
501
- * While there is no technical reason to do this, it is far easier to
502
- * understand and use timers when they are connected to one functional idea.
503
- * @param {function()} onTick
504
- */
505
- constructor(onTick) {}
506
- /**
507
- * Have the timer call |onTick| now.
508
- * @return {!shaka.util.Timer}
509
- */
510
- tickNow() {}
511
- /**
512
- * Have the timer call |onTick| after |seconds| has elapsed unless |stop| is
513
- * called first.
514
- * @param {number} seconds
515
- * @return {!shaka.util.Timer}
516
- */
517
- tickAfter(seconds) {}
518
- /**
519
- * Have the timer call |onTick| every |seconds| until |stop| is called.
520
- * @param {number} seconds
521
- * @return {!shaka.util.Timer}
522
- */
523
- tickEvery(seconds) {}
524
- /**
525
- * Stop the timer and clear the previous behaviour. The timer is still usable
526
- * after calling |stop|.
527
- */
528
- stop() {}
529
- };
530
- /**
531
- * @summary A set of Uint8Array utility functions.
532
- */
533
- shaka.util.Uint8ArrayUtils = class {
534
- /**
535
- * Compare two Uint8Arrays for equality.
536
- * @param {Uint8Array} arr1
537
- * @param {Uint8Array} arr2
538
- * @return {boolean}
539
- * @deprecated
540
- */
541
- static equal(arr1, arr2) {}
542
- /**
543
- * Convert a buffer to a base64 string. The output will be standard
544
- * alphabet as opposed to base64url safe alphabet.
545
- * @param {BufferSource} data
546
- * @return {string}
547
- */
548
- static toStandardBase64(data) {}
549
- /**
550
- * Convert a buffer to a base64 string. The output will always use the
551
- * alternate encoding/alphabet also known as "base64url".
552
- * @param {BufferSource} data
553
- * @param {boolean=} padding If true, pad the output with equals signs.
554
- * Defaults to true.
555
- * @return {string}
556
- */
557
- static toBase64(data, padding) {}
558
- /**
559
- * Convert a base64 string to a Uint8Array. Accepts either the standard
560
- * alphabet or the alternate "base64url" alphabet.
561
- * @param {string} str
562
- * @return {!Uint8Array}
563
- */
564
- static fromBase64(str) {}
565
- /**
566
- * Convert a hex string to a Uint8Array.
567
- * @param {string} str
568
- * @return {!Uint8Array}
569
- */
570
- static fromHex(str) {}
571
- /**
572
- * Convert a buffer to a hex string.
573
- * @param {BufferSource} data
574
- * @return {string}
575
- */
576
- static toHex(data) {}
577
- /**
578
- * Concatenate buffers.
579
- * @param {...BufferSource} varArgs
580
- * @return {!Uint8Array}
581
- */
582
- static concat(...varArgs) {}
583
- };
36
+ /** @const */
37
+ shaka.util.CmcdManager = {};
38
+
584
39
  /**
585
40
  * @implements {shaka.extern.Cue}
586
41
  */
@@ -671,6 +126,14 @@ shaka.text.Cue.prototype.backgroundImage;
671
126
  * @override
672
127
  */
673
128
  shaka.text.Cue.prototype.border;
129
+ /**
130
+ * @override
131
+ */
132
+ shaka.text.Cue.prototype.textStrokeColor;
133
+ /**
134
+ * @override
135
+ */
136
+ shaka.text.Cue.prototype.textStrokeWidth;
674
137
  /**
675
138
  * @override
676
139
  */
@@ -837,113 +300,455 @@ shaka.text.Cue.fontStyle = {
837
300
  /**
838
301
  * @enum {string}
839
302
  */
840
- shaka.text.Cue.textDecoration = {
841
- 'UNDERLINE': 'underline',
842
- 'LINE_THROUGH': 'lineThrough',
843
- 'OVERLINE': 'overline'
303
+ shaka.text.Cue.textDecoration = {
304
+ 'UNDERLINE': 'underline',
305
+ 'LINE_THROUGH': 'lineThrough',
306
+ 'OVERLINE': 'overline'
307
+ };
308
+ /**
309
+ * @implements {shaka.extern.CueRegion}
310
+ * @struct
311
+ */
312
+ shaka.text.CueRegion = class {
313
+ /** */
314
+ constructor() {}
315
+ };
316
+ /**
317
+ * @override
318
+ */
319
+ shaka.text.CueRegion.prototype.id;
320
+ /**
321
+ * @override
322
+ */
323
+ shaka.text.CueRegion.prototype.viewportAnchorX;
324
+ /**
325
+ * @override
326
+ */
327
+ shaka.text.CueRegion.prototype.viewportAnchorY;
328
+ /**
329
+ * @override
330
+ */
331
+ shaka.text.CueRegion.prototype.regionAnchorX;
332
+ /**
333
+ * @override
334
+ */
335
+ shaka.text.CueRegion.prototype.regionAnchorY;
336
+ /**
337
+ * @override
338
+ */
339
+ shaka.text.CueRegion.prototype.width;
340
+ /**
341
+ * @override
342
+ */
343
+ shaka.text.CueRegion.prototype.height;
344
+ /**
345
+ * @override
346
+ */
347
+ shaka.text.CueRegion.prototype.heightUnits;
348
+ /**
349
+ * @override
350
+ */
351
+ shaka.text.CueRegion.prototype.widthUnits;
352
+ /**
353
+ * @override
354
+ */
355
+ shaka.text.CueRegion.prototype.viewportAnchorUnits;
356
+ /**
357
+ * @override
358
+ */
359
+ shaka.text.CueRegion.prototype.scroll;
360
+ /**
361
+ * @enum {number}
362
+ */
363
+ shaka.text.CueRegion.units = {
364
+ 'PX': 0,
365
+ 'PERCENTAGE': 1,
366
+ 'LINES': 2
367
+ };
368
+ /**
369
+ * @enum {string}
370
+ */
371
+ shaka.text.CueRegion.scrollMode = {
372
+ 'NONE': '',
373
+ 'UP': 'up'
374
+ };
375
+ /**
376
+ * @summary A set of BufferSource utility functions.
377
+ */
378
+ shaka.util.BufferUtils = class {
379
+ /**
380
+ * Compare two buffers for equality. For buffers of different types, this
381
+ * compares the underlying buffers as binary data.
382
+ * @param {?BufferSource} arr1
383
+ * @param {?BufferSource} arr2
384
+ * @return {boolean}
385
+ */
386
+ static equal(arr1, arr2) {}
387
+ /**
388
+ * Gets an ArrayBuffer that contains the data from the given TypedArray. Note
389
+ * this will allocate a new ArrayBuffer if the object is a partial view of
390
+ * the data.
391
+ * @param {!BufferSource} view
392
+ * @return {!ArrayBuffer}
393
+ */
394
+ static toArrayBuffer(view) {}
395
+ /**
396
+ * Creates a new Uint8Array view on the same buffer. This clamps the values
397
+ * to be within the same view (i.e. you can't use this to move past the end
398
+ * of the view, even if the underlying buffer is larger). However, you can
399
+ * pass a negative offset to access the data before the view.
400
+ * @param {BufferSource} data
401
+ * @param {number=} offset The offset from the beginning of this data's view
402
+ * to start the new view at.
403
+ * @param {number=} length The byte length of the new view.
404
+ * @return {!Uint8Array}
405
+ */
406
+ static toUint8(data, offset, length) {}
407
+ /**
408
+ * Creates a DataView over the given buffer.
409
+ * @see toUint8
410
+ * @param {BufferSource} buffer
411
+ * @param {number=} offset
412
+ * @param {number=} length
413
+ * @return {!DataView}
414
+ */
415
+ static toDataView(buffer, offset, length) {}
416
+ };
417
+ /**
418
+ * An interface to standardize how objects are destroyed.
419
+ * @interface
420
+ */
421
+ shaka.util.IDestroyable = class {
422
+ /**
423
+ * Request that this object be destroyed, releasing all resources and shutting
424
+ * down all operations. Returns a Promise which is resolved when destruction
425
+ * is complete. This Promise should never be rejected.
426
+ * @return {!Promise}
427
+ */
428
+ destroy() {}
429
+ };
430
+ /**
431
+ */
432
+ shaka.dependencies = class {
433
+ /**
434
+ * Registers a new dependency.
435
+ * @param {shaka.dependencies.Allowed} key which is used for retrieving a
436
+ * dependency
437
+ * @param {?} dep a dependency
438
+ */
439
+ static add(key, dep) {}
440
+ /**
441
+ * Check if we have a dependency for the key.
442
+ * @param {shaka.dependencies.Allowed} key key
443
+ * @return {boolean}
444
+ */
445
+ static has(key) {}
446
+ };
447
+ /**
448
+ * @enum {string}
449
+ */
450
+ shaka.dependencies.Allowed = {
451
+ muxjs: 'muxjs'
844
452
  };
845
453
  /**
846
- * @implements {shaka.extern.CueRegion}
847
- * @struct
454
+ * @summary
455
+ * Describes an error that happened.
456
+ * @description
457
+ * This uses numerical codes to describe
458
+ * which error happened.
459
+ * Some error are caused by errors from the browser. In these cases, the error
460
+ * object is provided as part of the <code>data</code> field. System codes come
461
+ * from the browser and may or may not be documented. Here are some places
462
+ * where the errors may be documented:
463
+ * <ul>
464
+ * <li><a href="https://developer.mozilla.org/en-US/docs/Web/API/MediaError">MediaError</a>
465
+ * <li><a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Status">HTTP Codes</a>
466
+ * <li><a href="https://hresult.info">Edge/PlayReady errors</a>
467
+ * </ul>
468
+ * @implements {shaka.extern.Error}
469
+ * @extends {Error}
848
470
  */
849
- shaka.text.CueRegion = class {
850
- /** */
851
- constructor() {}
471
+ shaka.util.Error = class {
472
+ /**
473
+ * @param {shaka.util.Error.Severity} severity
474
+ * @param {shaka.util.Error.Category} category
475
+ * @param {shaka.util.Error.Code} code
476
+ * @param {...*} varArgs
477
+ */
478
+ constructor(severity, category, code, ...varArgs) {}
852
479
  };
853
480
  /**
854
481
  * @override
855
482
  */
856
- shaka.text.CueRegion.prototype.id;
857
- /**
858
- * @override
859
- */
860
- shaka.text.CueRegion.prototype.viewportAnchorX;
861
- /**
862
- * @override
863
- */
864
- shaka.text.CueRegion.prototype.viewportAnchorY;
865
- /**
866
- * @override
867
- */
868
- shaka.text.CueRegion.prototype.regionAnchorX;
869
- /**
870
- * @override
871
- */
872
- shaka.text.CueRegion.prototype.regionAnchorY;
873
- /**
874
- * @override
875
- */
876
- shaka.text.CueRegion.prototype.width;
483
+ shaka.util.Error.prototype.severity;
877
484
  /**
878
485
  * @override
879
486
  */
880
- shaka.text.CueRegion.prototype.height;
487
+ shaka.util.Error.prototype.category;
881
488
  /**
882
489
  * @override
883
490
  */
884
- shaka.text.CueRegion.prototype.heightUnits;
491
+ shaka.util.Error.prototype.code;
885
492
  /**
886
493
  * @override
887
494
  */
888
- shaka.text.CueRegion.prototype.widthUnits;
495
+ shaka.util.Error.prototype.data;
889
496
  /**
890
497
  * @override
891
498
  */
892
- shaka.text.CueRegion.prototype.viewportAnchorUnits;
499
+ shaka.util.Error.prototype.handled;
893
500
  /**
894
- * @override
895
- */
896
- shaka.text.CueRegion.prototype.scroll;
501
+ * @enum {number}
502
+ */
503
+ shaka.util.Error.Severity = {
504
+ 'RECOVERABLE': 1,
505
+ 'CRITICAL': 2
506
+ };
897
507
  /**
898
508
  * @enum {number}
899
509
  */
900
- shaka.text.CueRegion.units = {
901
- 'PX': 0,
902
- 'PERCENTAGE': 1,
903
- 'LINES': 2
510
+ shaka.util.Error.Category = {
511
+ 'NETWORK': 1,
512
+ 'TEXT': 2,
513
+ 'MEDIA': 3,
514
+ 'MANIFEST': 4,
515
+ 'STREAMING': 5,
516
+ 'DRM': 6,
517
+ 'PLAYER': 7,
518
+ 'CAST': 8,
519
+ 'STORAGE': 9,
520
+ 'ADS': 10
904
521
  };
905
522
  /**
906
- * @enum {string}
523
+ * @enum {number}
907
524
  */
908
- shaka.text.CueRegion.scrollMode = {
909
- 'NONE': '',
910
- 'UP': 'up'
525
+ shaka.util.Error.Code = {
526
+ 'UNSUPPORTED_SCHEME': 1000,
527
+ 'BAD_HTTP_STATUS': 1001,
528
+ 'HTTP_ERROR': 1002,
529
+ 'TIMEOUT': 1003,
530
+ 'MALFORMED_DATA_URI': 1004,
531
+ 'REQUEST_FILTER_ERROR': 1006,
532
+ 'RESPONSE_FILTER_ERROR': 1007,
533
+ 'MALFORMED_TEST_URI': 1008,
534
+ 'UNEXPECTED_TEST_REQUEST': 1009,
535
+ 'ATTEMPTS_EXHAUSTED': 1010,
536
+ 'INVALID_TEXT_HEADER': 2000,
537
+ 'INVALID_TEXT_CUE': 2001,
538
+ 'UNABLE_TO_DETECT_ENCODING': 2003,
539
+ 'BAD_ENCODING': 2004,
540
+ 'INVALID_XML': 2005,
541
+ 'INVALID_MP4_TTML': 2007,
542
+ 'INVALID_MP4_VTT': 2008,
543
+ 'UNABLE_TO_EXTRACT_CUE_START_TIME': 2009,
544
+ 'INVALID_MP4_CEA': 2010,
545
+ 'TEXT_COULD_NOT_GUESS_MIME_TYPE': 2011,
546
+ 'CANNOT_ADD_EXTERNAL_TEXT_TO_SRC_EQUALS': 2012,
547
+ 'TEXT_ONLY_WEBVTT_SRC_EQUALS': 2013,
548
+ 'MISSING_TEXT_PLUGIN': 2014,
549
+ 'BUFFER_READ_OUT_OF_BOUNDS': 3000,
550
+ 'JS_INTEGER_OVERFLOW': 3001,
551
+ 'EBML_OVERFLOW': 3002,
552
+ 'EBML_BAD_FLOATING_POINT_SIZE': 3003,
553
+ 'MP4_SIDX_WRONG_BOX_TYPE': 3004,
554
+ 'MP4_SIDX_INVALID_TIMESCALE': 3005,
555
+ 'MP4_SIDX_TYPE_NOT_SUPPORTED': 3006,
556
+ 'WEBM_CUES_ELEMENT_MISSING': 3007,
557
+ 'WEBM_EBML_HEADER_ELEMENT_MISSING': 3008,
558
+ 'WEBM_SEGMENT_ELEMENT_MISSING': 3009,
559
+ 'WEBM_INFO_ELEMENT_MISSING': 3010,
560
+ 'WEBM_DURATION_ELEMENT_MISSING': 3011,
561
+ 'WEBM_CUE_TRACK_POSITIONS_ELEMENT_MISSING': 3012,
562
+ 'WEBM_CUE_TIME_ELEMENT_MISSING': 3013,
563
+ 'MEDIA_SOURCE_OPERATION_FAILED': 3014,
564
+ 'MEDIA_SOURCE_OPERATION_THREW': 3015,
565
+ 'VIDEO_ERROR': 3016,
566
+ 'QUOTA_EXCEEDED_ERROR': 3017,
567
+ 'TRANSMUXING_FAILED': 3018,
568
+ 'CONTENT_TRANSFORMATION_FAILED': 3019,
569
+ 'UNABLE_TO_GUESS_MANIFEST_TYPE': 4000,
570
+ 'DASH_INVALID_XML': 4001,
571
+ 'DASH_NO_SEGMENT_INFO': 4002,
572
+ 'DASH_EMPTY_ADAPTATION_SET': 4003,
573
+ 'DASH_EMPTY_PERIOD': 4004,
574
+ 'DASH_WEBM_MISSING_INIT': 4005,
575
+ 'DASH_UNSUPPORTED_CONTAINER': 4006,
576
+ 'DASH_PSSH_BAD_ENCODING': 4007,
577
+ 'DASH_NO_COMMON_KEY_SYSTEM': 4008,
578
+ 'DASH_MULTIPLE_KEY_IDS_NOT_SUPPORTED': 4009,
579
+ 'DASH_CONFLICTING_KEY_IDS': 4010,
580
+ 'RESTRICTIONS_CANNOT_BE_MET': 4012,
581
+ 'HLS_PLAYLIST_HEADER_MISSING': 4015,
582
+ 'INVALID_HLS_TAG': 4016,
583
+ 'HLS_INVALID_PLAYLIST_HIERARCHY': 4017,
584
+ 'DASH_DUPLICATE_REPRESENTATION_ID': 4018,
585
+ 'HLS_MULTIPLE_MEDIA_INIT_SECTIONS_FOUND': 4020,
586
+ 'HLS_MASTER_PLAYLIST_NOT_PROVIDED': 4022,
587
+ 'HLS_REQUIRED_ATTRIBUTE_MISSING': 4023,
588
+ 'HLS_REQUIRED_TAG_MISSING': 4024,
589
+ 'HLS_COULD_NOT_GUESS_CODECS': 4025,
590
+ 'HLS_KEYFORMATS_NOT_SUPPORTED': 4026,
591
+ 'DASH_UNSUPPORTED_XLINK_ACTUATE': 4027,
592
+ 'DASH_XLINK_DEPTH_LIMIT': 4028,
593
+ 'HLS_COULD_NOT_PARSE_SEGMENT_START_TIME': 4030,
594
+ 'CONTENT_UNSUPPORTED_BY_BROWSER': 4032,
595
+ 'CANNOT_ADD_EXTERNAL_TEXT_TO_LIVE_STREAM': 4033,
596
+ 'HLS_AES_128_ENCRYPTION_NOT_SUPPORTED': 4034,
597
+ 'HLS_INTERNAL_SKIP_STREAM': 4035,
598
+ 'NO_VARIANTS': 4036,
599
+ 'PERIOD_FLATTENING_FAILED': 4037,
600
+ 'INCONSISTENT_DRM_ACROSS_PERIODS': 4038,
601
+ 'HLS_VARIABLE_NOT_FOUND': 4039,
602
+ 'STREAMING_ENGINE_STARTUP_INVALID_STATE': 5006,
603
+ 'NO_RECOGNIZED_KEY_SYSTEMS': 6000,
604
+ 'REQUESTED_KEY_SYSTEM_CONFIG_UNAVAILABLE': 6001,
605
+ 'FAILED_TO_CREATE_CDM': 6002,
606
+ 'FAILED_TO_ATTACH_TO_VIDEO': 6003,
607
+ 'INVALID_SERVER_CERTIFICATE': 6004,
608
+ 'FAILED_TO_CREATE_SESSION': 6005,
609
+ 'FAILED_TO_GENERATE_LICENSE_REQUEST': 6006,
610
+ 'LICENSE_REQUEST_FAILED': 6007,
611
+ 'LICENSE_RESPONSE_REJECTED': 6008,
612
+ 'ENCRYPTED_CONTENT_WITHOUT_DRM_INFO': 6010,
613
+ 'NO_LICENSE_SERVER_GIVEN': 6012,
614
+ 'OFFLINE_SESSION_REMOVED': 6013,
615
+ 'EXPIRED': 6014,
616
+ 'SERVER_CERTIFICATE_REQUIRED': 6015,
617
+ 'INIT_DATA_TRANSFORM_ERROR': 6016,
618
+ 'SERVER_CERTIFICATE_REQUEST_FAILED': 6017,
619
+ 'LOAD_INTERRUPTED': 7000,
620
+ 'OPERATION_ABORTED': 7001,
621
+ 'NO_VIDEO_ELEMENT': 7002,
622
+ 'OBJECT_DESTROYED': 7003,
623
+ 'CONTENT_NOT_LOADED': 7004,
624
+ 'CAST_API_UNAVAILABLE': 8000,
625
+ 'NO_CAST_RECEIVERS': 8001,
626
+ 'ALREADY_CASTING': 8002,
627
+ 'UNEXPECTED_CAST_ERROR': 8003,
628
+ 'CAST_CANCELED_BY_USER': 8004,
629
+ 'CAST_CONNECTION_TIMED_OUT': 8005,
630
+ 'CAST_RECEIVER_APP_UNAVAILABLE': 8006,
631
+ 'STORAGE_NOT_SUPPORTED': 9000,
632
+ 'INDEXED_DB_ERROR': 9001,
633
+ 'DEPRECATED_OPERATION_ABORTED': 9002,
634
+ 'REQUESTED_ITEM_NOT_FOUND': 9003,
635
+ 'MALFORMED_OFFLINE_URI': 9004,
636
+ 'CANNOT_STORE_LIVE_OFFLINE': 9005,
637
+ 'NO_INIT_DATA_FOR_OFFLINE': 9007,
638
+ 'LOCAL_PLAYER_INSTANCE_REQUIRED': 9008,
639
+ 'NEW_KEY_OPERATION_NOT_SUPPORTED': 9011,
640
+ 'KEY_NOT_FOUND': 9012,
641
+ 'MISSING_STORAGE_CELL': 9013,
642
+ 'STORAGE_LIMIT_REACHED': 9014,
643
+ 'DOWNLOAD_SIZE_CALLBACK_ERROR': 9015,
644
+ 'MODIFY_OPERATION_NOT_SUPPORTED': 9016,
645
+ 'CS_IMA_SDK_MISSING': 10000,
646
+ 'CS_AD_MANAGER_NOT_INITIALIZED': 10001,
647
+ 'SS_IMA_SDK_MISSING': 10002,
648
+ 'SS_AD_MANAGER_NOT_INITIALIZED': 10003,
649
+ 'CURRENT_DAI_REQUEST_NOT_FINISHED': 10004
911
650
  };
912
651
  /**
913
- * An interface to standardize how objects are destroyed.
914
- * @interface
652
+ * @namespace shaka.util.StringUtils
653
+ * @summary A set of string utility functions.
915
654
  */
916
- shaka.util.IDestroyable = class {
655
+ shaka.util.StringUtils = class {
656
+ /**
657
+ * Creates a string from the given buffer as UTF-8 encoding.
658
+ * @param {?BufferSource} data
659
+ * @return {string}
660
+ */
661
+ static fromUTF8(data) {}
662
+ /**
663
+ * Creates a string from the given buffer as UTF-16 encoding.
664
+ * @param {?BufferSource} data
665
+ * @param {boolean} littleEndian
666
+ true to read little endian, false to read big.
667
+ * @param {boolean=} noThrow true to avoid throwing in cases where we may
668
+ * expect invalid input. If noThrow is true and the data has an odd
669
+ * length,it will be truncated.
670
+ * @return {string}
671
+ */
672
+ static fromUTF16(data, littleEndian, noThrow) {}
673
+ /**
674
+ * Creates a string from the given buffer, auto-detecting the encoding that is
675
+ * being used. If it cannot detect the encoding, it will throw an exception.
676
+ * @param {?BufferSource} data
677
+ * @return {string}
678
+ */
679
+ static fromBytesAutoDetect(data) {}
680
+ /**
681
+ * Creates a ArrayBuffer from the given string, converting to UTF-8 encoding.
682
+ * @param {string} str
683
+ * @return {!ArrayBuffer}
684
+ */
685
+ static toUTF8(str) {}
686
+ /**
687
+ * Creates a ArrayBuffer from the given string, converting to UTF-16 encoding.
688
+ * @param {string} str
689
+ * @param {boolean} littleEndian
690
+ * @return {!ArrayBuffer}
691
+ */
692
+ static toUTF16(str, littleEndian) {}
917
693
  /**
918
- * Request that this object be destroyed, releasing all resources and shutting
919
- * down all operations. Returns a Promise which is resolved when destruction
920
- * is complete. This Promise should never be rejected.
921
- * @return {!Promise}
694
+ * Resets the fromCharCode method's implementation.
695
+ * For debug use.
922
696
  */
923
- destroy() {}
697
+ static resetFromCharCode() {}
924
698
  };
925
699
  /**
700
+ * @summary A set of Uint8Array utility functions.
926
701
  */
927
- shaka.dependencies = class {
702
+ shaka.util.Uint8ArrayUtils = class {
928
703
  /**
929
- * Registers a new dependency.
930
- * @param {shaka.dependencies.Allowed} key which is used for retrieving a
931
- * dependency
932
- * @param {?} dep a dependency
704
+ * Compare two Uint8Arrays for equality.
705
+ * @param {Uint8Array} arr1
706
+ * @param {Uint8Array} arr2
707
+ * @return {boolean}
708
+ * @deprecated
933
709
  */
934
- static add(key, dep) {}
710
+ static equal(arr1, arr2) {}
935
711
  /**
936
- * Check if we have a dependency for the key.
937
- * @param {shaka.dependencies.Allowed} key key
938
- * @return {boolean}
712
+ * Convert a buffer to a base64 string. The output will be standard
713
+ * alphabet as opposed to base64url safe alphabet.
714
+ * @param {BufferSource} data
715
+ * @return {string}
939
716
  */
940
- static has(key) {}
941
- };
942
- /**
943
- * @enum {string}
944
- */
945
- shaka.dependencies.Allowed = {
946
- muxjs: 'muxjs'
717
+ static toStandardBase64(data) {}
718
+ /**
719
+ * Convert a buffer to a base64 string. The output will always use the
720
+ * alternate encoding/alphabet also known as "base64url".
721
+ * @param {BufferSource} data
722
+ * @param {boolean=} padding If true, pad the output with equals signs.
723
+ * Defaults to true.
724
+ * @return {string}
725
+ */
726
+ static toBase64(data, padding) {}
727
+ /**
728
+ * Convert a base64 string to a Uint8Array. Accepts either the standard
729
+ * alphabet or the alternate "base64url" alphabet.
730
+ * @param {string} str
731
+ * @return {!Uint8Array}
732
+ */
733
+ static fromBase64(str) {}
734
+ /**
735
+ * Convert a hex string to a Uint8Array.
736
+ * @param {string} str
737
+ * @return {!Uint8Array}
738
+ */
739
+ static fromHex(str) {}
740
+ /**
741
+ * Convert a buffer to a hex string.
742
+ * @param {BufferSource} data
743
+ * @return {string}
744
+ */
745
+ static toHex(data) {}
746
+ /**
747
+ * Concatenate buffers.
748
+ * @param {...BufferSource} varArgs
749
+ * @return {!Uint8Array}
750
+ */
751
+ static concat(...varArgs) {}
947
752
  };
948
753
  /**
949
754
  * @summary Manages text parsers and cues.
@@ -971,70 +776,185 @@ shaka.text.TextEngine = class {
971
776
  destroy() {}
972
777
  };
973
778
  /**
974
- * An interface to standardize how objects release internal references
975
- * synchronously. If an object needs to asynchronously release references, then
976
- * it should use 'shaka.util.IDestroyable'.
977
- * @interface
779
+ * @summary A set of language utility functions.
780
+ * @final
978
781
  */
979
- shaka.util.IReleasable = class {
782
+ shaka.util.LanguageUtils = class {
783
+ /**
784
+ * Check if |locale1| and |locale2| are locale-compatible.
785
+ * Locale-compatible is defined as all components in each locale match. Since
786
+ * we only respect the language and region components, we only check that
787
+ * the language and region components match.
788
+ * Examples:
789
+ * Locale A | Locale B | Locale Compatible
790
+ * ---------------------------------------
791
+ * en-US | en-US | true
792
+ * en | en-US | false
793
+ * en-US | en-CA | false
794
+ * @param {string} locale1
795
+ * @param {string} locale2
796
+ * @return {boolean}
797
+ */
798
+ static areLocaleCompatible(locale1, locale2) {}
799
+ /**
800
+ * Check if |locale1| and |locale2| are language-compatible.
801
+ * Language compatible is when the language component of each locale matches.
802
+ * This means that no matter what region they have (or don't have) as long as
803
+ * the language components match, they are language-compatible.
804
+ * Examples:
805
+ * Locale A | Locale B | Language-Compatible
806
+ * -----------------------------------------
807
+ * en-US | en-US | true
808
+ * en-US | en | true
809
+ * en-US | en-CA | true
810
+ * en-CA | fr-CA | false
811
+ * @param {string} locale1
812
+ * @param {string} locale2
813
+ * @return {boolean}
814
+ */
815
+ static areLanguageCompatible(locale1, locale2) {}
816
+ /**
817
+ * Check if |possibleParent| is the parent locale of |possibleChild|. Because
818
+ * we do not support dialects, the parent-child relationship is a lot simpler.
819
+ * In a parent child relationship:
820
+ * - The parent and child have the same language-component
821
+ * - The parent has no region-component
822
+ * - The child has a region-component
823
+ * Example:
824
+ * Locale A | Locale B | Is A The parent of B?
825
+ * --------------------------------------------
826
+ * en-US | en-US | no
827
+ * en-US | en | no
828
+ * en | en-US | yes
829
+ * en | en | no
830
+ * en | fr | no
831
+ * @param {string} possibleParent
832
+ * @param {string} possibleChild
833
+ * @return {boolean}
834
+ */
835
+ static isParentOf(possibleParent, possibleChild) {}
836
+ /**
837
+ * Check if |localeA| shares the same parent with |localeB|. Since we don't
838
+ * support dialect, we will only look at language and region. For two locales
839
+ * to be siblings:
840
+ * - Both must have language-components
841
+ * - Both must have region-components
842
+ * - Both must have the same language-component
843
+ * Example:
844
+ * Locale A | Locale B | Siblings?
845
+ * --------------------------------------------
846
+ * en-US | en-US | yes
847
+ * en-US | en-CA | yes
848
+ * en-US | en | no
849
+ * en | en-US | no
850
+ * en | en | no
851
+ * en | fr | no
852
+ * @param {string} localeA
853
+ * @param {string} localeB
854
+ * @return {boolean}
855
+ */
856
+ static isSiblingOf(localeA, localeB) {}
857
+ /**
858
+ * Normalize a locale. This will take a locale and canonicalize it to a state
859
+ * that we are prepared to work with.
860
+ * We only support with:
861
+ * - language
862
+ * - language-REGION
863
+ * If given a dialect, we will discard it. We will convert any 3-character
864
+ * codes to 2-character codes. We will force language codes to lowercase and
865
+ * region codes to uppercase.
866
+ * @param {string} locale
867
+ * @return {string}
868
+ */
869
+ static normalize(locale) {}
980
870
  /**
981
- * Request that this object release all internal references.
871
+ * Check if two language codes are siblings. Language codes are siblings if
872
+ * they share the same base language while neither one is the base language.
873
+ * For example, "en-US" and "en-CA" are siblings but "en-US" and "en" are not
874
+ * siblings.
875
+ * @param {string} a
876
+ * @param {string} b
877
+ * @return {boolean}
982
878
  */
983
- release() {}
879
+ static areSiblings(a, b) {}
880
+ /**
881
+ * Compute a numerical relatedness for language codes. Language codes with a
882
+ * higher relatedness are a better match. Unrelated language codes have a
883
+ * relatedness score of 0.
884
+ * @param {string} target
885
+ * @param {string} candidate
886
+ * @return {number}
887
+ */
888
+ static relatedness(target, candidate) {}
889
+ /**
890
+ * Get the normalized base language for a language code.
891
+ * @param {string} lang
892
+ * @return {string}
893
+ */
894
+ static getBase(lang) {}
895
+ /**
896
+ * Get the normalized language of the given text stream. Will return 'und' if
897
+ * a language is not found on the text stream.
898
+ * This should always be used to get the language from a text stream.
899
+ * @param {shaka.extern.Stream} stream
900
+ * @return {string}
901
+ */
902
+ static getLocaleForText(stream) {}
903
+ /**
904
+ * Get the normalized locale for the given variant. This will look through
905
+ * the variant to find the locale that represents the content in the variant.
906
+ * This will return 'und' if no language can be found.
907
+ * This should always be used to get the locale from a variant.
908
+ * @param {shaka.extern.Variant} variant
909
+ * @return {string}
910
+ */
911
+ static getLocaleForVariant(variant) {}
912
+ /**
913
+ * Find the locale in |searchSpace| that comes closest to |target|. If no
914
+ * locale is found to be close to |target|, then |null| will be returned.
915
+ * @param {string} target
916
+ * @param {!Iterable.<string>} searchSpace
917
+ * @return {?string}
918
+ */
919
+ static findClosestLocale(target, searchSpace) {}
984
920
  };
985
921
  /**
986
- * @summary
987
- * An EventManager maintains a collection of "event
988
- * bindings" between event targets and event listeners.
989
- * @implements {shaka.util.IReleasable}
922
+ * A timer allows a single function to be executed at a later time or at
923
+ * regular intervals.
924
+ * @final
990
925
  */
991
- shaka.util.EventManager = class {
992
- /** */
993
- constructor() {}
926
+ shaka.util.Timer = class {
994
927
  /**
995
- * Detaches all event listeners.
996
- * @override
928
+ * Create a new timer. A timer is committed to a single callback function.
929
+ * While there is no technical reason to do this, it is far easier to
930
+ * understand and use timers when they are connected to one functional idea.
931
+ * @param {function()} onTick
997
932
  */
998
- release() {}
933
+ constructor(onTick) {}
999
934
  /**
1000
- * Attaches an event listener to an event target.
1001
- * @param {EventTarget} target The event target.
1002
- * @param {string} type The event type.
1003
- * @param {shaka.util.EventManager.ListenerType} listener The event listener.
1004
- * @param {(boolean|!AddEventListenerOptions)=} options An object that
1005
- * specifies characteristics about the event listener.
1006
- * The passive option, if true, indicates that this function will never
1007
- * call preventDefault(), which improves scrolling performance.
935
+ * Have the timer call |onTick| now.
936
+ * @return {!shaka.util.Timer}
1008
937
  */
1009
- listen(target, type, listener, options) {}
938
+ tickNow() {}
1010
939
  /**
1011
- * Attaches an event listener to an event target. The listener will be
1012
- * removed when the first instance of the event is fired.
1013
- * @param {EventTarget} target The event target.
1014
- * @param {string} type The event type.
1015
- * @param {shaka.util.EventManager.ListenerType} listener The event listener.
1016
- * @param {(boolean|!AddEventListenerOptions)=} options An object that
1017
- * specifies characteristics about the event listener.
1018
- * The passive option, if true, indicates that this function will never
1019
- * call preventDefault(), which improves scrolling performance.
940
+ * Have the timer call |onTick| after |seconds| has elapsed unless |stop| is
941
+ * called first.
942
+ * @param {number} seconds
943
+ * @return {!shaka.util.Timer}
1020
944
  */
1021
- listenOnce(target, type, listener, options) {}
945
+ tickAfter(seconds) {}
1022
946
  /**
1023
- * Detaches an event listener from an event target.
1024
- * @param {EventTarget} target The event target.
1025
- * @param {string} type The event type.
1026
- * @param {shaka.util.EventManager.ListenerType=} listener The event listener.
947
+ * Have the timer call |onTick| every |seconds| until |stop| is called.
948
+ * @param {number} seconds
949
+ * @return {!shaka.util.Timer}
1027
950
  */
1028
- unlisten(target, type, listener) {}
951
+ tickEvery(seconds) {}
1029
952
  /**
1030
- * Detaches all event listeners from all targets.
953
+ * Stop the timer and clear the previous behaviour. The timer is still usable
954
+ * after calling |stop|.
1031
955
  */
1032
- removeAll() {}
956
+ stop() {}
1033
957
  };
1034
- /**
1035
- * @typedef {function(!Event)}
1036
- */
1037
- shaka.util.EventManager.ListenerType;
1038
958
  /**
1039
959
  * @summary
1040
960
  * <p>
@@ -1255,8 +1175,12 @@ shaka.net.NetworkingEngine = class extends shaka.util.FakeEventTarget {
1255
1175
  * @param {function(number, number)=} onProgressUpdated Called when a progress
1256
1176
  * event is triggered. Passed the duration, in milliseconds, that the
1257
1177
  * request took, and the number of bytes transferred.
1178
+ * @param {shaka.net.NetworkingEngine.OnHeadersReceived=} onHeadersReceived
1179
+ * Called when the headers are received for a download.
1180
+ * @param {shaka.net.NetworkingEngine.OnDownloadFailed=} onDownloadFailed
1181
+ * Called when a download fails, for any reason.
1258
1182
  */
1259
- constructor(onProgressUpdated) {}
1183
+ constructor(onProgressUpdated, onHeadersReceived, onDownloadFailed) {}
1260
1184
  /**
1261
1185
  * @param {boolean} forceHTTPS
1262
1186
  */
@@ -1370,30 +1294,117 @@ shaka.net.NetworkingEngine.PendingRequest = class extends shaka.util.AbortableOp
1370
1294
  * @param {shaka.net.NetworkingEngine.NumBytesRemainingClass}
1371
1295
  * numBytesRemainingObj
1372
1296
  */
1373
- constructor(promise, onAbort, numBytesRemainingObj) {}
1374
- };
1375
- /**
1376
- * Request types. Allows a filter to decide which requests to read/alter.
1377
- * @enum {number}
1378
- */
1379
- shaka.net.NetworkingEngine.RequestType = {
1380
- 'MANIFEST': 0,
1381
- 'SEGMENT': 1,
1382
- 'LICENSE': 2,
1383
- 'APP': 3,
1384
- 'TIMING': 4
1297
+ constructor(promise, onAbort, numBytesRemainingObj) {}
1298
+ };
1299
+ /**
1300
+ * Request types. Allows a filter to decide which requests to read/alter.
1301
+ * @enum {number}
1302
+ */
1303
+ shaka.net.NetworkingEngine.RequestType = {
1304
+ 'MANIFEST': 0,
1305
+ 'SEGMENT': 1,
1306
+ 'LICENSE': 2,
1307
+ 'APP': 3,
1308
+ 'TIMING': 4,
1309
+ 'SERVER_CERTIFICATE': 5
1310
+ };
1311
+ /**
1312
+ * Priority level for network scheme plugins.
1313
+ * If multiple plugins are provided for the same scheme, only the
1314
+ * highest-priority one is used.
1315
+ * @enum {number}
1316
+ */
1317
+ shaka.net.NetworkingEngine.PluginPriority = {
1318
+ 'FALLBACK': 1,
1319
+ 'PREFERRED': 2,
1320
+ 'APPLICATION': 3
1321
+ };
1322
+ /**
1323
+ * @typedef {function(
1324
+ * !Object.<string, string>,
1325
+ * !shaka.extern.Request,
1326
+ * !shaka.net.NetworkingEngine.RequestType)}
1327
+ * @description
1328
+ * A callback function that passes the shaka.extern.HeadersReceived along to
1329
+ * the player, plus some extra data.
1330
+ */
1331
+ shaka.net.NetworkingEngine.OnHeadersReceived;
1332
+ /**
1333
+ * @typedef {function(
1334
+ * !shaka.extern.Request,
1335
+ * ?shaka.util.Error,
1336
+ * number,
1337
+ * boolean)}
1338
+ * @description
1339
+ * A callback function that notifies the player when a download fails, for any
1340
+ * reason (e.g. even if the download was aborted).
1341
+ */
1342
+ shaka.net.NetworkingEngine.OnDownloadFailed;
1343
+ /**
1344
+ * An interface to standardize how objects release internal references
1345
+ * synchronously. If an object needs to asynchronously release references, then
1346
+ * it should use 'shaka.util.IDestroyable'.
1347
+ * @interface
1348
+ */
1349
+ shaka.util.IReleasable = class {
1350
+ /**
1351
+ * Request that this object release all internal references.
1352
+ */
1353
+ release() {}
1354
+ };
1355
+ /**
1356
+ * @summary
1357
+ * An EventManager maintains a collection of "event
1358
+ * bindings" between event targets and event listeners.
1359
+ * @implements {shaka.util.IReleasable}
1360
+ */
1361
+ shaka.util.EventManager = class {
1362
+ /** */
1363
+ constructor() {}
1364
+ /**
1365
+ * Detaches all event listeners.
1366
+ * @override
1367
+ */
1368
+ release() {}
1369
+ /**
1370
+ * Attaches an event listener to an event target.
1371
+ * @param {EventTarget} target The event target.
1372
+ * @param {string} type The event type.
1373
+ * @param {shaka.util.EventManager.ListenerType} listener The event listener.
1374
+ * @param {(boolean|!AddEventListenerOptions)=} options An object that
1375
+ * specifies characteristics about the event listener.
1376
+ * The passive option, if true, indicates that this function will never
1377
+ * call preventDefault(), which improves scrolling performance.
1378
+ */
1379
+ listen(target, type, listener, options) {}
1380
+ /**
1381
+ * Attaches an event listener to an event target. The listener will be
1382
+ * removed when the first instance of the event is fired.
1383
+ * @param {EventTarget} target The event target.
1384
+ * @param {string} type The event type.
1385
+ * @param {shaka.util.EventManager.ListenerType} listener The event listener.
1386
+ * @param {(boolean|!AddEventListenerOptions)=} options An object that
1387
+ * specifies characteristics about the event listener.
1388
+ * The passive option, if true, indicates that this function will never
1389
+ * call preventDefault(), which improves scrolling performance.
1390
+ */
1391
+ listenOnce(target, type, listener, options) {}
1392
+ /**
1393
+ * Detaches an event listener from an event target.
1394
+ * @param {EventTarget} target The event target.
1395
+ * @param {string} type The event type.
1396
+ * @param {shaka.util.EventManager.ListenerType=} listener The event listener.
1397
+ */
1398
+ unlisten(target, type, listener) {}
1399
+ /**
1400
+ * Detaches all event listeners from all targets.
1401
+ */
1402
+ removeAll() {}
1385
1403
  };
1386
1404
  /**
1387
- * Priority level for network scheme plugins.
1388
- * If multiple plugins are provided for the same scheme, only the
1389
- * highest-priority one is used.
1390
- * @enum {number}
1405
+ * @typedef {function(!Event)}
1391
1406
  */
1392
- shaka.net.NetworkingEngine.PluginPriority = {
1393
- 'FALLBACK': 1,
1394
- 'PREFERRED': 2,
1395
- 'APPLICATION': 3
1396
- };
1407
+ shaka.util.EventManager.ListenerType;
1397
1408
  /**
1398
1409
  * @summary A set of FairPlay utility functions.
1399
1410
  */
@@ -1447,6 +1458,176 @@ shaka.media.ManifestParser = class {
1447
1458
  */
1448
1459
  static unregisterParserByMime(mimeType) {}
1449
1460
  };
1461
+ /**
1462
+ * @summary DataViewReader abstracts a DataView object.
1463
+ */
1464
+ shaka.util.DataViewReader = class {
1465
+ /**
1466
+ * @param {BufferSource} data
1467
+ * @param {shaka.util.DataViewReader.Endianness} endianness The endianness.
1468
+ */
1469
+ constructor(data, endianness) {}
1470
+ /**
1471
+ * @return {boolean} True if the reader has more data, false otherwise.
1472
+ */
1473
+ hasMoreData() {}
1474
+ /**
1475
+ * Gets the current byte position.
1476
+ * @return {number}
1477
+ */
1478
+ getPosition() {}
1479
+ /**
1480
+ * Gets the byte length of the DataView.
1481
+ * @return {number}
1482
+ */
1483
+ getLength() {}
1484
+ /**
1485
+ * Reads an unsigned 8 bit integer, and advances the reader.
1486
+ * @return {number} The integer.
1487
+ */
1488
+ readUint8() {}
1489
+ /**
1490
+ * Reads an unsigned 16 bit integer, and advances the reader.
1491
+ * @return {number} The integer.
1492
+ */
1493
+ readUint16() {}
1494
+ /**
1495
+ * Reads an unsigned 32 bit integer, and advances the reader.
1496
+ * @return {number} The integer.
1497
+ */
1498
+ readUint32() {}
1499
+ /**
1500
+ * Reads a signed 32 bit integer, and advances the reader.
1501
+ * @return {number} The integer.
1502
+ */
1503
+ readInt32() {}
1504
+ /**
1505
+ * Reads an unsigned 64 bit integer, and advances the reader.
1506
+ * @return {number} The integer.
1507
+ */
1508
+ readUint64() {}
1509
+ /**
1510
+ * Reads the specified number of raw bytes.
1511
+ * @param {number} bytes The number of bytes to read.
1512
+ * @return {!Uint8Array}
1513
+ */
1514
+ readBytes(bytes) {}
1515
+ /**
1516
+ * Skips the specified number of bytes.
1517
+ * @param {number} bytes The number of bytes to skip.
1518
+ */
1519
+ skip(bytes) {}
1520
+ /**
1521
+ * Rewinds the specified number of bytes.
1522
+ * @param {number} bytes The number of bytes to rewind.
1523
+ */
1524
+ rewind(bytes) {}
1525
+ /**
1526
+ * Seeks to a specified position.
1527
+ * @param {number} position The desired byte position within the DataView.
1528
+ */
1529
+ seek(position) {}
1530
+ /**
1531
+ * Keeps reading until it reaches a byte that equals to zero. The text is
1532
+ * assumed to be UTF-8.
1533
+ * @return {string}
1534
+ */
1535
+ readTerminatedString() {}
1536
+ };
1537
+ /**
1538
+ * Endianness.
1539
+ * @enum {number}
1540
+ */
1541
+ shaka.util.DataViewReader.Endianness = {
1542
+ 'BIG_ENDIAN': 0,
1543
+ 'LITTLE_ENDIAN': 1
1544
+ };
1545
+ /**
1546
+ */
1547
+ shaka.util.Mp4Parser = class {
1548
+ /** */
1549
+ constructor() {}
1550
+ /**
1551
+ * Declare a box type as a Box.
1552
+ * @param {string} type
1553
+ * @param {!shaka.util.Mp4Parser.CallbackType} definition
1554
+ * @return {!shaka.util.Mp4Parser}
1555
+ */
1556
+ box(type, definition) {}
1557
+ /**
1558
+ * Declare a box type as a Full Box.
1559
+ * @param {string} type
1560
+ * @param {!shaka.util.Mp4Parser.CallbackType} definition
1561
+ * @return {!shaka.util.Mp4Parser}
1562
+ */
1563
+ fullBox(type, definition) {}
1564
+ /**
1565
+ * Stop parsing. Useful for extracting information from partial segments and
1566
+ * avoiding an out-of-bounds error once you find what you are looking for.
1567
+ */
1568
+ stop() {}
1569
+ /**
1570
+ * Parse the given data using the added callbacks.
1571
+ * @param {!BufferSource} data
1572
+ * @param {boolean=} partialOkay If true, allow reading partial payloads
1573
+ * from some boxes. If the goal is a child box, we can sometimes find it
1574
+ * without enough data to find all child boxes.
1575
+ * @param {boolean=} stopOnPartial If true, stop reading if an incomplete
1576
+ * box is detected.
1577
+ */
1578
+ parse(data, partialOkay, stopOnPartial) {}
1579
+ /**
1580
+ * Parse the next box on the current level.
1581
+ * @param {number} absStart The absolute start position in the original
1582
+ * byte array.
1583
+ * @param {!shaka.util.DataViewReader} reader
1584
+ * @param {boolean=} partialOkay If true, allow reading partial payloads
1585
+ * from some boxes. If the goal is a child box, we can sometimes find it
1586
+ * without enough data to find all child boxes.
1587
+ * @param {boolean=} stopOnPartial If true, stop reading if an incomplete
1588
+ * box is detected.
1589
+ */
1590
+ parseNext(absStart, reader, partialOkay, stopOnPartial) {}
1591
+ /**
1592
+ * A callback that tells the Mp4 parser to treat the body of a box as a series
1593
+ * of boxes. The number of boxes is limited by the size of the parent box.
1594
+ * @param {!shaka.extern.ParsedBox} box
1595
+ */
1596
+ static children(box) {}
1597
+ /**
1598
+ * A callback that tells the Mp4 parser to treat the body of a box as a sample
1599
+ * description. A sample description box has a fixed number of children. The
1600
+ * number of children is represented by a 4 byte unsigned integer. Each child
1601
+ * is a box.
1602
+ * @param {!shaka.extern.ParsedBox} box
1603
+ */
1604
+ static sampleDescription(box) {}
1605
+ /**
1606
+ * Create a callback that tells the Mp4 parser to treat the body of a box as a
1607
+ * binary blob and to parse the body's contents using the provided callback.
1608
+ * @param {function(!Uint8Array)} callback
1609
+ * @return {!shaka.util.Mp4Parser.CallbackType}
1610
+ */
1611
+ static allData(callback) {}
1612
+ /**
1613
+ * Convert an integer type from a box into an ascii string name.
1614
+ * Useful for debugging.
1615
+ * @param {number} type The type of the box, a uint32.
1616
+ * @return {string}
1617
+ */
1618
+ static typeToString(type) {}
1619
+ /**
1620
+ * Find the header size of the box.
1621
+ * Useful for modifying boxes in place or finding the exact offset of a field.
1622
+ * @param {shaka.extern.ParsedBox} box
1623
+ * @return {number}
1624
+ */
1625
+ static headerSize(box) {}
1626
+ };
1627
+ /**
1628
+ * @typedef {function(!shaka.extern.ParsedBox)}
1629
+ */
1630
+ shaka.util.Mp4Parser.CallbackType;
1450
1631
  /**
1451
1632
  * Creates an InitSegmentReference, which provides the location to an
1452
1633
  * initialization segment.
@@ -1457,11 +1638,13 @@ shaka.media.InitSegmentReference = class {
1457
1638
  * of the resource containing the segment.
1458
1639
  * @param {number} startByte The offset from the start of the resource to the
1459
1640
  * start of the segment.
1460
- * @param {?number} endByte The offset from the start of the resource to the
1461
- * end of the segment, inclusive. A value of null indicates that the
1641
+ * @param {?number} endByte The offset from the start of the resource
1642
+ * to the end of the segment, inclusive. A value of null indicates that the
1462
1643
  * segment extends to the end of the resource.
1644
+ * @param {null|shaka.extern.MediaQualityInfo=} mediaQuality Information about
1645
+ * the quality of the media associated with this init segment.
1463
1646
  */
1464
- constructor(uris, startByte, endByte) {}
1647
+ constructor(uris, startByte, endByte, mediaQuality) {}
1465
1648
  /**
1466
1649
  * Returns the offset from the start of the resource to the
1467
1650
  * start of the segment.
@@ -1517,9 +1700,13 @@ shaka.media.SegmentReference = class {
1517
1700
  * presentation. Any content from after this time will be removed by
1518
1701
  * MediaSource.
1519
1702
  * @param {!Array.<!shaka.media.SegmentReference>=} partialReferences
1520
- A list of SegmentReferences for the partial segments.
1703
+ * A list of SegmentReferences for the partial segments.
1704
+ * @param {?string=} tilesLayout
1705
+ * The value is a grid-item-dimension consisting of two positive decimal
1706
+ * integers in the format: column-x-row ('4x3'). It describes the
1707
+ * arrangement of Images in a Grid. The minimum valid LAYOUT is '1x1'.
1521
1708
  */
1522
- constructor(startTime, endTime, uris, startByte, endByte, initSegmentReference, timestampOffset, appendWindowStart, appendWindowEnd, partialReferences) {}
1709
+ constructor(startTime, endTime, uris, startByte, endByte, initSegmentReference, timestampOffset, appendWindowStart, appendWindowEnd, partialReferences, tilesLayout) {}
1523
1710
  /**
1524
1711
  * Creates and returns the URIs of the resource containing the segment.
1525
1712
  * @return {!Array.<string>}
@@ -1548,6 +1735,11 @@ shaka.media.SegmentReference = class {
1548
1735
  * @return {?number}
1549
1736
  */
1550
1737
  getEndByte() {}
1738
+ /**
1739
+ * Returns the segment's tiles layout. Only defined in image segments.
1740
+ * @return {?string}
1741
+ */
1742
+ getTilesLayout() {}
1551
1743
  };
1552
1744
  /**
1553
1745
  * PresentationTimeline.
@@ -1983,6 +2175,46 @@ shaka.text.UITextDisplayer = class {
1983
2175
  */
1984
2176
  shaka.text.WebVttGenerator = class {
1985
2177
  };
2178
+ /**
2179
+ * @typedef {{
2180
+ * type: string,
2181
+ * init: boolean,
2182
+ * duration: number,
2183
+ * mimeType: string,
2184
+ * codecs: string,
2185
+ * bandwidth: (number|undefined)
2186
+ * }}
2187
+ * @property {string} type
2188
+ * The media type
2189
+ * @property {boolean} init
2190
+ * Flag indicating whether the segment is an init segment
2191
+ * @property {number} duration
2192
+ * The duration of the segment in seconds
2193
+ * @property {string} mimeType
2194
+ * The segment's mime type
2195
+ * @property {string} codecs
2196
+ * The segment's codecs
2197
+ * @property {(number|undefined)} bandwidth
2198
+ * The segment's variation bandwidth
2199
+ */
2200
+ shaka.util.CmcdManager.SegmentInfo;
2201
+ /**
2202
+ * @typedef {{
2203
+ * format: shaka.util.CmcdManager.StreamingFormat
2204
+ * }}
2205
+ * @property {shaka.util.CmcdManager.StreamingFormat} format
2206
+ * The manifest's stream format
2207
+ */
2208
+ shaka.util.CmcdManager.ManifestInfo;
2209
+ /**
2210
+ * @enum {string}
2211
+ */
2212
+ shaka.util.CmcdManager.StreamingFormat = {
2213
+ DASH: 'd',
2214
+ HLS: 'h',
2215
+ SMOOTH: 's',
2216
+ OTHER: 'o'
2217
+ };
1986
2218
  /** */
1987
2219
  shaka.util.ConfigUtils = class {
1988
2220
  /**
@@ -2122,6 +2354,14 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
2122
2354
  * @return {!Promise}
2123
2355
  */
2124
2356
  unload(initializeMediaSource) {}
2357
+ /**
2358
+ * Provides a way to update the stream start position during the media loading
2359
+ * process. Can for example be called from the <code>manifestparsed</code>
2360
+ * event handler to update the start position based on information in the
2361
+ * manifest.
2362
+ * @param {number} startTime
2363
+ */
2364
+ updateStartTime(startTime) {}
2125
2365
  /**
2126
2366
  * Tell the player to load the content at <code>assetUri</code> and start
2127
2367
  * playback at <code>startTime</code>. Before calling <code>load</code>,
@@ -2169,6 +2409,11 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
2169
2409
  * @return {shaka.extern.PlayerConfiguration}
2170
2410
  */
2171
2411
  getConfiguration() {}
2412
+ /**
2413
+ * Returns the ratio of video length buffered compared to buffering Goal
2414
+ * @return {number}
2415
+ */
2416
+ getBufferFullness() {}
2172
2417
  /**
2173
2418
  * Reset configuration to default.
2174
2419
  */
@@ -2231,6 +2476,10 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
2231
2476
  * @return {{start: number, end: number}}
2232
2477
  */
2233
2478
  seekRange() {}
2479
+ /**
2480
+ * Go to live in a live stream.
2481
+ */
2482
+ goToLive() {}
2234
2483
  /**
2235
2484
  * Get the key system currently used by EME. If EME is not being used, this
2236
2485
  * will return an empty string. If the player has not loaded content, this
@@ -2412,6 +2661,17 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
2412
2661
  * @return {boolean}
2413
2662
  */
2414
2663
  isTextTrackVisible() {}
2664
+ /**
2665
+ * Return a list of chapters tracks.
2666
+ * @return {!Array.<shaka.extern.Track>}
2667
+ */
2668
+ getChaptersTracks() {}
2669
+ /**
2670
+ * This returns the list of chapters.
2671
+ * @param {string} language
2672
+ * @return {!Array.<shaka.extern.Chapter>}
2673
+ */
2674
+ getChapters(language) {}
2415
2675
  /**
2416
2676
  * Enable or disable the text displayer. If the player is in an unloaded
2417
2677
  * state, the request will be applied next time content is loaded.
@@ -2475,6 +2735,16 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
2475
2735
  * @return {!Promise.<shaka.extern.Track>}
2476
2736
  */
2477
2737
  addTextTrackAsync(uri, language, kind, mimeType, codec, label, forced) {}
2738
+ /**
2739
+ * Adds the given chapters track to the loaded manifest. <code>load()</code>
2740
+ * must resolve before calling. The presentation must have a duration.
2741
+ * This returns the created track.
2742
+ * @param {string} uri
2743
+ * @param {string} language
2744
+ * @param {string=} mimeType
2745
+ * @return {!Promise.<shaka.extern.Track>}
2746
+ */
2747
+ addChaptersTrack(uri, language, mimeType) {}
2478
2748
  /**
2479
2749
  * Set the maximum resolution that the platform's hardware can handle.
2480
2750
  * This will be called automatically by <code>shaka.cast.CastReceiver</code>
@@ -2601,6 +2871,10 @@ shaka.ads.ClientSideAd = class {
2601
2871
  * @override
2602
2872
  */
2603
2873
  isMuted() {}
2874
+ /**
2875
+ * @override
2876
+ */
2877
+ isLinear() {}
2604
2878
  /**
2605
2879
  * @override
2606
2880
  */
@@ -2683,6 +2957,10 @@ shaka.ads.ServerSideAd = class {
2683
2957
  * @override
2684
2958
  */
2685
2959
  isMuted() {}
2960
+ /**
2961
+ * @override
2962
+ */
2963
+ isLinear() {}
2686
2964
  /**
2687
2965
  * @override
2688
2966
  */
@@ -2747,6 +3025,11 @@ shaka.ads.AdManager = class extends shaka.util.FakeEventTarget {
2747
3025
  * @override
2748
3026
  */
2749
3027
  replaceServerSideAdTagParameters(adTagParameters) {}
3028
+ /**
3029
+ * @return {!Array.<!shaka.extern.AdCuePoint>}
3030
+ * @override
3031
+ */
3032
+ getServerSideCuePoints() {}
2750
3033
  /**
2751
3034
  * @return {shaka.extern.AdsStats}
2752
3035
  * @override
@@ -3148,9 +3431,11 @@ shaka.net.HttpFetchPlugin = class {
3148
3431
  * @param {shaka.net.NetworkingEngine.RequestType} requestType
3149
3432
  * @param {shaka.extern.ProgressUpdated} progressUpdated Called when a
3150
3433
  * progress event happened.
3434
+ * @param {shaka.extern.HeadersReceived} headersReceived Called when the
3435
+ * headers for the download are received, but before the body is.
3151
3436
  * @return {!shaka.extern.IAbortableOperation.<shaka.extern.Response>}
3152
3437
  */
3153
- static parse(uri, request, requestType, progressUpdated) {}
3438
+ static parse(uri, request, requestType, progressUpdated, headersReceived) {}
3154
3439
  /**
3155
3440
  * Determine if the Fetch API is supported in the browser. Note: this is
3156
3441
  * deliberately exposed as a method to allow the client app to use the same
@@ -3169,9 +3454,11 @@ shaka.net.HttpXHRPlugin = class {
3169
3454
  * @param {shaka.net.NetworkingEngine.RequestType} requestType
3170
3455
  * @param {shaka.extern.ProgressUpdated} progressUpdated Called when a
3171
3456
  * progress event happened.
3457
+ * @param {shaka.extern.HeadersReceived} headersReceived Called when the
3458
+ * headers for the download are received, but before the body is.
3172
3459
  * @return {!shaka.extern.IAbortableOperation.<shaka.extern.Response>}
3173
3460
  */
3174
- static parse(uri, request, requestType, progressUpdated) {}
3461
+ static parse(uri, request, requestType, progressUpdated, headersReceived) {}
3175
3462
  };
3176
3463
  /**
3177
3464
  * StorageMuxer is responsible for managing StorageMechanisms and addressing
@@ -3362,6 +3649,20 @@ shaka.polyfill = class {
3362
3649
  */
3363
3650
  static register(polyfill, priority) {}
3364
3651
  };
3652
+ /**
3653
+ * @summary A polyfill to add support for the ARIAMixin interface mixin, for
3654
+ * browsers that do not implement it (e.g. Firefox).
3655
+ * Note that IE also does not support ARIAMixin, but this polyfill does not work
3656
+ * for that platform, as it relies on getters and setters.
3657
+ * @see https://w3c.github.io/aria/#ARIAMixin
3658
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/Element
3659
+ */
3660
+ shaka.polyfill.Aria = class {
3661
+ /**
3662
+ * Install the polyfill if needed.
3663
+ */
3664
+ static install() {}
3665
+ };
3365
3666
  /**
3366
3667
  * @summary A polyfill to add support for EncryptionScheme queries in EME.
3367
3668
  * @see https://wicg.github.io/encrypted-media-encryption-scheme/
@@ -3484,6 +3785,15 @@ shaka.polyfill.PiPWebkit = class {
3484
3785
  */
3485
3786
  static install() {}
3486
3787
  };
3788
+ /**
3789
+ * @summary A polyfill to provide window.crypto.randomUUID in all browsers.
3790
+ */
3791
+ shaka.polyfill.RandomUUID = class {
3792
+ /**
3793
+ * Install the polyfill if needed.
3794
+ */
3795
+ static install() {}
3796
+ };
3487
3797
  /**
3488
3798
  * @summary A polyfill to provide navigator.storage.estimate in old
3489
3799
  * webkit browsers.
@@ -3623,8 +3933,8 @@ shaka.text.SrtTextParser = class {
3623
3933
  parseMedia(data, time) {}
3624
3934
  /**
3625
3935
  * Convert a SRT format to WebVTT
3626
- * @param {!string} data
3627
- * @return {!string}
3936
+ * @param {string} data
3937
+ * @return {string}
3628
3938
  */
3629
3939
  static srt2webvtt(data) {}
3630
3940
  };