shaka-player 4.12.8 → 4.13.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 (261) hide show
  1. package/AUTHORS +1 -0
  2. package/CONTRIBUTORS +4 -0
  3. package/README.md +22 -21
  4. package/cspell.config.yaml +18 -0
  5. package/dist/controls.css +1 -1
  6. package/dist/controls.css.map +1 -1
  7. package/dist/deps.js +29 -24
  8. package/dist/locales.js +33 -33
  9. package/dist/shaka-player.compiled.d.ts +138 -36
  10. package/dist/shaka-player.compiled.debug.d.ts +138 -36
  11. package/dist/shaka-player.compiled.debug.externs.js +367 -107
  12. package/dist/shaka-player.compiled.debug.js +828 -765
  13. package/dist/shaka-player.compiled.debug.map +4 -4
  14. package/dist/shaka-player.compiled.externs.js +367 -107
  15. package/dist/shaka-player.compiled.js +1451 -1416
  16. package/dist/shaka-player.compiled.map +4 -4
  17. package/dist/shaka-player.ui.d.ts +172 -38
  18. package/dist/shaka-player.ui.debug.d.ts +172 -38
  19. package/dist/shaka-player.ui.debug.externs.js +406 -113
  20. package/dist/shaka-player.ui.debug.js +842 -766
  21. package/dist/shaka-player.ui.debug.map +4 -4
  22. package/dist/shaka-player.ui.externs.js +406 -113
  23. package/dist/shaka-player.ui.js +1670 -1628
  24. package/dist/shaka-player.ui.map +4 -4
  25. package/eslint.config.mjs +343 -0
  26. package/externs/airplay.js +1 -1
  27. package/externs/audiotrack.js +1 -1
  28. package/externs/awesomplete.js +1 -1
  29. package/externs/cast-sdk-v2.js +2 -2
  30. package/externs/cmcd.js +16 -1
  31. package/externs/device_sensor_event.js +1 -1
  32. package/externs/ima.js +8 -8
  33. package/externs/isoboxer.js +31 -31
  34. package/externs/jwk_set.js +1 -1
  35. package/externs/lcevc.js +8 -8
  36. package/externs/mediakeys.js +1 -1
  37. package/externs/mediasession.js +3 -2
  38. package/externs/mediatailor.js +18 -18
  39. package/externs/pictureinpicture.js +41 -1
  40. package/externs/playstation.js +2 -2
  41. package/externs/prefixed_eme.js +1 -1
  42. package/externs/shaka/abortable.js +4 -4
  43. package/externs/shaka/abr_manager.js +1 -1
  44. package/externs/shaka/ads.js +45 -6
  45. package/externs/shaka/cea.js +2 -2
  46. package/externs/shaka/codecs.js +4 -4
  47. package/externs/shaka/drm_info.js +6 -6
  48. package/externs/shaka/error.js +5 -5
  49. package/externs/shaka/manifest.js +51 -56
  50. package/externs/shaka/manifest_parser.js +3 -9
  51. package/externs/shaka/net.js +23 -20
  52. package/externs/shaka/offline.js +37 -37
  53. package/externs/shaka/offline_compat_v1.js +10 -10
  54. package/externs/shaka/offline_compat_v2.js +10 -10
  55. package/externs/shaka/player.js +139 -109
  56. package/externs/shaka/text.js +10 -3
  57. package/externs/shaka/transmuxer.js +1 -1
  58. package/externs/videotrack.js +1 -1
  59. package/lib/abr/ewma.js +1 -1
  60. package/lib/abr/simple_abr_manager.js +70 -22
  61. package/lib/ads/ad_manager.js +43 -18
  62. package/lib/ads/ad_utils.js +160 -58
  63. package/lib/ads/ads_stats.js +1 -1
  64. package/lib/ads/client_side_ad_manager.js +2 -2
  65. package/lib/ads/interstitial_ad.js +16 -11
  66. package/lib/ads/interstitial_ad_manager.js +419 -72
  67. package/lib/ads/interstitial_static_ad.js +299 -0
  68. package/lib/ads/media_tailor_ad.js +1 -0
  69. package/lib/ads/media_tailor_ad_manager.js +37 -36
  70. package/lib/ads/server_side_ad_manager.js +7 -6
  71. package/lib/cast/cast_receiver.js +5 -3
  72. package/lib/cast/cast_sender.js +2 -2
  73. package/lib/cast/cast_utils.js +20 -13
  74. package/lib/cea/cea608_data_channel.js +53 -53
  75. package/lib/cea/cea708_service.js +42 -40
  76. package/lib/cea/cea708_window.js +5 -2
  77. package/lib/cea/cea_decoder.js +5 -7
  78. package/lib/cea/mp4_cea_parser.js +1 -1
  79. package/lib/cea/sei_processor.js +1 -1
  80. package/lib/dash/content_protection.js +62 -192
  81. package/lib/dash/dash_parser.js +119 -119
  82. package/lib/dash/mpd_utils.js +14 -13
  83. package/lib/dash/segment_base.js +5 -5
  84. package/lib/dash/segment_list.js +10 -10
  85. package/lib/dash/segment_template.js +55 -53
  86. package/lib/debug/log.js +2 -2
  87. package/lib/dependencies/all.js +2 -1
  88. package/lib/{media → drm}/drm_engine.js +274 -143
  89. package/lib/{util → drm}/drm_utils.js +20 -11
  90. package/lib/drm/playready.js +233 -0
  91. package/lib/hls/hls_classes.js +14 -14
  92. package/lib/hls/hls_parser.js +257 -196
  93. package/lib/hls/hls_utils.js +14 -14
  94. package/lib/hls/manifest_text_parser.js +10 -10
  95. package/lib/media/adaptation_set.js +6 -5
  96. package/lib/media/adaptation_set_criteria.js +51 -379
  97. package/lib/media/buffering_observer.js +5 -4
  98. package/lib/media/closed_caption_parser.js +2 -2
  99. package/lib/media/content_workarounds.js +2 -2
  100. package/lib/media/example_based_criteria.js +69 -0
  101. package/lib/media/gap_jumping_controller.js +14 -1
  102. package/lib/media/manifest_filterer.js +8 -8
  103. package/lib/media/manifest_parser.js +2 -2
  104. package/lib/media/media_source_capabilities.js +20 -1
  105. package/lib/media/media_source_engine.js +84 -35
  106. package/lib/media/mp4_segment_index_parser.js +5 -5
  107. package/lib/media/playhead.js +2 -8
  108. package/lib/media/playhead_observer.js +1 -1
  109. package/lib/media/preference_based_criteria.js +333 -0
  110. package/lib/media/preload_manager.js +53 -37
  111. package/lib/media/presentation_timeline.js +2 -2
  112. package/lib/media/quality_observer.js +35 -35
  113. package/lib/media/region_observer.js +2 -2
  114. package/lib/media/region_timeline.js +3 -3
  115. package/lib/media/segment_index.js +14 -14
  116. package/lib/media/segment_prefetch.js +17 -13
  117. package/lib/media/segment_reference.js +7 -7
  118. package/lib/media/segment_utils.js +9 -9
  119. package/lib/media/streaming_engine.js +77 -38
  120. package/lib/media/time_ranges_utils.js +1 -1
  121. package/lib/media/video_wrapper.js +1 -1
  122. package/lib/media/webm_segment_index_parser.js +4 -4
  123. package/lib/mss/content_protection.js +17 -222
  124. package/lib/mss/mss_parser.js +23 -24
  125. package/lib/net/data_uri_plugin.js +1 -0
  126. package/lib/net/http_fetch_plugin.js +8 -7
  127. package/lib/net/http_plugin_utils.js +5 -2
  128. package/lib/net/http_xhr_plugin.js +4 -3
  129. package/lib/net/networking_engine.js +72 -17
  130. package/lib/net/networking_utils.js +5 -2
  131. package/lib/offline/download_info.js +5 -1
  132. package/lib/offline/download_manager.js +15 -4
  133. package/lib/offline/download_progress_estimator.js +1 -1
  134. package/lib/offline/indexeddb/base_storage_cell.js +9 -9
  135. package/lib/offline/indexeddb/db_connection.js +1 -1
  136. package/lib/offline/indexeddb/db_operation.js +2 -2
  137. package/lib/offline/indexeddb/eme_session_storage_cell.js +1 -1
  138. package/lib/offline/indexeddb/storage_mechanism.js +1 -1
  139. package/lib/offline/indexeddb/v1_storage_cell.js +3 -3
  140. package/lib/offline/indexeddb/v2_storage_cell.js +2 -2
  141. package/lib/offline/manifest_converter.js +11 -12
  142. package/lib/offline/offline_scheme.js +8 -4
  143. package/lib/offline/session_deleter.js +11 -11
  144. package/lib/offline/storage.js +137 -88
  145. package/lib/offline/storage_muxer.js +8 -8
  146. package/lib/offline/stored_content_utils.js +3 -3
  147. package/lib/offline/stream_bandwidth_estimator.js +1 -1
  148. package/lib/player.js +291 -207
  149. package/lib/polyfill/all.js +1 -1
  150. package/lib/polyfill/media_capabilities.js +5 -5
  151. package/lib/polyfill/patchedmediakeys_apple.js +6 -6
  152. package/lib/polyfill/patchedmediakeys_webkit.js +8 -8
  153. package/lib/polyfill/video_play_promise.js +0 -1
  154. package/lib/text/cue.js +3 -2
  155. package/lib/text/lrc_text_parser.js +1 -1
  156. package/lib/text/mp4_ttml_parser.js +1 -1
  157. package/lib/text/mp4_vtt_parser.js +3 -3
  158. package/lib/text/sbv_text_parser.js +1 -1
  159. package/lib/text/simple_text_displayer.js +37 -10
  160. package/lib/text/ssa_text_parser.js +3 -1
  161. package/lib/text/stub_text_displayer.js +12 -5
  162. package/lib/text/text_engine.js +5 -4
  163. package/lib/text/text_utils.js +4 -4
  164. package/lib/text/ttml_text_parser.js +21 -20
  165. package/lib/text/ui_text_displayer.js +20 -13
  166. package/lib/text/vtt_text_parser.js +10 -10
  167. package/lib/text/web_vtt_generator.js +2 -2
  168. package/lib/transmuxer/aac_transmuxer.js +2 -2
  169. package/lib/transmuxer/ac3_transmuxer.js +2 -2
  170. package/lib/transmuxer/adts.js +2 -0
  171. package/lib/transmuxer/ec3.js +3 -3
  172. package/lib/transmuxer/ec3_transmuxer.js +2 -2
  173. package/lib/transmuxer/h264.js +5 -5
  174. package/lib/transmuxer/h265.js +3 -3
  175. package/lib/transmuxer/mp3_transmuxer.js +2 -2
  176. package/lib/transmuxer/mpeg_audio.js +6 -6
  177. package/lib/transmuxer/mss_transmuxer.js +2 -0
  178. package/lib/transmuxer/transmuxer_engine.js +1 -1
  179. package/lib/transmuxer/ts_transmuxer.js +10 -10
  180. package/lib/util/abortable_operation.js +10 -10
  181. package/lib/util/array_utils.js +6 -6
  182. package/lib/util/cmcd_manager.js +149 -18
  183. package/lib/util/cmsd_manager.js +11 -11
  184. package/lib/util/config_utils.js +3 -3
  185. package/lib/util/content_steering_manager.js +17 -17
  186. package/lib/util/data_view_reader.js +3 -3
  187. package/lib/util/ebml_parser.js +1 -1
  188. package/lib/util/error.js +11 -6
  189. package/lib/util/event_manager.js +1 -1
  190. package/lib/util/exp_golomb.js +1 -1
  191. package/lib/util/fairplay_utils.js +6 -1
  192. package/lib/util/fake_event.js +3 -2
  193. package/lib/util/fake_event_target.js +1 -1
  194. package/lib/util/functional.js +8 -8
  195. package/lib/util/id3_utils.js +1 -1
  196. package/lib/util/iterables.js +6 -6
  197. package/lib/util/language_utils.js +17 -17
  198. package/lib/util/manifest_parser_utils.js +13 -13
  199. package/lib/util/map_utils.js +6 -6
  200. package/lib/util/media_ready_state_utils.js +1 -1
  201. package/lib/util/mime_utils.js +15 -4
  202. package/lib/util/mp4_box_parsers.js +5 -5
  203. package/lib/util/mp4_generator.js +31 -30
  204. package/lib/util/mp4_parser.js +2 -2
  205. package/lib/util/multi_map.js +5 -5
  206. package/lib/util/mutex.js +1 -1
  207. package/lib/util/networking.js +1 -1
  208. package/lib/util/object_utils.js +5 -1
  209. package/lib/util/operation_manager.js +1 -1
  210. package/lib/util/periods.js +24 -24
  211. package/lib/util/platform.js +8 -4
  212. package/lib/util/player_configuration.js +50 -17
  213. package/lib/util/pssh.js +34 -6
  214. package/lib/util/public_promise.js +2 -2
  215. package/lib/util/state_history.js +2 -2
  216. package/lib/util/stream_utils.js +138 -120
  217. package/lib/util/string_utils.js +4 -3
  218. package/lib/util/switch_history.js +2 -2
  219. package/lib/util/tXml.js +22 -17
  220. package/lib/util/text_parser.js +2 -2
  221. package/lib/util/timer.js +1 -1
  222. package/lib/util/ts_parser.js +22 -22
  223. package/lib/util/xml_utils.js +1 -0
  224. package/package.json +7 -4
  225. package/project-words.txt +485 -0
  226. package/shaka-player.uncompiled.js +1 -1
  227. package/third_party/closure-uri/uri.js +2 -2
  228. package/third_party/closure-uri/utils.js +2 -2
  229. package/third_party/language-mapping-list/language-mapping-list.js +1 -1
  230. package/ui/ad_statistics_button.js +9 -5
  231. package/ui/airplay_button.js +1 -0
  232. package/ui/audio_language_selection.js +2 -1
  233. package/ui/context_menu.js +2 -2
  234. package/ui/controls.js +7 -7
  235. package/ui/externs/ui.js +29 -21
  236. package/ui/externs/watermark.js +64 -0
  237. package/ui/fast_forward_button.js +1 -1
  238. package/ui/gl_matrix/matrix_4x4.js +11 -5
  239. package/ui/hidden_fast_forward_button.js +1 -1
  240. package/ui/hidden_seek_button.js +1 -1
  241. package/ui/language_utils.js +27 -26
  242. package/ui/less/buttons.less +2 -2
  243. package/ui/localization.js +21 -21
  244. package/ui/loop_button.js +2 -2
  245. package/ui/overflow_menu.js +2 -2
  246. package/ui/playback_rate_selection.js +1 -1
  247. package/ui/presentation_time.js +4 -1
  248. package/ui/range_element.js +2 -2
  249. package/ui/resolution_selection.js +42 -6
  250. package/ui/rewind_button.js +1 -1
  251. package/ui/seek_bar.js +5 -5
  252. package/ui/statistics_button.js +8 -4
  253. package/ui/text_selection.js +3 -2
  254. package/ui/ui.js +32 -2
  255. package/ui/vr_manager.js +3 -3
  256. package/ui/vr_utils.js +14 -14
  257. package/ui/vr_webgl.js +5 -5
  258. package/ui/watermark.js +313 -0
  259. package/.eslintignore +0 -4
  260. package/.eslintrc.js +0 -310
  261. package/lib/polyfill/patchedmediakeys_nop.js +0 -148
