shaka-player 4.3.11 → 4.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (315) hide show
  1. package/AUTHORS +9 -0
  2. package/CHANGELOG.md +303 -202
  3. package/CONTRIBUTORS +8 -0
  4. package/LICENSE +32 -0
  5. package/README.md +63 -10
  6. package/demo/autoTemplate.txt +40 -5
  7. package/demo/close_button.js +11 -0
  8. package/demo/common/asset.js +13 -1
  9. package/demo/common/assets.js +53 -3
  10. package/demo/common/message_ids.js +25 -1
  11. package/demo/config.js +69 -10
  12. package/demo/customWarning.txt +2 -2
  13. package/demo/index.html +3 -1
  14. package/demo/locales/en.json +26 -2
  15. package/demo/locales/source.json +105 -9
  16. package/demo/main.js +52 -9
  17. package/demo/search.js +3 -1
  18. package/demo/service_worker.js +3 -0
  19. package/dist/controls.css +1 -1
  20. package/dist/controls.css.map +1 -1
  21. package/dist/demo.compiled.debug.js +124 -112
  22. package/dist/demo.compiled.debug.map +3 -3
  23. package/dist/demo.compiled.js +124 -112
  24. package/dist/demo.compiled.map +3 -3
  25. package/dist/deps.js +46 -28
  26. package/dist/locales.js +33 -33
  27. package/dist/receiver.compiled.debug.js +52 -46
  28. package/dist/receiver.compiled.debug.map +3 -3
  29. package/dist/receiver.compiled.js +52 -46
  30. package/dist/receiver.compiled.map +3 -3
  31. package/dist/shaka-player.compiled.d.ts +676 -391
  32. package/dist/shaka-player.compiled.debug.d.ts +676 -391
  33. package/dist/shaka-player.compiled.debug.externs.js +1188 -616
  34. package/dist/shaka-player.compiled.debug.js +1043 -699
  35. package/dist/shaka-player.compiled.debug.map +4 -4
  36. package/dist/shaka-player.compiled.externs.js +1188 -616
  37. package/dist/shaka-player.compiled.js +1091 -929
  38. package/dist/shaka-player.compiled.map +4 -4
  39. package/dist/shaka-player.ui.d.ts +677 -392
  40. package/dist/shaka-player.ui.debug.d.ts +677 -392
  41. package/dist/shaka-player.ui.debug.externs.js +1023 -451
  42. package/dist/shaka-player.ui.debug.js +1098 -737
  43. package/dist/shaka-player.ui.debug.map +4 -4
  44. package/dist/shaka-player.ui.externs.js +1023 -451
  45. package/dist/shaka-player.ui.js +1246 -1071
  46. package/dist/shaka-player.ui.map +4 -4
  47. package/docs/tutorials/ad_monetization.md +15 -1
  48. package/docs/tutorials/application-level-redirects.md +1 -1
  49. package/docs/tutorials/config.md +9 -5
  50. package/docs/tutorials/drm-config.md +61 -0
  51. package/docs/tutorials/fairplay.md +19 -4
  52. package/docs/tutorials/license-server-auth.md +4 -4
  53. package/docs/tutorials/license-wrapping.md +2 -2
  54. package/docs/tutorials/ui-customization.md +7 -3
  55. package/docs/tutorials/ui.md +7 -7
  56. package/docs/tutorials/upgrade.md +3 -0
  57. package/externs/ima.js +123 -2
  58. package/externs/isoboxer.js +217 -0
  59. package/externs/mediakeys.js +18 -0
  60. package/externs/mux.js +1 -105
  61. package/externs/pictureinpicture.js +48 -0
  62. package/externs/shaka/ads.js +61 -1
  63. package/externs/shaka/cea.js +110 -0
  64. package/externs/shaka/codecs.js +32 -0
  65. package/externs/shaka/manifest.js +101 -1
  66. package/externs/shaka/manifest_parser.js +0 -10
  67. package/externs/shaka/net.js +36 -7
  68. package/externs/shaka/offline.js +8 -1
  69. package/externs/shaka/player.js +220 -21
  70. package/externs/shaka/text.js +1 -382
  71. package/externs/shaka/transmuxer.js +60 -0
  72. package/karma.conf.js +13 -0
  73. package/lib/abr/simple_abr_manager.js +6 -3
  74. package/lib/ads/ad_manager.js +60 -2
  75. package/lib/ads/client_side_ad.js +86 -0
  76. package/lib/ads/client_side_ad_manager.js +79 -3
  77. package/lib/ads/server_side_ad.js +86 -0
  78. package/lib/ads/server_side_ad_manager.js +13 -0
  79. package/lib/cast/cast_utils.js +1 -0
  80. package/lib/cea/cea608_data_channel.js +24 -14
  81. package/lib/cea/cea608_memory.js +5 -2
  82. package/lib/cea/cea708_service.js +8 -9
  83. package/lib/cea/cea708_window.js +1 -2
  84. package/lib/cea/cea_decoder.js +23 -6
  85. package/lib/cea/cea_utils.js +25 -2
  86. package/lib/cea/dummy_caption_decoder.js +21 -0
  87. package/lib/cea/dummy_cea_parser.js +1 -3
  88. package/lib/cea/mp4_cea_parser.js +15 -10
  89. package/lib/cea/ts_cea_parser.js +69 -0
  90. package/lib/dash/content_protection.js +32 -2
  91. package/lib/dash/dash_parser.js +93 -31
  92. package/lib/dash/mpd_utils.js +6 -25
  93. package/lib/dash/segment_base.js +12 -14
  94. package/lib/dash/segment_list.js +10 -6
  95. package/lib/dash/segment_template.js +349 -32
  96. package/lib/dependencies/all.js +8 -0
  97. package/lib/hls/hls_classes.js +33 -8
  98. package/lib/hls/hls_parser.js +805 -191
  99. package/lib/hls/manifest_text_parser.js +4 -14
  100. package/lib/media/adaptation_set_criteria.js +43 -3
  101. package/lib/media/closed_caption_parser.js +74 -12
  102. package/lib/media/drm_engine.js +189 -49
  103. package/lib/media/gap_jumping_controller.js +1 -1
  104. package/lib/media/manifest_parser.js +34 -0
  105. package/lib/media/media_source_capabilities.js +10 -0
  106. package/lib/media/media_source_engine.js +495 -231
  107. package/lib/media/playhead.js +1 -1
  108. package/lib/media/presentation_timeline.js +62 -0
  109. package/lib/media/segment_index.js +50 -14
  110. package/lib/media/segment_prefetch.js +277 -0
  111. package/lib/media/segment_reference.js +70 -4
  112. package/lib/media/streaming_engine.js +258 -81
  113. package/lib/media/video_wrapper.js +15 -7
  114. package/lib/mss/content_protection.js +353 -0
  115. package/lib/mss/mss_parser.js +1082 -0
  116. package/lib/net/networking_engine.js +60 -10
  117. package/lib/offline/indexeddb/v1_storage_cell.js +1 -0
  118. package/lib/offline/indexeddb/v2_storage_cell.js +1 -0
  119. package/lib/offline/manifest_converter.js +6 -0
  120. package/lib/offline/storage.js +2 -4
  121. package/lib/player.js +309 -105
  122. package/lib/polyfill/media_capabilities.js +43 -3
  123. package/lib/polyfill/patchedmediakeys_apple.js +5 -0
  124. package/lib/polyfill/patchedmediakeys_nop.js +5 -0
  125. package/lib/polyfill/patchedmediakeys_webkit.js +5 -0
  126. package/lib/text/cue.js +208 -130
  127. package/lib/text/lrc_text_parser.js +2 -2
  128. package/lib/text/mp4_vtt_parser.js +2 -2
  129. package/lib/text/sbv_text_parser.js +1 -1
  130. package/lib/text/simple_text_displayer.js +1 -1
  131. package/lib/text/srt_text_parser.js +9 -1
  132. package/lib/text/ssa_text_parser.js +2 -2
  133. package/lib/text/text_engine.js +3 -21
  134. package/lib/text/text_utils.js +71 -20
  135. package/lib/text/ui_text_displayer.js +14 -14
  136. package/lib/text/vtt_text_parser.js +22 -14
  137. package/lib/transmuxer/aac_transmuxer.js +224 -0
  138. package/lib/transmuxer/ac3.js +142 -0
  139. package/lib/transmuxer/ac3_transmuxer.js +213 -0
  140. package/lib/transmuxer/adts.js +232 -0
  141. package/lib/transmuxer/ec3.js +103 -0
  142. package/lib/transmuxer/ec3_transmuxer.js +213 -0
  143. package/lib/transmuxer/h264.js +324 -0
  144. package/lib/transmuxer/mp3_transmuxer.js +205 -0
  145. package/lib/transmuxer/mpeg_audio.js +196 -0
  146. package/lib/transmuxer/mpeg_ts_transmuxer.js +182 -0
  147. package/lib/transmuxer/mss_transmuxer.js +389 -0
  148. package/lib/{media/transmuxer.js → transmuxer/muxjs_transmuxer.js} +34 -80
  149. package/lib/transmuxer/transmuxer_engine.js +161 -0
  150. package/lib/transmuxer/ts_transmuxer.js +721 -0
  151. package/lib/util/cmcd_manager.js +131 -71
  152. package/lib/util/error.js +62 -26
  153. package/lib/util/exp_golomb.js +220 -0
  154. package/lib/util/fairplay_utils.js +64 -13
  155. package/lib/util/id3_utils.js +56 -3
  156. package/lib/util/language_utils.js +11 -8
  157. package/lib/util/manifest_parser_utils.js +3 -0
  158. package/lib/util/mime_utils.js +44 -7
  159. package/lib/util/mp4_box_parsers.js +233 -5
  160. package/lib/util/mp4_generator.js +1388 -0
  161. package/lib/util/periods.js +40 -34
  162. package/lib/util/platform.js +17 -3
  163. package/lib/util/player_configuration.js +38 -1
  164. package/lib/util/stream_utils.js +138 -27
  165. package/lib/util/text_parser.js +1 -1
  166. package/lib/util/ts_parser.js +460 -74
  167. package/lib/util/xml_utils.js +16 -3
  168. package/maintained-branches.md +2 -2
  169. package/package.json +3 -1
  170. package/roadmap.md +21 -6
  171. package/shaka-player.uncompiled.js +18 -0
  172. package/test/abr/simple_abr_manager_unit.js +32 -4
  173. package/test/ads/ad_manager_unit.js +18 -2
  174. package/test/cast/cast_utils_unit.js +7 -2
  175. package/test/cea/cea608_memory_unit.js +24 -0
  176. package/test/cea/cea_decoder_unit.js +33 -0
  177. package/test/dash/dash_parser_content_protection_unit.js +93 -3
  178. package/test/dash/dash_parser_live_unit.js +56 -13
  179. package/test/dash/dash_parser_manifest_unit.js +70 -2
  180. package/test/dash/dash_parser_segment_base_unit.js +14 -9
  181. package/test/dash/dash_parser_segment_template_unit.js +286 -6
  182. package/test/demo/demo_unit.js +5 -1
  183. package/test/hls/hls_live_unit.js +188 -28
  184. package/test/hls/hls_parser_unit.js +250 -109
  185. package/test/hls/manifest_text_parser_unit.js +18 -13
  186. package/test/media/adaptation_set_criteria_unit.js +46 -14
  187. package/test/media/adaptation_set_unit.js +2 -0
  188. package/test/media/drm_engine_integration.js +11 -8
  189. package/test/media/drm_engine_unit.js +220 -7
  190. package/test/media/media_source_engine_integration.js +124 -40
  191. package/test/media/media_source_engine_unit.js +133 -153
  192. package/test/media/playhead_unit.js +3 -0
  193. package/test/media/presentation_timeline_unit.js +51 -0
  194. package/test/media/segment_index_unit.js +52 -0
  195. package/test/media/segment_prefetch_unit.js +243 -0
  196. package/test/media/streaming_engine_integration.js +9 -3
  197. package/test/media/streaming_engine_unit.js +440 -59
  198. package/test/mss/mss_parser_content_protection_unit.js +49 -0
  199. package/test/mss/mss_parser_unit.js +472 -0
  200. package/test/mss/mss_player_integration.js +123 -0
  201. package/test/offline/manifest_convert_unit.js +9 -0
  202. package/test/offline/storage_integration.js +6 -1
  203. package/test/player_unit.js +386 -133
  204. package/test/polyfill/media_capabilities_unit.js +18 -0
  205. package/test/test/assets/hls-raw-aac/fileSequence0.aac +0 -0
  206. package/test/test/assets/hls-raw-aac/fileSequence1.aac +0 -0
  207. package/test/test/assets/hls-raw-aac/fileSequence2.aac +0 -0
  208. package/test/test/assets/hls-raw-aac/fileSequence3.aac +0 -0
  209. package/test/test/assets/hls-raw-aac/manifest.m3u8 +4 -0
  210. package/test/test/assets/hls-raw-aac/stream.m4a.m3u8 +14 -0
  211. package/test/test/assets/hls-raw-ac3/fileSequence0.ac3 +0 -0
  212. package/test/test/assets/hls-raw-ac3/fileSequence1.ac3 +0 -0
  213. package/test/test/assets/hls-raw-ac3/fileSequence2.ac3 +0 -0
  214. package/test/test/assets/hls-raw-ac3/fileSequence3.ac3 +0 -0
  215. package/test/test/assets/hls-raw-ac3/fileSequence4.ac3 +0 -0
  216. package/test/test/assets/hls-raw-ac3/fileSequence5.ac3 +0 -0
  217. package/test/test/assets/hls-raw-ac3/fileSequence6.ac3 +0 -0
  218. package/test/test/assets/hls-raw-ac3/fileSequence7.ac3 +0 -0
  219. package/test/test/assets/hls-raw-ac3/prog_index.m3u8 +31 -0
  220. package/test/test/assets/hls-raw-ec3/fileSequence0.ec3 +0 -0
  221. package/test/test/assets/hls-raw-ec3/fileSequence1.ec3 +0 -0
  222. package/test/test/assets/hls-raw-ec3/fileSequence2.ec3 +0 -0
  223. package/test/test/assets/hls-raw-ec3/fileSequence3.ec3 +0 -0
  224. package/test/test/assets/hls-raw-ec3/fileSequence4.ec3 +0 -0
  225. package/test/test/assets/hls-raw-ec3/fileSequence5.ec3 +0 -0
  226. package/test/test/assets/hls-raw-ec3/fileSequence6.ec3 +0 -0
  227. package/test/test/assets/hls-raw-ec3/fileSequence7.ec3 +0 -0
  228. package/test/test/assets/hls-raw-ec3/prog_index.m3u8 +31 -0
  229. package/test/test/assets/hls-raw-mp3/chunklist_w905519204.m3u8 +13 -0
  230. package/test/test/assets/hls-raw-mp3/media_w905519204_0.mp3 +0 -0
  231. package/test/test/assets/hls-raw-mp3/media_w905519204_1.mp3 +0 -0
  232. package/test/test/assets/hls-raw-mp3/media_w905519204_2.mp3 +0 -0
  233. package/test/test/assets/hls-raw-mp3/media_w905519204_3.mp3 +0 -0
  234. package/test/test/assets/hls-raw-mp3/playlist.m3u8 +4 -0
  235. package/test/test/assets/hls-ts-aac/playlist.m3u8 +23 -0
  236. package/test/test/assets/hls-ts-aac/segment_0.ts +0 -0
  237. package/test/test/assets/hls-ts-aac/segment_1.ts +0 -0
  238. package/test/test/assets/hls-ts-aac/segment_2.ts +0 -0
  239. package/test/test/assets/hls-ts-aac/segment_3.ts +0 -0
  240. package/test/test/assets/hls-ts-aac/segment_4.ts +0 -0
  241. package/test/test/assets/hls-ts-aac/segment_5.ts +0 -0
  242. package/test/test/assets/hls-ts-aac/segment_6.ts +0 -0
  243. package/test/test/assets/hls-ts-aac/segment_7.ts +0 -0
  244. package/test/test/assets/hls-ts-ac3/ChID_voices_6ch_640kbps_dd_sub_0000.ts +0 -0
  245. package/test/test/assets/hls-ts-ac3/ChID_voices_6ch_640kbps_dd_sub_0001.ts +0 -0
  246. package/test/test/assets/hls-ts-ac3/ChID_voices_6ch_640kbps_dd_sub_0002.ts +0 -0
  247. package/test/test/assets/hls-ts-ac3/ChID_voices_6ch_640kbps_dd_sub_0003.ts +0 -0
  248. package/test/test/assets/hls-ts-ac3/ChID_voices_6ch_640kbps_dd_sub_0004.ts +0 -0
  249. package/test/test/assets/hls-ts-ac3/ChID_voices_6ch_640kbps_dd_sub_0005.ts +0 -0
  250. package/test/test/assets/hls-ts-ac3/prog_index.m3u8 +19 -0
  251. package/test/test/assets/hls-ts-ec3/ChID_voices_6ch_256kbps_ddp_sub_0000.ts +0 -0
  252. package/test/test/assets/hls-ts-ec3/ChID_voices_6ch_256kbps_ddp_sub_0001.ts +0 -0
  253. package/test/test/assets/hls-ts-ec3/ChID_voices_6ch_256kbps_ddp_sub_0002.ts +0 -0
  254. package/test/test/assets/hls-ts-ec3/ChID_voices_6ch_256kbps_ddp_sub_0003.ts +0 -0
  255. package/test/test/assets/hls-ts-ec3/ChID_voices_6ch_256kbps_ddp_sub_0004.ts +0 -0
  256. package/test/test/assets/hls-ts-ec3/ChID_voices_6ch_256kbps_ddp_sub_0005.ts +0 -0
  257. package/test/test/assets/hls-ts-ec3/prog_index.m3u8 +19 -0
  258. package/test/test/assets/hls-ts-h264/fileSequence0.ts +0 -0
  259. package/test/test/assets/hls-ts-h264/fileSequence1.ts +0 -0
  260. package/test/test/assets/hls-ts-h264/fileSequence2.ts +0 -0
  261. package/test/test/assets/hls-ts-h264/fileSequence3.ts +0 -0
  262. package/test/test/assets/hls-ts-h264/fileSequence4.ts +0 -0
  263. package/test/test/assets/hls-ts-h264/fileSequence5.ts +0 -0
  264. package/test/test/assets/hls-ts-h264/prog_index.m3u8 +25 -0
  265. package/test/test/assets/hls-ts-mp3/manifest.m3u8 +13 -0
  266. package/test/test/assets/hls-ts-mp3/media_w239891843_0.ts +0 -0
  267. package/test/test/assets/hls-ts-mp3/media_w239891843_1.ts +0 -0
  268. package/test/test/assets/hls-ts-mp3/media_w239891843_2.ts +0 -0
  269. package/test/test/assets/hls-ts-mp3/media_w239891843_3.ts +0 -0
  270. package/test/test/assets/hls-ts-muxed-aac-h264/chunk.m3u8 +17 -0
  271. package/test/test/assets/hls-ts-muxed-aac-h264/n_0_0_0.ts +0 -0
  272. package/test/test/assets/hls-ts-muxed-aac-h264/n_1_0_0.ts +0 -0
  273. package/test/test/assets/hls-ts-muxed-aac-h264/n_2_0_0.ts +0 -0
  274. package/test/test/assets/hls-ts-muxed-aac-h264/n_3_0_0.ts +0 -0
  275. package/test/test/assets/hls-ts-muxed-aac-h264/n_4_0_0.ts +0 -0
  276. package/test/test/assets/hls-ts-muxed-aac-h264/n_5_0_0.ts +0 -0
  277. package/test/test/assets/hls-ts-muxed-aac-h264/playlist.m3u8 +4 -0
  278. package/test/test/boot.js +7 -2
  279. package/test/test/util/fake_ad.js +99 -0
  280. package/test/test/util/fake_ad_manager.js +7 -1
  281. package/test/test/util/fake_networking_engine.js +41 -14
  282. package/test/test/util/fake_segment_prefetch.js +81 -0
  283. package/test/test/util/manifest_generator.js +19 -5
  284. package/test/test/util/mss_parser_util.js +115 -0
  285. package/test/test/util/offline_utils.js +1 -0
  286. package/test/test/util/simple_fakes.js +12 -3
  287. package/test/test/util/streaming_engine_util.js +14 -4
  288. package/test/test/util/ttml_utils.js +2 -2
  289. package/test/text/cue_integration.js +1 -1
  290. package/test/text/srt_text_parser_unit.js +78 -0
  291. package/test/text/text_engine_unit.js +17 -8
  292. package/test/text/ui_text_displayer_unit.js +4 -4
  293. package/test/text/vtt_text_parser_unit.js +59 -40
  294. package/test/text/web_vtt_generator_unit.js +9 -3
  295. package/test/{media/transmuxer_integration.js → transmuxer/muxjs_transmuxer_integration.js} +30 -33
  296. package/test/transmuxer/transmuxer_engine_integration.js +60 -0
  297. package/test/transmuxer/transmuxer_integration.js +296 -0
  298. package/test/util/cmcd_manager_unit.js +162 -13
  299. package/test/util/language_utils_unit.js +9 -2
  300. package/test/util/mp4_box_parsers_unit.js +39 -4
  301. package/test/util/periods_unit.js +34 -26
  302. package/test/util/stream_utils_unit.js +60 -107
  303. package/ui/controls.js +19 -1
  304. package/ui/controls.less +1 -0
  305. package/ui/externs/ui.js +11 -1
  306. package/ui/language_utils.js +15 -0
  307. package/ui/less/thumbnails.less +26 -0
  308. package/ui/locales/oc.json +42 -0
  309. package/ui/pip_button.js +83 -2
  310. package/ui/range_element.js +15 -0
  311. package/ui/resolution_selection.js +9 -2
  312. package/ui/seek_bar.js +223 -0
  313. package/ui/ui.js +5 -0
  314. package/lib/cea/i_caption_decoder.js +0 -51
  315. package/lib/cea/i_cea_parser.js +0 -68