@@ -19,9 +19,9 @@ shaka.util.Functional = class {
19
19
  * e.g.:
20
20
  * Promise.reject().catch(callback(array[0])).catch(callback(array[1]));
21
21
  *
22
- * @param {!Array.<ELEM>} array
23
- * @param {function(ELEM):!Promise.<RESULT>} callback
24
- * @return {!Promise.<RESULT>}
22
+ * @param {!Array<ELEM>} array
23
+ * @param {function(ELEM): !Promise<RESULT>} callback
24
+ * @return {!Promise<RESULT>}
25
25
  * @template ELEM,RESULT
26
26
  */
27
27
  static createFallbackPromiseChain(array, callback) {
@@ -35,9 +35,9 @@ shaka.util.Functional = class {
35
35
  * Returns the first array concatenated to the second; used to collapse an
36
36
  * array of arrays into a single array.
37
37
  *
38
- * @param {!Array.<T>} all
39
- * @param {!Array.<T>} part
40
- * @return {!Array.<T>}
38
+ * @param {!Array<T>} all
39
+ * @param {!Array<T>} part
40
+ * @return {!Array<T>}
41
41
  * @template T
42
42
  */
43
43
  static collapseArrays(all, part) {
@@ -82,8 +82,8 @@ shaka.util.Functional = class {
82
82
  * |asyncProcess| is still allowed to complete.
83
83
  *
84
84
  * @param {number} seconds
85
- * @param {!Promise.<T>} asyncProcess
86
- * @return {!Promise.<T>}
85
+ * @param {!Promise<T>} asyncProcess
86
+ * @return {!Promise<T>}
87
87
  * @template T
88
88
  */
89
89
  static promiseWithTimeout(seconds, asyncProcess) {
@@ -320,7 +320,7 @@ shaka.util.Id3Utils = class {
320
320
  /**
321
321
  * Returns an array of ID3 frames found in all the ID3 tags in the id3Data
322
322
  * @param {Uint8Array} id3Data - The ID3 data containing one or more ID3 tags
323
- * @return {!Array.<shaka.extern.MetadataFrame>}
323
+ * @return {!Array<shaka.extern.MetadataFrame>}
324
324
  * @export
325
325
  */
326
326
  static getID3Frames(id3Data) {
@@ -14,9 +14,9 @@ goog.provide('shaka.util.Iterables');
14
14
  */
15
15
  shaka.util.Iterables = class {
16
16
  /**
17
- * @param {!Iterable.<FROM>} iterable
17
+ * @param {!Iterable<FROM>} iterable
18
18
  * @param {function(FROM):TO} mapping
19
- * @return {!Iterable.<TO>}
19
+ * @return {!Iterable<TO>}
20
20
  * @template FROM,TO
21
21
  */
22
22
  static map(iterable, mapping) {
@@ -28,7 +28,7 @@ shaka.util.Iterables = class {
28
28
  }
29
29
 
30
30
  /**
31
- * @param {!Iterable.<T>} iterable
31
+ * @param {!Iterable<T>} iterable
32
32
  * @param {function(T):boolean} test
33
33
  * @return {boolean}
34
34
  * @template T
@@ -43,7 +43,7 @@ shaka.util.Iterables = class {
43
43
  }
44
44
 
45
45
  /**
46
- * @param {!Iterable.<T>} iterable
46
+ * @param {!Iterable<T>} iterable
47
47
  * @param {function(T):boolean} test
48
48
  * @return {boolean}
49
49
  * @template T
@@ -61,9 +61,9 @@ shaka.util.Iterables = class {
61
61
  * Iterate over an iterable object and return only the items that |filter|
62
62
  * returns true for.
63
63
  *
64
- * @param {!Iterable.<T>} iterable
64
+ * @param {!Iterable<T>} iterable
65
65
  * @param {function(T):boolean} filter
66
- * @return {!Array.<T>}
66
+ * @return {!Array<T>}
67
67
  * @template T
68
68
  */
69
69
  static filter(iterable, filter) {
@@ -76,9 +76,9 @@ shaka.util.LanguageUtils = class {
76
76
 
77
77
  // Get all components. This should only be language and region
78
78
  // since we do not support dialect.
79
- /** @type {!Array.<string>} */
79
+ /** @type {!Array<string>} */
80
80
  const locale1Components = LanguageUtils.disassembleLocale_(locale1);
81
- /** @type {!Array.<string>} */
81
+ /** @type {!Array<string>} */
82
82
  const locale2Components = LanguageUtils.disassembleLocale_(locale2);
83
83
 
84
84
  // We are language compatible if we have the same language.
@@ -117,10 +117,10 @@ shaka.util.LanguageUtils = class {
117
117
 
118
118
  // Get all components. This should only be language and region
119
119
  // since we do not support dialect.
120
- /** @type {!Array.<string>} */
120
+ /** @type {!Array<string>} */
121
121
  const possibleParentComponents =
122
122
  LanguageUtils.disassembleLocale_(possibleParent);
123
- /** @type {!Array.<string>} */
123
+ /** @type {!Array<string>} */
124
124
  const possibleChildComponents =
125
125
  LanguageUtils.disassembleLocale_(possibleChild);
126
126
 
@@ -162,9 +162,9 @@ shaka.util.LanguageUtils = class {
162
162
 
163
163
  // Get all components. This should only be language and region
164
164
  // since we do not support dialect.
165
- /** @type {!Array.<string>} */
165
+ /** @type {!Array<string>} */
166
166
  const localeAComponents = LanguageUtils.disassembleLocale_(localeA);
167
- /** @type {!Array.<string>} */
167
+ /** @type {!Array<string>} */
168
168
  const localeBComponents = LanguageUtils.disassembleLocale_(localeB);
169
169
 
170
170
  return localeAComponents.length == 2 &&
@@ -191,15 +191,15 @@ shaka.util.LanguageUtils = class {
191
191
  static normalize(locale) {
192
192
  const LanguageUtils = shaka.util.LanguageUtils;
193
193
 
194
- const privateusePrefix = 'x-';
195
- const [languageRegion = '', privateuseSuffix = ''] =
196
- locale.split(`-${privateusePrefix}`);
194
+ const privateUsePrefix = 'x-';
195
+ const [languageRegion = '', privateUseSuffix = ''] =
196
+ locale.split(`-${privateUsePrefix}`);
197
197
  const [languageCode = '', regionCode = ''] = languageRegion.split('-');
198
198
 
199
- // We are only going to use the language, the region and the "privateuse" part (as per https://datatracker.ietf.org/doc/html/rfc5646).
199
+ // We are only going to use the language, the region and the private use part (as per https://datatracker.ietf.org/doc/html/rfc5646).
200
200
  // Anything else is thrown away.
201
- const privateuse = privateuseSuffix ?
202
- `${privateusePrefix}${privateuseSuffix}` : '';
201
+ const privateUse = privateUseSuffix ?
202
+ `${privateUsePrefix}${privateUseSuffix}` : '';
203
203
 
204
204
  // Convert the language to lower case. It is standard for the language code
205
205
  // to be in lower case, but it will also make the map look-up easier.
@@ -212,7 +212,7 @@ shaka.util.LanguageUtils = class {
212
212
  const region = regionCode.toUpperCase();
213
213
 
214
214
  return `${region ? `${language}-${region}` : language}${
215
- privateuse ? `-${privateuse}` : ''}`;
215
+ privateUse ? `-${privateUse}` : ''}`;
216
216
  }
217
217
 
218
218
  /**
@@ -367,7 +367,7 @@ shaka.util.LanguageUtils = class {
367
367
  * locale is found to be close to |target|, then |null| will be returned.
368
368
  *
369
369
  * @param {string} target
370
- * @param {!Iterable.<string>} searchSpace
370
+ * @param {!Iterable<string>} searchSpace
371
371
  * @return {?string}
372
372
  * @export
373
373
  */
@@ -376,7 +376,7 @@ shaka.util.LanguageUtils = class {
376
376
 
377
377
  /** @type {string} */
378
378
  const safeTarget = LanguageUtils.normalize(target);
379
- /** @type {!Set.<string>} */
379
+ /** @type {!Set<string>} */
380
380
  const safeSearchSpace = new Set();
381
381
  for (const option of searchSpace) {
382
382
  safeSearchSpace.add(LanguageUtils.normalize(option));
@@ -428,7 +428,7 @@ shaka.util.LanguageUtils = class {
428
428
  * should ONLY be used to verify locales that have been normalized.
429
429
  *
430
430
  * @param {string} locale
431
- * @return {!Array.<string>}
431
+ * @return {!Array<string>}
432
432
  * @private
433
433
  */
434
434
  static disassembleLocale_(locale) {
@@ -451,7 +451,7 @@ shaka.util.LanguageUtils = class {
451
451
  * A map from 3-letter language codes (ISO 639-2) to 2-letter language codes
452
452
  * (ISO 639-1) for all languages which have both in the registry.
453
453
  *
454
- * @const {!Map.<string, string>}
454
+ * @const {!Map<string, string>}
455
455
  * @private
456
456
  */
457
457
  shaka.util.LanguageUtils.isoMap_ = new Map([
@@ -24,10 +24,10 @@ shaka.util.ManifestParserUtils = class {
24
24
  * Note: This method is slow in SmartTVs and Consoles. It should only be
25
25
  * called when necessary.
26
26
  *
27
- * @param {!Array.<string>} baseUris
28
- * @param {!Array.<string>} relativeUris
27
+ * @param {!Array<string>} baseUris
28
+ * @param {!Array<string>} relativeUris
29
29
  * @param {string=} extraQueryParams
30
- * @return {!Array.<string>}
30
+ * @return {!Array<string>}
31
31
  */
32
32
  static resolveUris(baseUris, relativeUris, extraQueryParams = '') {
33
33
  if (relativeUris.length == 0) {
@@ -69,7 +69,7 @@ shaka.util.ManifestParserUtils = class {
69
69
  *
70
70
  * @param {string} keySystem
71
71
  * @param {string} encryptionScheme
72
- * @param {Array.<shaka.extern.InitDataOverride>} initData
72
+ * @param {Array<shaka.extern.InitDataOverride>} initData
73
73
  * @param {string} [keySystemUri]
74
74
  * @return {shaka.extern.DrmInfo}
75
75
  */
@@ -99,7 +99,7 @@ shaka.util.ManifestParserUtils = class {
99
99
  /**
100
100
  * Creates a DrmInfo object from ClearKeys.
101
101
  *
102
- * @param {!Map.<string, string>} clearKeys
102
+ * @param {!Map<string, string>} clearKeys
103
103
  * @param {string=} encryptionScheme
104
104
  * @return {shaka.extern.DrmInfo}
105
105
  */
@@ -166,7 +166,7 @@ shaka.util.ManifestParserUtils = class {
166
166
  * Assumes that at least one codec is correct, and throws if none are.
167
167
  *
168
168
  * @param {string} contentType
169
- * @param {!Array.<string>} codecs
169
+ * @param {!Array<string>} codecs
170
170
  * @return {string}
171
171
  */
172
172
  static guessCodecs(contentType, codecs) {
@@ -197,7 +197,7 @@ shaka.util.ManifestParserUtils = class {
197
197
  * not throw if it fails to match.
198
198
  *
199
199
  * @param {string} contentType
200
- * @param {!Array.<string>} codecs
200
+ * @param {!Array<string>} codecs
201
201
  * @return {?string} or null if no match is found
202
202
  */
203
203
  static guessCodecsSafe(contentType, codecs) {
@@ -225,8 +225,8 @@ shaka.util.ManifestParserUtils = class {
225
225
  * content.
226
226
  *
227
227
  * @param {string} contentType
228
- * @param {!Array.<string>} codecs
229
- * @return {!Array.<string>}
228
+ * @param {!Array<string>} codecs
229
+ * @return {!Array<string>}
230
230
  */
231
231
  static guessAllCodecsSafe(contentType, codecs) {
232
232
  const allCodecs = [];
@@ -280,7 +280,7 @@ shaka.util.ManifestParserUtils.GAP_OVERLAP_TOLERANCE_SECONDS = 1 / 15;
280
280
  /**
281
281
  * A list of regexps to detect well-known video codecs.
282
282
  *
283
- * @const {!Array.<!RegExp>}
283
+ * @const {!Array<!RegExp>}
284
284
  * @private
285
285
  */
286
286
  shaka.util.ManifestParserUtils.VIDEO_CODEC_REGEXPS_ = [
@@ -300,7 +300,7 @@ shaka.util.ManifestParserUtils.VIDEO_CODEC_REGEXPS_ = [
300
300
  /**
301
301
  * A list of regexps to detect well-known audio codecs.
302
302
  *
303
- * @const {!Array.<!RegExp>}
303
+ * @const {!Array<!RegExp>}
304
304
  * @private
305
305
  */
306
306
  shaka.util.ManifestParserUtils.AUDIO_CODEC_REGEXPS_ = [
@@ -321,7 +321,7 @@ shaka.util.ManifestParserUtils.AUDIO_CODEC_REGEXPS_ = [
321
321
  /**
322
322
  * A list of regexps to detect well-known text codecs.
323
323
  *
324
- * @const {!Array.<!RegExp>}
324
+ * @const {!Array<!RegExp>}
325
325
  * @private
326
326
  */
327
327
  shaka.util.ManifestParserUtils.TEXT_CODEC_REGEXPS_ = [
@@ -332,7 +332,7 @@ shaka.util.ManifestParserUtils.TEXT_CODEC_REGEXPS_ = [
332
332
 
333
333
 
334
334
  /**
335
- * @const {!Object.<string, !Array.<!RegExp>>}
335
+ * @const {!Object<string, !Array<!RegExp>>}
336
336
  */
337
337
  shaka.util.ManifestParserUtils.CODEC_REGEXPS_BY_CONTENT_TYPE_ = {
338
338
  'audio': shaka.util.ManifestParserUtils.AUDIO_CODEC_REGEXPS_,
@@ -12,8 +12,8 @@ goog.provide('shaka.util.MapUtils');
12
12
  */
13
13
  shaka.util.MapUtils = class {
14
14
  /**
15
- * @param {!Object.<KEY, VALUE>} object
16
- * @return {!Map.<KEY, VALUE>}
15
+ * @param {!Object<KEY, VALUE>} object
16
+ * @return {!Map<KEY, VALUE>}
17
17
  * @template KEY,VALUE
18
18
  */
19
19
  static asMap(object) {
@@ -27,8 +27,8 @@ shaka.util.MapUtils = class {
27
27
 
28
28
 
29
29
  /**
30
- * @param {!Map.<KEY, VALUE>} map
31
- * @return {!Object.<KEY, VALUE>}
30
+ * @param {!Map<KEY, VALUE>} map
31
+ * @return {!Object<KEY, VALUE>}
32
32
  * @template KEY,VALUE
33
33
  */
34
34
  static asObject(map) {
@@ -44,8 +44,8 @@ shaka.util.MapUtils = class {
44
44
  * NOTE: This only works for simple value types and
45
45
  * will not be accurate if map values are objects!
46
46
  *
47
- * @param {Map.<KEY, VALUE>} map1
48
- * @param {Map.<KEY, VALUE>} map2
47
+ * @param {Map<KEY, VALUE>} map1
48
+ * @param {Map<KEY, VALUE>} map2
49
49
  * @return {boolean}
50
50
  * @template KEY,VALUE
51
51
  */
@@ -31,7 +31,7 @@ shaka.util.MediaReadyState = class {
31
31
  };
32
32
 
33
33
  /**
34
- * @const {!shaka.util.Lazy.<!Map.<number, string>>}
34
+ * @const {!shaka.util.Lazy.<!Map<number, string>>}
35
35
  * @private
36
36
  */
37
37
  shaka.util.MediaReadyState.READY_STATES_TO_EVENT_NAMES_ =
@@ -125,7 +125,7 @@ shaka.util.MimeUtils = class {
125
125
  /**
126
126
  * Split a list of codecs encoded in a string into a list of codecs.
127
127
  * @param {string} codecs
128
- * @return {!Array.<string>}
128
+ * @return {!Array<string>}
129
129
  */
130
130
  static splitCodecs(codecs) {
131
131
  return codecs.split(',');
@@ -254,11 +254,22 @@ shaka.util.MimeUtils = class {
254
254
  mimeType === 'application/vnd.apple.mpegurl';
255
255
  }
256
256
 
257
+ /**
258
+ * Checks if the given MIME type is DASH MIME type.
259
+ *
260
+ * @param {string} mimeType
261
+ * @return {boolean}
262
+ */
263
+ static isDashType(mimeType) {
264
+ return mimeType === 'application/dash+xml' ||
265
+ mimeType === 'video/vnd.mpeg.dash.mpd';
266
+ }
267
+
257
268
  /**
258
269
  * Get the base and profile of a codec string. Where [0] will be the codec
259
270
  * base and [1] will be the profile.
260
271
  * @param {string} codecString
261
- * @return {!Array.<string>}
272
+ * @return {!Array<string>}
262
273
  * @private
263
274
  */
264
275
  static getCodecParts_(codecString) {
@@ -281,7 +292,7 @@ shaka.util.MimeUtils = class {
281
292
  *
282
293
  * This initial set of parameters are all recognized by Chromecast.
283
294
  *
284
- * @const {!Map.<string, string>}
295
+ * @const {!Map<string, string>}
285
296
  * @private
286
297
  */
287
298
  shaka.util.MimeUtils.EXTENDED_MIME_PARAMETERS_ = new Map()
@@ -308,7 +319,7 @@ shaka.util.MimeUtils.CEA708_CLOSED_CAPTION_MIMETYPE = 'application/cea-708';
308
319
  /**
309
320
  * MIME types of raw formats.
310
321
  *
311
- * @const {!Array.<string>}
322
+ * @const {!Array<string>}
312
323
  */
313
324
  shaka.util.MimeUtils.RAW_FORMATS = [
314
325
  'audio/aac',
@@ -313,7 +313,7 @@ shaka.util.Mp4BoxParsers = class {
313
313
  reader.skip(2); // Skip "data_reference_index"
314
314
  reader.skip(8); // Skip "reserved"
315
315
  const channelCount = reader.readUint16();
316
- reader.skip(2); // Skip "samplesize"
316
+ reader.skip(2); // Skip "sample_size"
317
317
  reader.skip(2); // Skip "pre_defined"
318
318
  reader.skip(2); // Skip "reserved"
319
319
  const sampleRate = reader.readUint16() + (reader.readUint16() / 65536);
@@ -818,13 +818,13 @@ shaka.util.ParsedTREXBox;
818
818
  /**
819
819
  * @typedef {{
820
820
  * sampleCount: number,
821
- * sampleData: !Array.<shaka.util.ParsedTRUNSample>,
821
+ * sampleData: !Array<shaka.util.ParsedTRUNSample>,
822
822
  * dataOffset: ?number
823
823
  * }}
824
824
  *
825
825
  * @property {number} sampleCount
826
826
  * As per the spec: the number of samples being added in this run;
827
- * @property {!Array.<shaka.util.ParsedTRUNSample>} sampleData
827
+ * @property {!Array<shaka.util.ParsedTRUNSample>} sampleData
828
828
  * An array of size <sampleCount> containing data for each sample
829
829
  * @property {?number} dataOffset
830
830
  * If specified via flags, this indicate the offset of the sample in bytes.
@@ -847,7 +847,7 @@ shaka.util.ParsedTRUNBox;
847
847
  * @property {?number} sampleCompositionTimeOffset
848
848
  * The time since the start of the sample in timescale units. Time
849
849
  * offset is based of the start of the sample. If this value is
850
- * missing, the accumulated durations preceeding this time sample will
850
+ * missing, the accumulated durations preceding this time sample will
851
851
  * be used to create the start time.
852
852
  *
853
853
  * @exportDoc
@@ -1022,7 +1022,7 @@ shaka.util.ParsedHDLRBox;
1022
1022
  * Possible values:
1023
1023
  * - Rectangular: ‘rect’
1024
1024
  * - Half equirectangular: ‘hequ’
1025
- * - Equirectanguler: ?
1025
+ * - Equirectangular: ?
1026
1026
  * - Fisheye: ‘fish’
1027
1027
  *
1028
1028
  * @exportDoc
@@ -13,12 +13,12 @@ goog.require('shaka.util.Uint8ArrayUtils');
13
13
 
14
14
  shaka.util.Mp4Generator = class {
15
15
  /**
16
- * @param {!Array.<shaka.util.Mp4Generator.StreamInfo>} streamInfos
16
+ * @param {!Array<shaka.util.Mp4Generator.StreamInfo>} streamInfos
17
17
  */
18
18
  constructor(streamInfos) {
19
19
  shaka.util.Mp4Generator.initStaticProperties_();
20
20
 
21
- /** @private {!Array.<shaka.util.Mp4Generator.StreamInfo>} */
21
+ /** @private {!Array<shaka.util.Mp4Generator.StreamInfo>} */
22
22
  this.streamInfos_ = streamInfos;
23
23
  }
24
24
 
@@ -355,8 +355,8 @@ shaka.util.Mp4Generator = class {
355
355
  0x00, 0x00, 0x00, 0x00, // pre_defined
356
356
  ...this.breakNumberIntoBytes_(width, 2), // width
357
357
  ...this.breakNumberIntoBytes_(height, 2), // height
358
- 0x00, 0x48, 0x00, 0x00, // horizresolution
359
- 0x00, 0x48, 0x00, 0x00, // vertresolution
358
+ 0x00, 0x48, 0x00, 0x00, // horizontal resolution
359
+ 0x00, 0x48, 0x00, 0x00, // vertical resolution
360
360
  0x00, 0x00, 0x00, 0x00, // reserved
361
361
  0x00, 0x01, // frame_count
362
362
  0x13,
@@ -367,7 +367,7 @@ shaka.util.Mp4Generator = class {
367
367
  0x68, 0x6c, 0x73, 0x00,
368
368
  0x00, 0x00, 0x00, 0x00,
369
369
  0x00, 0x00, 0x00, 0x00,
370
- 0x00, 0x00, 0x00, // compressorname
370
+ 0x00, 0x00, 0x00, // compressor name
371
371
  0x00, 0x18, // depth = 24
372
372
  0x11, 0x11, // pre_defined = -1
373
373
  ]);
@@ -390,8 +390,8 @@ shaka.util.Mp4Generator = class {
390
390
  * @private
391
391
  */
392
392
  avcC_(streamInfo) {
393
- const NALUTYPE_SPS = 7;
394
- const NALUTYPE_PPS = 8;
393
+ const NALU_TYPE_SPS = 7;
394
+ const NALU_TYPE_PPS = 8;
395
395
 
396
396
  // length = 7 by default (0 SPS and 0 PPS)
397
397
  let avcCLength = 7;
@@ -406,12 +406,12 @@ shaka.util.Mp4Generator = class {
406
406
  const naluBytes = this.hexStringToBuffer_(streamInfo.videoNalus[i]);
407
407
  const naluType = naluBytes[0] & 0x1F;
408
408
  switch (naluType) {
409
- case NALUTYPE_SPS:
409
+ case NALU_TYPE_SPS:
410
410
  sps.push(naluBytes);
411
411
  // 2 = sequenceParameterSetLength field length
412
412
  avcCLength += naluBytes.length + 2;
413
413
  break;
414
- case NALUTYPE_PPS:
414
+ case NALU_TYPE_PPS:
415
415
  pps.push(naluBytes);
416
416
  // 2 = pictureParameterSetLength field length
417
417
  avcCLength += naluBytes.length + 2;
@@ -485,8 +485,8 @@ shaka.util.Mp4Generator = class {
485
485
  0x00, 0x00, 0x00, 0x00, // pre_defined
486
486
  ...this.breakNumberIntoBytes_(width, 2), // width
487
487
  ...this.breakNumberIntoBytes_(height, 2), // height
488
- 0x00, 0x48, 0x00, 0x00, // horizresolution
489
- 0x00, 0x48, 0x00, 0x00, // vertresolution
488
+ 0x00, 0x48, 0x00, 0x00, // horizontal resolution
489
+ 0x00, 0x48, 0x00, 0x00, // vertical resolution
490
490
  0x00, 0x00, 0x00, 0x00, // reserved
491
491
  0x00, 0x01, // frame_count
492
492
  0x13,
@@ -497,7 +497,7 @@ shaka.util.Mp4Generator = class {
497
497
  0x68, 0x6c, 0x73, 0x00,
498
498
  0x00, 0x00, 0x00, 0x00,
499
499
  0x00, 0x00, 0x00, 0x00,
500
- 0x00, 0x00, 0x00, // compressorname
500
+ 0x00, 0x00, 0x00, // compressor name
501
501
  0x00, 0x18, // depth = 24
502
502
  0x11, 0x11, // pre_defined = -1
503
503
  ]);
@@ -550,7 +550,7 @@ shaka.util.Mp4Generator = class {
550
550
  0x00, 0x00, 0x00, 0x00,
551
551
  0x00, 0x00, 0x00, 0x00, // reserved
552
552
  0x00,
553
- channelsCount, // channelcount
553
+ channelsCount, // channel count
554
554
  0x00, 0x10, // sampleSize:16bits
555
555
  0x00, 0x00, 0x00, 0x00, // reserved2
556
556
  ...this.breakNumberIntoBytes_(audioSamplingRate, 2), // Sample Rate
@@ -706,13 +706,13 @@ shaka.util.Mp4Generator = class {
706
706
  0x00, 0x00, 0x00, // flags
707
707
 
708
708
  // ES_Descriptor
709
- 0x03, // tag, ES_DescrTag
709
+ 0x03, // tag, ES_DescriptionTag
710
710
  0x19, // length
711
711
  ...this.breakNumberIntoBytes_(id, 2), // ES_ID
712
712
  0x00, // streamDependenceFlag, URL_flag, reserved, streamPriority
713
713
 
714
714
  // DecoderConfigDescriptor
715
- 0x04, // tag, DecoderConfigDescrTag
715
+ 0x04, // tag, DecoderConfigDescriptionTag
716
716
  0x11, // length
717
717
  0x40, // object type
718
718
  0x15, // streamType
@@ -1041,9 +1041,9 @@ shaka.util.Mp4Generator = class {
1041
1041
 
1042
1042
  const samples = streamInfo.data ? streamInfo.data.samples : [];
1043
1043
  const samplesLength = samples.length;
1044
- const byteslen = 12 + 16 * samplesLength;
1045
- const bytes = new Uint8Array(byteslen);
1046
- offset += 8 + byteslen;
1044
+ const bytesLen = 12 + 16 * samplesLength;
1045
+ const bytes = new Uint8Array(bytesLen);
1046
+ offset += 8 + bytesLen;
1047
1047
  const isVideo = streamInfo.type === ContentType.VIDEO;
1048
1048
  bytes.set(
1049
1049
  [
@@ -1081,6 +1081,7 @@ shaka.util.Mp4Generator = class {
1081
1081
  /**
1082
1082
  * Generate a MDAT box
1083
1083
  *
1084
+ * @param {shaka.util.Mp4Generator.StreamInfo} streamInfo
1084
1085
  * @return {!Uint8Array}
1085
1086
  * @private
1086
1087
  */
@@ -1096,7 +1097,7 @@ shaka.util.Mp4Generator = class {
1096
1097
  /**
1097
1098
  * @param {number} number
1098
1099
  * @param {number} numBytes
1099
- * @return {!Array.<number>}
1100
+ * @return {!Array<number>}
1100
1101
  * @private
1101
1102
  */
1102
1103
  breakNumberIntoBytes_(number, numBytes) {
@@ -1142,11 +1143,11 @@ shaka.util.Mp4Generator = class {
1142
1143
  */
1143
1144
  static initStaticProperties_() {
1144
1145
  const Mp4Generator = shaka.util.Mp4Generator;
1145
- if (Mp4Generator.initializated_) {
1146
+ if (Mp4Generator.initialized_) {
1146
1147
  return;
1147
1148
  }
1148
1149
 
1149
- Mp4Generator.initializated_ = true;
1150
+ Mp4Generator.initialized_ = true;
1150
1151
 
1151
1152
  const majorBrand = new Uint8Array([105, 115, 111, 109]); // isom
1152
1153
  const avc1Brand = new Uint8Array([97, 118, 99, 49]); // avc1
@@ -1202,7 +1203,7 @@ shaka.util.Mp4Generator = class {
1202
1203
  /**
1203
1204
  * @private {boolean}
1204
1205
  */
1205
- shaka.util.Mp4Generator.initializated_ = false;
1206
+ shaka.util.Mp4Generator.initialized_ = false;
1206
1207
 
1207
1208
 
1208
1209
  /**
@@ -1211,7 +1212,7 @@ shaka.util.Mp4Generator.initializated_ = false;
1211
1212
  shaka.util.Mp4Generator.UINT32_MAX_ = Math.pow(2, 32) - 1;
1212
1213
 
1213
1214
  /**
1214
- * @private {!Object.<string, !Array.<number>>}
1215
+ * @private {!Object<string, !Array<number>>}
1215
1216
  */
1216
1217
  shaka.util.Mp4Generator.BOX_TYPES_ = {};
1217
1218
 
@@ -1288,10 +1289,10 @@ shaka.util.Mp4Generator.STSZ_ = new Uint8Array([
1288
1289
  shaka.util.Mp4Generator.VMHD_ = new Uint8Array([
1289
1290
  0x00, // version
1290
1291
  0x00, 0x00, 0x01, // flags
1291
- 0x00, 0x00, // graphicsmode
1292
+ 0x00, 0x00, // graphics mode
1292
1293
  0x00, 0x00,
1293
1294
  0x00, 0x00,
1294
- 0x00, 0x00, // opcolor
1295
+ 0x00, 0x00, // op color
1295
1296
  ]);
1296
1297
 
1297
1298
  /**
@@ -1344,7 +1345,7 @@ shaka.util.Mp4Generator.DINF_ = new Uint8Array([]);
1344
1345
  * encrypted: boolean,
1345
1346
  * timescale: number,
1346
1347
  * duration: number,
1347
- * videoNalus: !Array.<string>,
1348
+ * videoNalus: !Array<string>,
1348
1349
  * audioConfig: !Uint8Array,
1349
1350
  * videoConfig: !Uint8Array,
1350
1351
  * hSpacing: number,
@@ -1367,7 +1368,7 @@ shaka.util.Mp4Generator.DINF_ = new Uint8Array([]);
1367
1368
  * The Stream's timescale.
1368
1369
  * @property {number} duration
1369
1370
  * The Stream's duration.
1370
- * @property {!Array.<string>} videoNalus
1371
+ * @property {!Array<string>} videoNalus
1371
1372
  * The stream's video nalus.
1372
1373
  * @property {!Uint8Array} audioConfig
1373
1374
  * The stream's audio config.
@@ -1376,7 +1377,7 @@ shaka.util.Mp4Generator.DINF_ = new Uint8Array([]);
1376
1377
  * @property {number} hSpacing
1377
1378
  * The stream's video horizontal spacing of pixels.
1378
1379
  * @property {number} vSpacing
1379
- * The stream's video vertial spacing of pixels.
1380
+ * The stream's video vertical spacing of pixels.
1380
1381
  * @property {?shaka.util.Mp4Generator.Data} data
1381
1382
  * The stream's data.
1382
1383
  * @property {!shaka.extern.Stream} stream
@@ -1388,14 +1389,14 @@ shaka.util.Mp4Generator.StreamInfo;
1388
1389
  * @typedef {{
1389
1390
  * sequenceNumber: number,
1390
1391
  * baseMediaDecodeTime: number,
1391
- * samples: !Array.<shaka.util.Mp4Generator.Mp4Sample>
1392
+ * samples: !Array<shaka.util.Mp4Generator.Mp4Sample>
1392
1393
  * }}
1393
1394
  *
1394
1395
  * @property {number} sequenceNumber
1395
1396
  * The sequence number.
1396
1397
  * @property {number} baseMediaDecodeTime
1397
1398
  * The base media decode time.
1398
- * @property {!Array.<shaka.util.Mp4Generator.Mp4Sample>} samples
1399
+ * @property {!Array<shaka.util.Mp4Generator.Mp4Sample>} samples
1399
1400
  * The data samples.
1400
1401
  */
1401
1402
  shaka.util.Mp4Generator.Data;
@@ -17,10 +17,10 @@ goog.require('shaka.util.DataViewReader');
17
17
  shaka.util.Mp4Parser = class {
18
18
  /** */
19
19
  constructor() {
20
- /** @private {!Object.<number, shaka.util.Mp4Parser.BoxType_>} */
20
+ /** @private {!Object<number, shaka.util.Mp4Parser.BoxType_>} */
21
21
  this.headers_ = [];
22
22
 
23
- /** @private {!Object.<number, !shaka.util.Mp4Parser.CallbackType>} */
23
+ /** @private {!Object<number, !shaka.util.Mp4Parser.CallbackType>} */
24
24
  this.boxDefinitions_ = [];
25
25
 
26
26
  /** @private {boolean} */