@@ -7,7 +7,6 @@
7
7
  goog.provide('shaka.cea.CeaUtils');
8
8
  goog.provide('shaka.cea.CeaUtils.StyledChar');
9
9
 
10
- goog.require('shaka.cea.ICaptionDecoder');
11
10
  goog.require('shaka.text.Cue');
12
11
 
13
12
 
@@ -19,7 +18,7 @@ shaka.cea.CeaUtils = class {
19
18
  * @param {!Array<!Array<?shaka.cea.CeaUtils.StyledChar>>} memory
20
19
  * @param {number} startTime Start time of the cue.
21
20
  * @param {number} endTime End time of the cue.
22
- * @return {?shaka.cea.ICaptionDecoder.ClosedCaption}
21
+ * @return {?shaka.extern.ICaptionDecoder.ClosedCaption}
23
22
  */
24
23
  static getParsedCaption(topLevelCue, stream, memory, startTime, endTime) {
25
24
  if (startTime >= endTime) {
@@ -270,3 +269,27 @@ shaka.cea.CeaUtils.DEFAULT_BG_COLOR = 'black';
270
269
  * @const {string}
271
270
  */
272
271
  shaka.cea.CeaUtils.DEFAULT_TXT_COLOR = 'white';
272
+
273
+ /**
274
+ * NALU type for Supplemental Enhancement Information (SEI) for H.264.
275
+ * @const {number}
276
+ */
277
+ shaka.cea.CeaUtils.H264_NALU_TYPE_SEI = 0x06;
278
+
279
+ /**
280
+ * NALU type for Supplemental Enhancement Information (SEI) for H.265.
281
+ * @const {number}
282
+ */
283
+ shaka.cea.CeaUtils.H265_PREFIX_NALU_TYPE_SEI = 0x27;
284
+
285
+ /**
286
+ * NALU type for Supplemental Enhancement Information (SEI) for H.265.
287
+ * @const {number}
288
+ */
289
+ shaka.cea.CeaUtils.H265_SUFFIX_NALU_TYPE_SEI = 0x28;
290
+
291
+ /**
292
+ * Default timescale value for a track.
293
+ * @const {number}
294
+ */
295
+ shaka.cea.CeaUtils.DEFAULT_TIMESCALE_VALUE = 90000;
@@ -0,0 +1,21 @@
1
+ /*! @license
2
+ * Shaka Player
3
+ * Copyright 2016 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+
7
+ goog.provide('shaka.cea.DummyCaptionDecoder');
8
+
9
+ /** @implements {shaka.extern.ICaptionDecoder} */
10
+ shaka.cea.DummyCaptionDecoder = class {
11
+ /** @override */
12
+ extract(userDataSeiMessage, pts) {}
13
+
14
+ /** @override */
15
+ decode() {
16
+ return [];
17
+ }
18
+
19
+ /** @override */
20
+ clear() {}
21
+ };
@@ -6,11 +6,9 @@
6
6
 
7
7
  goog.provide('shaka.cea.DummyCeaParser');
8
8
 
9
- goog.require('shaka.cea.ICeaParser');
10
-
11
9
  /**
12
10
  * Dummy CEA parser.
13
- * @implements {shaka.cea.ICeaParser}
11
+ * @implements {shaka.extern.ICeaParser}
14
12
  */
15
13
  shaka.cea.DummyCeaParser = class {
16
14
  /**
@@ -7,9 +7,10 @@
7
7
  goog.provide('shaka.cea.Mp4CeaParser');
8
8
 
9
9
  goog.require('goog.asserts');
10
- goog.require('shaka.cea.ICeaParser');
10
+ goog.require('shaka.cea.CeaUtils');
11
11
  goog.require('shaka.cea.SeiProcessor');
12
12
  goog.require('shaka.log');
13
+ goog.require('shaka.media.ClosedCaptionParser');
13
14
  goog.require('shaka.util.DataViewReader');
14
15
  goog.require('shaka.util.Error');
15
16
  goog.require('shaka.util.Mp4Parser');
@@ -17,7 +18,8 @@ goog.require('shaka.util.Mp4BoxParsers');
17
18
 
18
19
  /**
19
20
  * MPEG4 stream parser used for extracting 708 closed captions data.
20
- * @implements {shaka.cea.ICeaParser}
21
+ * @implements {shaka.extern.ICeaParser}
22
+ * @export
21
23
  */
22
24
  shaka.cea.Mp4CeaParser = class {
23
25
  /** */
@@ -157,7 +159,7 @@ shaka.cea.Mp4CeaParser = class {
157
159
  return [];
158
160
  }
159
161
 
160
- /** @type {!Array<!shaka.cea.ICeaParser.CaptionPacket>} **/
162
+ /** @type {!Array<!shaka.extern.ICeaParser.CaptionPacket>} **/
161
163
  const captionPackets = [];
162
164
 
163
165
  // Fields that are found in MOOF boxes
@@ -167,7 +169,7 @@ shaka.cea.Mp4CeaParser = class {
167
169
  /** @type {!Array<shaka.util.ParsedTRUNBox>} */
168
170
  let parsedTRUNs = [];
169
171
  let baseMediaDecodeTime = null;
170
- let timescale = shaka.cea.ICeaParser.DEFAULT_TIMESCALE_VALUE;
172
+ let timescale = shaka.cea.CeaUtils.DEFAULT_TIMESCALE_VALUE;
171
173
 
172
174
  new Mp4Parser()
173
175
  .box('moof', (box) => {
@@ -214,7 +216,7 @@ shaka.cea.Mp4CeaParser = class {
214
216
  box.version != null,
215
217
  'TFDT is a full box and should have a valid version.');
216
218
 
217
- const parsedTFDT = shaka.util.Mp4BoxParsers.parseTFDT(
219
+ const parsedTFDT = shaka.util.Mp4BoxParsers.parseTFDTInaccurate(
218
220
  box.reader, box.version);
219
221
 
220
222
  baseMediaDecodeTime = parsedTFDT.baseMediaDecodeTime;
@@ -250,13 +252,13 @@ shaka.cea.Mp4CeaParser = class {
250
252
  * @param {number} defaultSampleSize
251
253
  * @param {number} offset
252
254
  * @param {!Array<shaka.util.ParsedTRUNBox>} parsedTRUNs
253
- * @param {!Array<!shaka.cea.ICeaParser.CaptionPacket>} captionPackets
255
+ * @param {!Array<!shaka.extern.ICeaParser.CaptionPacket>} captionPackets
254
256
  * @private
255
257
  */
256
258
  parseMdat_(reader, time, timescale, defaultSampleDuration,
257
259
  defaultSampleSize, offset, parsedTRUNs, captionPackets) {
258
260
  const BitstreamFormat = shaka.cea.Mp4CeaParser.BitstreamFormat;
259
- const ICeaParser = shaka.cea.ICeaParser;
261
+ const CeaUtils = shaka.cea.CeaUtils;
260
262
  let sampleIndex = 0;
261
263
 
262
264
  // The fields in each ParsedTRUNSample contained in the sampleData
@@ -288,7 +290,7 @@ shaka.cea.Mp4CeaParser = class {
288
290
  switch (this.bitstreamFormat_) {
289
291
  case BitstreamFormat.H264:
290
292
  naluType = naluHeader & 0x1f;
291
- isSeiMessage = naluType == ICeaParser.H264_NALU_TYPE_SEI;
293
+ isSeiMessage = naluType == CeaUtils.H264_NALU_TYPE_SEI;
292
294
  break;
293
295
 
294
296
  case BitstreamFormat.H265:
@@ -296,8 +298,8 @@ shaka.cea.Mp4CeaParser = class {
296
298
  reader.skip(1);
297
299
  naluType = (naluHeader >> 1) & 0x3f;
298
300
  isSeiMessage =
299
- naluType == ICeaParser.H265_PREFIX_NALU_TYPE_SEI ||
300
- naluType == ICeaParser.H265_SUFFIX_NALU_TYPE_SEI;
301
+ naluType == CeaUtils.H265_PREFIX_NALU_TYPE_SEI ||
302
+ naluType == CeaUtils.H265_SUFFIX_NALU_TYPE_SEI;
301
303
  break;
302
304
 
303
305
  default:
@@ -376,3 +378,6 @@ shaka.cea.Mp4CeaParser.CodecBitstreamMap_ = {
376
378
  'dvh1': shaka.cea.Mp4CeaParser.BitstreamFormat.H265,
377
379
  'dvhe': shaka.cea.Mp4CeaParser.BitstreamFormat.H265,
378
380
  };
381
+
382
+ shaka.media.ClosedCaptionParser.registerParser('video/mp4',
383
+ () => new shaka.cea.Mp4CeaParser());
@@ -0,0 +1,69 @@
1
+ /*! @license
2
+ * Shaka Player
3
+ * Copyright 2016 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+
7
+ goog.provide('shaka.cea.TsCeaParser');
8
+
9
+ goog.require('shaka.cea.CeaUtils');
10
+ goog.require('shaka.cea.SeiProcessor');
11
+ goog.require('shaka.media.ClosedCaptionParser');
12
+ goog.require('shaka.util.BufferUtils');
13
+ goog.require('shaka.util.TsParser');
14
+
15
+ /**
16
+ * MPEG TS CEA parser.
17
+ * @implements {shaka.extern.ICeaParser}
18
+ * @export
19
+ */
20
+ shaka.cea.TsCeaParser = class {
21
+ /** */
22
+ constructor() {
23
+ /**
24
+ * SEI data processor.
25
+ * @private
26
+ * @const {!shaka.cea.SeiProcessor}
27
+ */
28
+ this.seiProcessor_ = new shaka.cea.SeiProcessor();
29
+ }
30
+
31
+ /**
32
+ * @override
33
+ */
34
+ init(initSegment) {
35
+ // TS hasn't init segment
36
+ }
37
+
38
+ /**
39
+ * @override
40
+ */
41
+ parse(mediaSegment) {
42
+ const CeaUtils = shaka.cea.CeaUtils;
43
+
44
+ /** @type {!Array<!shaka.extern.ICeaParser.CaptionPacket>} **/
45
+ const captionPackets = [];
46
+
47
+ const uint8ArrayData = shaka.util.BufferUtils.toUint8(mediaSegment);
48
+ if (!shaka.util.TsParser.probe(uint8ArrayData)) {
49
+ return captionPackets;
50
+ }
51
+ const tsParser = new shaka.util.TsParser().parse(uint8ArrayData);
52
+ const videoNalus = tsParser.getVideoNalus();
53
+ for (const nalu of videoNalus) {
54
+ if (nalu.type == CeaUtils.H264_NALU_TYPE_SEI &&
55
+ nalu.time != null) {
56
+ for (const packet of this.seiProcessor_.process(nalu.data)) {
57
+ captionPackets.push({
58
+ packet: packet,
59
+ pts: nalu.time,
60
+ });
61
+ }
62
+ }
63
+ }
64
+ return captionPackets;
65
+ }
66
+ };
67
+
68
+ shaka.media.ClosedCaptionParser.registerParser('video/mp2t',
69
+ () => new shaka.cea.TsCeaParser());
@@ -166,12 +166,19 @@ shaka.dash.ContentProtection = class {
166
166
 
167
167
  /**
168
168
  * Gets a Widevine license URL from a content protection element
169
- * containing a custom `ms:laurl` element
169
+ * containing a custom `ms:laurl` or 'dashif:Laurl' elements
170
170
  *
171
171
  * @param {shaka.dash.ContentProtection.Element} element
172
172
  * @return {string}
173
173
  */
174
174
  static getWidevineLicenseUrl(element) {
175
+ const dashIfLaurlNode = shaka.util.XmlUtils.findChildNS(
176
+ element.node, shaka.dash.ContentProtection.DashIfNamespaceUri_,
177
+ 'Laurl',
178
+ );
179
+ if (dashIfLaurlNode && dashIfLaurlNode.textContent) {
180
+ return dashIfLaurlNode.textContent;
181
+ }
175
182
  const mslaurlNode = shaka.util.XmlUtils.findChildNS(
176
183
  element.node, 'urn:microsoft', 'laurl');
177
184
  if (mslaurlNode) {
@@ -182,12 +189,19 @@ shaka.dash.ContentProtection = class {
182
189
 
183
190
  /**
184
191
  * Gets a ClearKey license URL from a content protection element
185
- * containing a custom `clearkey::Laurl` element
192
+ * containing a custom `clearkey::Laurl` or 'dashif:Laurl' elements
186
193
  *
187
194
  * @param {shaka.dash.ContentProtection.Element} element
188
195
  * @return {string}
189
196
  */
190
197
  static getClearKeyLicenseUrl(element) {
198
+ const dashIfLaurlNode = shaka.util.XmlUtils.findChildNS(
199
+ element.node, shaka.dash.ContentProtection.DashIfNamespaceUri_,
200
+ 'Laurl',
201
+ );
202
+ if (dashIfLaurlNode && dashIfLaurlNode.textContent) {
203
+ return dashIfLaurlNode.textContent;
204
+ }
191
205
  const clearKeyLaurlNode = shaka.util.XmlUtils.findChildNS(
192
206
  element.node, shaka.dash.ContentProtection.ClearKeyNamespaceUri_,
193
207
  'Laurl',
@@ -307,6 +321,14 @@ shaka.dash.ContentProtection = class {
307
321
  * @return {string}
308
322
  */
309
323
  static getPlayReadyLicenseUrl(element) {
324
+ const dashIfLaurlNode = shaka.util.XmlUtils.findChildNS(
325
+ element.node, shaka.dash.ContentProtection.DashIfNamespaceUri_,
326
+ 'Laurl',
327
+ );
328
+ if (dashIfLaurlNode && dashIfLaurlNode.textContent) {
329
+ return dashIfLaurlNode.textContent;
330
+ }
331
+
310
332
  const proNode = shaka.util.XmlUtils.findChildNS(
311
333
  element.node, 'urn:microsoft:playready', 'pro');
312
334
 
@@ -657,3 +679,11 @@ shaka.dash.ContentProtection.ClearKeyNamespaceUri_ =
657
679
  */
658
680
  shaka.dash.ContentProtection.ClearKeySchemeUri_ =
659
681
  'urn:uuid:e2719d58-a985-b3c9-781a-b030af78d30e';
682
+
683
+
684
+ /**
685
+ * @const {string}
686
+ * @private
687
+ */
688
+ shaka.dash.ContentProtection.DashIfNamespaceUri_ =
689
+ 'https://dashif.org/CPS';
@@ -19,7 +19,6 @@ goog.require('shaka.media.PresentationTimeline');
19
19
  goog.require('shaka.media.SegmentIndex');
20
20
  goog.require('shaka.net.NetworkingEngine');
21
21
  goog.require('shaka.text.TextEngine');
22
- goog.require('shaka.util.CmcdManager');
23
22
  goog.require('shaka.util.Error');
24
23
  goog.require('shaka.util.Functional');
25
24
  goog.require('shaka.util.LanguageUtils');
@@ -222,15 +221,12 @@ shaka.dash.DashParser = class {
222
221
  */
223
222
  async requestManifest_() {
224
223
  const requestType = shaka.net.NetworkingEngine.RequestType.MANIFEST;
224
+ const type = shaka.net.NetworkingEngine.AdvancedRequestType.MPD;
225
225
  const request = shaka.net.NetworkingEngine.makeRequest(
226
226
  this.manifestUris_, this.config_.retryParameters);
227
227
  const networkingEngine = this.playerInterface_.networkingEngine;
228
-
229
- const format = shaka.util.CmcdManager.StreamingFormat.DASH;
230
- this.playerInterface_.modifyManifestRequest(request, {format: format});
231
-
232
228
  const startTime = Date.now();
233
- const operation = networkingEngine.request(requestType, request);
229
+ const operation = networkingEngine.request(requestType, request, {type});
234
230
  this.operationManager_.manage(operation);
235
231
 
236
232
  const response = await operation.promise;
@@ -489,6 +485,18 @@ shaka.dash.DashParser = class {
489
485
 
490
486
  await this.periodCombiner_.combinePeriods(periods, context.dynamic);
491
487
 
488
+ // Set minBufferTime to 0 for low-latency DASH live stream to achieve the
489
+ // best latency
490
+ if (this.lowLatencyMode_) {
491
+ minBufferTime = 0;
492
+ }
493
+
494
+ // Set updatePeriod_ to minTotalAvailabilityTimeOffset_ to achieve the best
495
+ // latency in LL streams
496
+ if (this.lowLatencyMode_ && this.minTotalAvailabilityTimeOffset_) {
497
+ this.updatePeriod_ = this.minTotalAvailabilityTimeOffset_;
498
+ }
499
+
492
500
  // These steps are not done on manifest update.
493
501
  if (!this.manifest_) {
494
502
  this.manifest_ = {
@@ -499,6 +507,9 @@ shaka.dash.DashParser = class {
499
507
  offlineSessionIds: [],
500
508
  minBufferTime: minBufferTime || 0,
501
509
  sequenceMode: this.config_.dash.sequenceMode,
510
+ ignoreManifestTimestampsInSegmentsMode: false,
511
+ type: shaka.media.ManifestParser.DASH,
512
+ serviceDescription: this.parseServiceDescription_(mpd),
502
513
  };
503
514
 
504
515
  // We only need to do clock sync when we're using presentation start
@@ -537,6 +548,39 @@ shaka.dash.DashParser = class {
537
548
  this.playerInterface_.makeTextStreamsForClosedCaptions(this.manifest_);
538
549
  }
539
550
 
551
+ /**
552
+ * Reads maxLatency and maxPlaybackRate properties from service
553
+ * description element.
554
+ *
555
+ * @param {!Element} mpd
556
+ * @return {?shaka.extern.ServiceDescription}
557
+ * @private
558
+ */
559
+ parseServiceDescription_(mpd) {
560
+ const XmlUtils = shaka.util.XmlUtils;
561
+ const elem = XmlUtils.findChild(mpd, 'ServiceDescription');
562
+
563
+ if (!elem ) {
564
+ return null;
565
+ }
566
+
567
+ const latencyNode = XmlUtils.findChild(elem, 'Latency');
568
+ const playbackRateNode = XmlUtils.findChild(elem, 'PlaybackRate');
569
+
570
+ if ((latencyNode && latencyNode.getAttribute('max')) || playbackRateNode) {
571
+ const maxLatency = latencyNode && latencyNode.getAttribute('max') ?
572
+ parseInt(latencyNode.getAttribute('max'), 10) / 1000 :
573
+ null;
574
+ const maxPlaybackRate = playbackRateNode ?
575
+ parseFloat(playbackRateNode.getAttribute('max')) :
576
+ null;
577
+
578
+ return {maxLatency, maxPlaybackRate};
579
+ }
580
+
581
+ return null;
582
+ }
583
+
540
584
  /**
541
585
  * Reads and parses the periods from the manifest. This first does some
542
586
  * partial parsing so the start and duration is available when parsing
@@ -546,7 +590,7 @@ shaka.dash.DashParser = class {
546
590
  * @param {!Array.<string>} baseUris
547
591
  * @param {!Element} mpd
548
592
  * @return {{
549
- * periods: !Array.<shaka.util.PeriodCombiner.Period>,
593
+ * periods: !Array.<shaka.extern.Period>,
550
594
  * duration: ?number,
551
595
  * durationDerivedFromPeriods: boolean
552
596
  * }}
@@ -698,7 +742,7 @@ shaka.dash.DashParser = class {
698
742
  * @param {shaka.dash.DashParser.Context} context
699
743
  * @param {!Array.<string>} baseUris
700
744
  * @param {shaka.dash.DashParser.PeriodInfo} periodInfo
701
- * @return {shaka.util.PeriodCombiner.Period}
745
+ * @return {shaka.extern.Period}
702
746
  * @private
703
747
  */
704
748
  parsePeriod_(context, baseUris, periodInfo) {
@@ -950,6 +994,8 @@ shaka.dash.DashParser = class {
950
994
  const accessibilities = XmlUtils.findChildren(elem, 'Accessibility');
951
995
  const LanguageUtils = shaka.util.LanguageUtils;
952
996
  const closedCaptions = new Map();
997
+ /** @type {?shaka.media.ManifestParser.AccessibilityPurpose} */
998
+ let accessibilityPurpose;
953
999
  for (const prop of accessibilities) {
954
1000
  const schemeId = prop.getAttribute('schemeIdUri');
955
1001
  const value = prop.getAttribute('value');
@@ -1032,6 +1078,15 @@ shaka.dash.DashParser = class {
1032
1078
  kind = ManifestParserUtils.TextStreamKind.CLOSED_CAPTION;
1033
1079
  }
1034
1080
  }
1081
+ } else if (schemeId == 'urn:tva:metadata:cs:AudioPurposeCS:2007') {
1082
+ // See DASH DVB Document A168 Rev.6 Table 5.
1083
+ if (value == '1') {
1084
+ accessibilityPurpose =
1085
+ shaka.media.ManifestParser.AccessibilityPurpose.VISUALLY_IMPAIRED;
1086
+ } else if (value == '2') {
1087
+ accessibilityPurpose =
1088
+ shaka.media.ManifestParser.AccessibilityPurpose.HARD_OF_HEARING;
1089
+ }
1035
1090
  }
1036
1091
  }
1037
1092
 
@@ -1053,8 +1108,8 @@ shaka.dash.DashParser = class {
1053
1108
  this.config_.dash.ignoreDrmInfo,
1054
1109
  this.config_.dash.keySystemsByURI);
1055
1110
 
1056
- const language =
1057
- shaka.util.LanguageUtils.normalize(elem.getAttribute('lang') || 'und');
1111
+ const language = shaka.util.LanguageUtils.normalize(
1112
+ context.adaptationSet.language || 'und');
1058
1113
 
1059
1114
  // This attribute is currently non-standard, but it is supported by Kaltura.
1060
1115
  let label = elem.getAttribute('label');
@@ -1074,7 +1129,7 @@ shaka.dash.DashParser = class {
1074
1129
  const streams = representations.map((representation) => {
1075
1130
  const parsedRepresentation = this.parseRepresentation_(context,
1076
1131
  contentProtection, kind, language, label, main, roleValues,
1077
- closedCaptions, representation);
1132
+ closedCaptions, representation, accessibilityPurpose);
1078
1133
  if (parsedRepresentation) {
1079
1134
  parsedRepresentation.hdr = parsedRepresentation.hdr || videoRange;
1080
1135
  }
@@ -1150,12 +1205,15 @@ shaka.dash.DashParser = class {
1150
1205
  * @param {!Array.<string>} roles
1151
1206
  * @param {Map.<string, string>} closedCaptions
1152
1207
  * @param {!Element} node
1208
+ * @param {?shaka.media.ManifestParser.AccessibilityPurpose}
1209
+ * accessibilityPurpose
1210
+ *
1153
1211
  * @return {?shaka.extern.Stream} The Stream, or null when there is a
1154
1212
  * non-critical parsing error.
1155
1213
  * @private
1156
1214
  */
1157
1215
  parseRepresentation_(context, contentProtection, kind, language, label,
1158
- isPrimary, roles, closedCaptions, node) {
1216
+ isPrimary, roles, closedCaptions, node, accessibilityPurpose) {
1159
1217
  const XmlUtils = shaka.util.XmlUtils;
1160
1218
  const ContentType = shaka.util.ManifestParserUtils.ContentType;
1161
1219
 
@@ -1189,12 +1247,12 @@ shaka.dash.DashParser = class {
1189
1247
  const isImage = contentType == ContentType.IMAGE;
1190
1248
 
1191
1249
  try {
1192
- const requestInitSegment = (uris, startByte, endByte) => {
1193
- return this.requestInitSegment_(uris, startByte, endByte);
1250
+ const requestSegment = (uris, startByte, endByte, isInit) => {
1251
+ return this.requestSegment_(uris, startByte, endByte, isInit);
1194
1252
  };
1195
1253
  if (context.representation.segmentBase) {
1196
1254
  streamInfo = shaka.dash.SegmentBase.createStreamInfo(
1197
- context, requestInitSegment);
1255
+ context, requestSegment);
1198
1256
  } else if (context.representation.segmentList) {
1199
1257
  streamInfo = shaka.dash.SegmentList.createStreamInfo(
1200
1258
  context, this.streamMap_);
@@ -1202,7 +1260,7 @@ shaka.dash.DashParser = class {
1202
1260
  const hasManifest = !!this.manifest_;
1203
1261
 
1204
1262
  streamInfo = shaka.dash.SegmentTemplate.createStreamInfo(
1205
- context, requestInitSegment, this.streamMap_, hasManifest,
1263
+ context, requestSegment, this.streamMap_, hasManifest,
1206
1264
  this.config_.dash.initialSegmentLimit, this.periodDurations_);
1207
1265
  } else {
1208
1266
  goog.asserts.assert(isText,
@@ -1322,6 +1380,7 @@ shaka.dash.DashParser = class {
1322
1380
  drmInfos: contentProtection.drmInfos,
1323
1381
  keyIds,
1324
1382
  language,
1383
+ originalLanguage: context.adaptationSet.language,
1325
1384
  label,
1326
1385
  type: context.adaptationSet.contentType,
1327
1386
  primary: isPrimary,
@@ -1337,6 +1396,7 @@ shaka.dash.DashParser = class {
1337
1396
  hdr,
1338
1397
  tilesLayout,
1339
1398
  matchedStreams: [],
1399
+ accessibilityPurpose,
1340
1400
  external: false,
1341
1401
  };
1342
1402
  }
@@ -1378,6 +1438,10 @@ shaka.dash.DashParser = class {
1378
1438
 
1379
1439
  // Try updating again, but ensure we haven't been destroyed.
1380
1440
  if (this.playerInterface_) {
1441
+ if (this.config_.raiseFatalErrorOnManifestUpdateRequestFailure) {
1442
+ this.playerInterface_.onError(error);
1443
+ return;
1444
+ }
1381
1445
  // We will retry updating, so override the severity of the error.
1382
1446
  error.severity = shaka.util.Error.Severity.RECOVERABLE;
1383
1447
  this.playerInterface_.onError(error);
@@ -1410,7 +1474,6 @@ shaka.dash.DashParser = class {
1410
1474
  }
1411
1475
 
1412
1476
  const finalDelay = Math.max(
1413
- shaka.dash.DashParser.MIN_UPDATE_PERIOD_,
1414
1477
  this.updatePeriod_ - offset,
1415
1478
  this.averageUpdateDuration_.getEstimate());
1416
1479
 
@@ -1508,6 +1571,7 @@ shaka.dash.DashParser = class {
1508
1571
  pixelAspectRatio: pixelAspectRatio,
1509
1572
  emsgSchemeIdUris: emsgSchemeIdUris,
1510
1573
  id: elem.getAttribute('id'),
1574
+ language: elem.getAttribute('lang'),
1511
1575
  numChannels: numChannels,
1512
1576
  audioSamplingRate: audioSamplingRate,
1513
1577
  availabilityTimeOffset: availabilityTimeOffset,
@@ -1846,11 +1910,15 @@ shaka.dash.DashParser = class {
1846
1910
  * @param {!Array.<string>} uris
1847
1911
  * @param {?number} startByte
1848
1912
  * @param {?number} endByte
1913
+ * @param {boolean} isInit
1849
1914
  * @return {!Promise.<BufferSource>}
1850
1915
  * @private
1851
1916
  */
1852
- async requestInitSegment_(uris, startByte, endByte) {
1917
+ async requestSegment_(uris, startByte, endByte, isInit) {
1853
1918
  const requestType = shaka.net.NetworkingEngine.RequestType.SEGMENT;
1919
+ const type = isInit ?
1920
+ shaka.net.NetworkingEngine.AdvancedRequestType.INIT_SEGMENT :
1921
+ shaka.net.NetworkingEngine.AdvancedRequestType.MEDIA_SEGMENT;
1854
1922
 
1855
1923
  const request = shaka.util.Networking.createSegmentRequest(
1856
1924
  uris,
@@ -1859,7 +1927,7 @@ shaka.dash.DashParser = class {
1859
1927
  this.config_.retryParameters);
1860
1928
 
1861
1929
  const networkingEngine = this.playerInterface_.networkingEngine;
1862
- const operation = networkingEngine.request(requestType, request);
1930
+ const operation = networkingEngine.request(requestType, request, {type});
1863
1931
  this.operationManager_.manage(operation);
1864
1932
  const response = await operation.promise;
1865
1933
  return response.data;
@@ -1890,22 +1958,13 @@ shaka.dash.DashParser = class {
1890
1958
  };
1891
1959
 
1892
1960
 
1893
- /**
1894
- * Contains the minimum amount of time, in seconds, between manifest update
1895
- * requests.
1896
- *
1897
- * @private
1898
- * @const {number}
1899
- */
1900
- shaka.dash.DashParser.MIN_UPDATE_PERIOD_ = 3;
1901
-
1902
-
1903
1961
  /**
1904
1962
  * @typedef {
1905
- * function(!Array.<string>, ?number, ?number):!Promise.<BufferSource>
1963
+ * function(!Array.<string>, ?number, ?number, boolean):
1964
+ * !Promise.<BufferSource>
1906
1965
  * }
1907
1966
  */
1908
- shaka.dash.DashParser.RequestInitSegmentCallback;
1967
+ shaka.dash.DashParser.RequestSegmentCallback;
1909
1968
 
1910
1969
 
1911
1970
  /**
@@ -1923,6 +1982,7 @@ shaka.dash.DashParser.RequestInitSegmentCallback;
1923
1982
  * pixelAspectRatio: (string|undefined),
1924
1983
  * emsgSchemeIdUris: !Array.<string>,
1925
1984
  * id: ?string,
1985
+ * language: ?string,
1926
1986
  * numChannels: ?number,
1927
1987
  * audioSamplingRate: ?number,
1928
1988
  * availabilityTimeOffset: number
@@ -1958,6 +2018,8 @@ shaka.dash.DashParser.RequestInitSegmentCallback;
1958
2018
  * emsg registered schemeIdUris.
1959
2019
  * @property {?string} id
1960
2020
  * The ID of the element.
2021
+ * @property {?string} language
2022
+ * The original language of the element.
1961
2023
  * @property {?number} numChannels
1962
2024
  * The number of audio channels, or null if unknown.
1963
2025
  * @property {?number} audioSamplingRate
@@ -15,6 +15,7 @@ goog.require('shaka.util.Functional');
15
15
  goog.require('shaka.util.ManifestParserUtils');
16
16
  goog.require('shaka.util.XmlUtils');
17
17
  goog.requireType('shaka.dash.DashParser');
18
+ goog.requireType('shaka.media.PresentationTimeline');
18
19
 
19
20
 
20
21
  /**
@@ -121,7 +122,7 @@ shaka.dash.MpdUtils = class {
121
122
  * @param {number} unscaledPresentationTimeOffset
122
123
  * @param {number} periodDuration The Period's duration in seconds.
123
124
  * Infinity indicates that the Period continues indefinitely.
124
- * @return {!Array.<shaka.dash.MpdUtils.TimeRange>}
125
+ * @return {!Array.<shaka.media.PresentationTimeline.TimeRange>}
125
126
  */
126
127
  static createTimeline(
127
128
  segmentTimeline, timescale, unscaledPresentationTimeOffset,
@@ -137,7 +138,7 @@ shaka.dash.MpdUtils = class {
137
138
 
138
139
  const timePoints = XmlUtils.findChildren(segmentTimeline, 'S');
139
140
 
140
- /** @type {!Array.<shaka.dash.MpdUtils.TimeRange>} */
141
+ /** @type {!Array.<shaka.media.PresentationTimeline.TimeRange>} */
141
142
  const timeline = [];
142
143
  let lastEndTime = -unscaledPresentationTimeOffset;
143
144
 
@@ -289,7 +290,7 @@ shaka.dash.MpdUtils = class {
289
290
 
290
291
  const timelineNode =
291
292
  MpdUtils.inheritChild(context, callback, 'SegmentTimeline');
292
- /** @type {Array.<shaka.dash.MpdUtils.TimeRange>} */
293
+ /** @type {Array.<shaka.media.PresentationTimeline.TimeRange>} */
293
294
  let timeline = null;
294
295
  if (timelineNode) {
295
296
  timeline = MpdUtils.createTimeline(
@@ -538,26 +539,6 @@ shaka.dash.MpdUtils = class {
538
539
  };
539
540
 
540
541
 
541
- /**
542
- * @typedef {{
543
- * start: number,
544
- * unscaledStart: number,
545
- * end: number
546
- * }}
547
- *
548
- * @description
549
- * Defines a time range of a media segment. Times are in seconds.
550
- *
551
- * @property {number} start
552
- * The start time of the range.
553
- * @property {number} unscaledStart
554
- * The start time of the range in representation timescale units.
555
- * @property {number} end
556
- * The end time (exclusive) of the range.
557
- */
558
- shaka.dash.MpdUtils.TimeRange;
559
-
560
-
561
542
  /**
562
543
  * @typedef {{
563
544
  * timescale: number,
@@ -565,7 +546,7 @@ shaka.dash.MpdUtils.TimeRange;
565
546
  * startNumber: number,
566
547
  * scaledPresentationTimeOffset: number,
567
548
  * unscaledPresentationTimeOffset: number,
568
- * timeline: Array.<shaka.dash.MpdUtils.TimeRange>
549
+ * timeline: Array.<shaka.media.PresentationTimeline.TimeRange>
569
550
  * }}
570
551
  *
571
552
  * @description
@@ -581,7 +562,7 @@ shaka.dash.MpdUtils.TimeRange;
581
562
  * The presentation time offset of the representation, in seconds.
582
563
  * @property {number} unscaledPresentationTimeOffset
583
564
  * The presentation time offset of the representation, in timescale units.
584
- * @property {Array.<shaka.dash.MpdUtils.TimeRange>} timeline
565
+ * @property {Array.<shaka.media.PresentationTimeline.TimeRange>} timeline
585
566
  * The timeline of the representation, if given. Times in seconds.
586
567
  */
587
568
  shaka.dash.MpdUtils.SegmentInfo;