shaka-player 4.3.9 → 4.4.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 (321) hide show
  1. package/.github/workflows/build-and-test.yaml +11 -18
  2. package/.github/workflows/compute-incremental-coverage.py +3 -0
  3. package/.github/workflows/release-please.yaml +7 -0
  4. package/.github/workflows/selenium-lab-tests.yaml +45 -10
  5. package/AUTHORS +9 -0
  6. package/CHANGELOG.md +295 -190
  7. package/CONTRIBUTORS +8 -0
  8. package/LICENSE +32 -0
  9. package/README.md +63 -10
  10. package/demo/autoTemplate.txt +40 -5
  11. package/demo/close_button.js +11 -0
  12. package/demo/common/asset.js +13 -1
  13. package/demo/common/assets.js +112 -28
  14. package/demo/common/message_ids.js +25 -1
  15. package/demo/config.js +69 -10
  16. package/demo/customWarning.txt +2 -2
  17. package/demo/index.html +3 -1
  18. package/demo/locales/en.json +26 -2
  19. package/demo/locales/source.json +105 -9
  20. package/demo/main.js +57 -9
  21. package/demo/search.js +3 -1
  22. package/demo/service_worker.js +3 -0
  23. package/dist/controls.css +1 -1
  24. package/dist/controls.css.map +1 -1
  25. package/dist/demo.compiled.debug.js +132 -118
  26. package/dist/demo.compiled.debug.map +3 -3
  27. package/dist/demo.compiled.js +132 -118
  28. package/dist/demo.compiled.map +3 -3
  29. package/dist/deps.js +46 -28
  30. package/dist/locales.js +31 -31
  31. package/dist/receiver.compiled.debug.js +60 -52
  32. package/dist/receiver.compiled.debug.map +3 -3
  33. package/dist/receiver.compiled.js +60 -52
  34. package/dist/receiver.compiled.map +3 -3
  35. package/dist/shaka-player.compiled.d.ts +676 -391
  36. package/dist/shaka-player.compiled.debug.d.ts +676 -391
  37. package/dist/shaka-player.compiled.debug.externs.js +1188 -616
  38. package/dist/shaka-player.compiled.debug.js +1046 -700
  39. package/dist/shaka-player.compiled.debug.map +4 -4
  40. package/dist/shaka-player.compiled.externs.js +1188 -616
  41. package/dist/shaka-player.compiled.js +1094 -933
  42. package/dist/shaka-player.compiled.map +4 -4
  43. package/dist/shaka-player.ui.d.ts +677 -392
  44. package/dist/shaka-player.ui.debug.d.ts +677 -392
  45. package/dist/shaka-player.ui.debug.externs.js +1023 -451
  46. package/dist/shaka-player.ui.debug.js +1101 -738
  47. package/dist/shaka-player.ui.debug.map +4 -4
  48. package/dist/shaka-player.ui.externs.js +1023 -451
  49. package/dist/shaka-player.ui.js +1244 -1071
  50. package/dist/shaka-player.ui.map +4 -4
  51. package/docs/tutorials/ad_monetization.md +15 -1
  52. package/docs/tutorials/application-level-redirects.md +1 -1
  53. package/docs/tutorials/config.md +9 -5
  54. package/docs/tutorials/drm-config.md +61 -0
  55. package/docs/tutorials/fairplay.md +19 -4
  56. package/docs/tutorials/license-server-auth.md +4 -4
  57. package/docs/tutorials/license-wrapping.md +2 -2
  58. package/docs/tutorials/ui-customization.md +7 -3
  59. package/docs/tutorials/ui.md +7 -7
  60. package/docs/tutorials/upgrade.md +3 -0
  61. package/externs/ima.js +123 -2
  62. package/externs/isoboxer.js +217 -0
  63. package/externs/mediakeys.js +18 -0
  64. package/externs/mux.js +1 -105
  65. package/externs/pictureinpicture.js +48 -0
  66. package/externs/shaka/ads.js +61 -1
  67. package/externs/shaka/cea.js +110 -0
  68. package/externs/shaka/codecs.js +32 -0
  69. package/externs/shaka/manifest.js +101 -1
  70. package/externs/shaka/manifest_parser.js +0 -10
  71. package/externs/shaka/net.js +36 -7
  72. package/externs/shaka/offline.js +8 -1
  73. package/externs/shaka/player.js +220 -21
  74. package/externs/shaka/text.js +1 -382
  75. package/externs/shaka/transmuxer.js +59 -0
  76. package/karma.conf.js +15 -0
  77. package/lib/abr/simple_abr_manager.js +6 -3
  78. package/lib/ads/ad_manager.js +60 -2
  79. package/lib/ads/client_side_ad.js +86 -0
  80. package/lib/ads/client_side_ad_manager.js +93 -5
  81. package/lib/ads/server_side_ad.js +86 -0
  82. package/lib/ads/server_side_ad_manager.js +13 -0
  83. package/lib/cast/cast_utils.js +1 -0
  84. package/lib/cea/cea608_data_channel.js +24 -14
  85. package/lib/cea/cea608_memory.js +5 -2
  86. package/lib/cea/cea708_service.js +8 -9
  87. package/lib/cea/cea708_window.js +1 -2
  88. package/lib/cea/cea_decoder.js +23 -6
  89. package/lib/cea/cea_utils.js +25 -2
  90. package/lib/cea/dummy_caption_decoder.js +21 -0
  91. package/lib/cea/dummy_cea_parser.js +1 -3
  92. package/lib/cea/mp4_cea_parser.js +15 -10
  93. package/lib/cea/ts_cea_parser.js +69 -0
  94. package/lib/dash/content_protection.js +32 -2
  95. package/lib/dash/dash_parser.js +93 -31
  96. package/lib/dash/mpd_utils.js +6 -25
  97. package/lib/dash/segment_base.js +12 -14
  98. package/lib/dash/segment_list.js +10 -6
  99. package/lib/dash/segment_template.js +349 -32
  100. package/lib/dependencies/all.js +8 -0
  101. package/lib/hls/hls_classes.js +33 -8
  102. package/lib/hls/hls_parser.js +805 -191
  103. package/lib/hls/manifest_text_parser.js +4 -14
  104. package/lib/media/adaptation_set_criteria.js +43 -3
  105. package/lib/media/closed_caption_parser.js +74 -12
  106. package/lib/media/drm_engine.js +189 -49
  107. package/lib/media/gap_jumping_controller.js +1 -1
  108. package/lib/media/manifest_parser.js +34 -0
  109. package/lib/media/media_source_capabilities.js +10 -0
  110. package/lib/media/media_source_engine.js +475 -231
  111. package/lib/media/playhead.js +1 -1
  112. package/lib/media/presentation_timeline.js +62 -0
  113. package/lib/media/segment_index.js +50 -14
  114. package/lib/media/segment_prefetch.js +277 -0
  115. package/lib/media/segment_reference.js +70 -4
  116. package/lib/media/streaming_engine.js +258 -81
  117. package/lib/media/video_wrapper.js +15 -7
  118. package/lib/mss/content_protection.js +353 -0
  119. package/lib/mss/mss_parser.js +1081 -0
  120. package/lib/net/networking_engine.js +60 -10
  121. package/lib/offline/indexeddb/v1_storage_cell.js +1 -0
  122. package/lib/offline/indexeddb/v2_storage_cell.js +1 -0
  123. package/lib/offline/manifest_converter.js +6 -0
  124. package/lib/offline/storage.js +2 -4
  125. package/lib/player.js +309 -105
  126. package/lib/polyfill/media_capabilities.js +43 -3
  127. package/lib/polyfill/patchedmediakeys_apple.js +5 -0
  128. package/lib/polyfill/patchedmediakeys_nop.js +5 -0
  129. package/lib/polyfill/patchedmediakeys_webkit.js +5 -0
  130. package/lib/text/cue.js +208 -130
  131. package/lib/text/lrc_text_parser.js +2 -2
  132. package/lib/text/mp4_vtt_parser.js +2 -2
  133. package/lib/text/sbv_text_parser.js +1 -1
  134. package/lib/text/simple_text_displayer.js +2 -1
  135. package/lib/text/srt_text_parser.js +9 -1
  136. package/lib/text/ssa_text_parser.js +2 -2
  137. package/lib/text/text_engine.js +3 -21
  138. package/lib/text/text_utils.js +71 -20
  139. package/lib/text/ui_text_displayer.js +14 -14
  140. package/lib/text/vtt_text_parser.js +22 -14
  141. package/lib/transmuxer/aac_transmuxer.js +224 -0
  142. package/lib/transmuxer/ac3.js +142 -0
  143. package/lib/transmuxer/ac3_transmuxer.js +212 -0
  144. package/lib/transmuxer/adts.js +232 -0
  145. package/lib/transmuxer/ec3.js +103 -0
  146. package/lib/transmuxer/ec3_transmuxer.js +212 -0
  147. package/lib/transmuxer/h264.js +324 -0
  148. package/lib/transmuxer/mp3_transmuxer.js +204 -0
  149. package/lib/transmuxer/mpeg_audio.js +196 -0
  150. package/lib/transmuxer/mpeg_ts_transmuxer.js +182 -0
  151. package/lib/transmuxer/mss_transmuxer.js +389 -0
  152. package/lib/{media/transmuxer.js → transmuxer/muxjs_transmuxer.js} +34 -80
  153. package/lib/transmuxer/transmuxer_engine.js +161 -0
  154. package/lib/transmuxer/ts_transmuxer.js +738 -0
  155. package/lib/util/cmcd_manager.js +131 -71
  156. package/lib/util/error.js +62 -26
  157. package/lib/util/exp_golomb.js +220 -0
  158. package/lib/util/fairplay_utils.js +64 -13
  159. package/lib/util/id3_utils.js +56 -3
  160. package/lib/util/language_utils.js +11 -8
  161. package/lib/util/manifest_parser_utils.js +3 -0
  162. package/lib/util/mime_utils.js +44 -7
  163. package/lib/util/mp4_box_parsers.js +233 -5
  164. package/lib/util/mp4_generator.js +1381 -0
  165. package/lib/util/periods.js +40 -34
  166. package/lib/util/platform.js +25 -3
  167. package/lib/util/player_configuration.js +38 -1
  168. package/lib/util/stream_utils.js +138 -27
  169. package/lib/util/text_parser.js +1 -1
  170. package/lib/util/ts_parser.js +470 -47
  171. package/lib/util/xml_utils.js +16 -3
  172. package/maintained-branches.md +2 -2
  173. package/package.json +4 -2
  174. package/roadmap.md +21 -6
  175. package/shaka-player.uncompiled.js +18 -0
  176. package/test/abr/simple_abr_manager_unit.js +32 -4
  177. package/test/ads/ad_manager_unit.js +18 -2
  178. package/test/cast/cast_utils_unit.js +7 -2
  179. package/test/cea/cea608_memory_unit.js +24 -0
  180. package/test/cea/cea_decoder_unit.js +33 -0
  181. package/test/dash/dash_parser_content_protection_unit.js +93 -3
  182. package/test/dash/dash_parser_live_unit.js +56 -13
  183. package/test/dash/dash_parser_manifest_unit.js +70 -2
  184. package/test/dash/dash_parser_segment_base_unit.js +14 -9
  185. package/test/dash/dash_parser_segment_template_unit.js +286 -6
  186. package/test/demo/demo_unit.js +5 -1
  187. package/test/hls/hls_live_unit.js +188 -28
  188. package/test/hls/hls_parser_unit.js +250 -109
  189. package/test/hls/manifest_text_parser_unit.js +18 -13
  190. package/test/media/adaptation_set_criteria_unit.js +46 -14
  191. package/test/media/adaptation_set_unit.js +2 -0
  192. package/test/media/drm_engine_integration.js +11 -8
  193. package/test/media/drm_engine_unit.js +220 -7
  194. package/test/media/media_source_engine_integration.js +122 -38
  195. package/test/media/media_source_engine_unit.js +133 -153
  196. package/test/media/playhead_unit.js +3 -0
  197. package/test/media/presentation_timeline_unit.js +51 -0
  198. package/test/media/segment_index_unit.js +52 -0
  199. package/test/media/segment_prefetch_unit.js +243 -0
  200. package/test/media/streaming_engine_integration.js +9 -3
  201. package/test/media/streaming_engine_unit.js +440 -59
  202. package/test/mss/mss_parser_content_protection_unit.js +49 -0
  203. package/test/mss/mss_parser_unit.js +472 -0
  204. package/test/mss/mss_player_integration.js +123 -0
  205. package/test/offline/manifest_convert_unit.js +9 -0
  206. package/test/offline/storage_integration.js +6 -1
  207. package/test/player_integration.js +4 -1
  208. package/test/player_unit.js +386 -133
  209. package/test/polyfill/media_capabilities_unit.js +18 -0
  210. package/test/test/assets/hls-raw-aac/fileSequence0.aac +0 -0
  211. package/test/test/assets/hls-raw-aac/fileSequence1.aac +0 -0
  212. package/test/test/assets/hls-raw-aac/fileSequence2.aac +0 -0
  213. package/test/test/assets/hls-raw-aac/fileSequence3.aac +0 -0
  214. package/test/test/assets/hls-raw-aac/manifest.m3u8 +4 -0
  215. package/test/test/assets/hls-raw-aac/stream.m4a.m3u8 +14 -0
  216. package/test/test/assets/hls-raw-ac3/fileSequence0.ac3 +0 -0
  217. package/test/test/assets/hls-raw-ac3/fileSequence1.ac3 +0 -0
  218. package/test/test/assets/hls-raw-ac3/fileSequence2.ac3 +0 -0
  219. package/test/test/assets/hls-raw-ac3/fileSequence3.ac3 +0 -0
  220. package/test/test/assets/hls-raw-ac3/fileSequence4.ac3 +0 -0
  221. package/test/test/assets/hls-raw-ac3/fileSequence5.ac3 +0 -0
  222. package/test/test/assets/hls-raw-ac3/fileSequence6.ac3 +0 -0
  223. package/test/test/assets/hls-raw-ac3/fileSequence7.ac3 +0 -0
  224. package/test/test/assets/hls-raw-ac3/prog_index.m3u8 +31 -0
  225. package/test/test/assets/hls-raw-ec3/fileSequence0.ec3 +0 -0
  226. package/test/test/assets/hls-raw-ec3/fileSequence1.ec3 +0 -0
  227. package/test/test/assets/hls-raw-ec3/fileSequence2.ec3 +0 -0
  228. package/test/test/assets/hls-raw-ec3/fileSequence3.ec3 +0 -0
  229. package/test/test/assets/hls-raw-ec3/fileSequence4.ec3 +0 -0
  230. package/test/test/assets/hls-raw-ec3/fileSequence5.ec3 +0 -0
  231. package/test/test/assets/hls-raw-ec3/fileSequence6.ec3 +0 -0
  232. package/test/test/assets/hls-raw-ec3/fileSequence7.ec3 +0 -0
  233. package/test/test/assets/hls-raw-ec3/prog_index.m3u8 +31 -0
  234. package/test/test/assets/hls-raw-mp3/chunklist_w905519204.m3u8 +13 -0
  235. package/test/test/assets/hls-raw-mp3/media_w905519204_0.mp3 +0 -0
  236. package/test/test/assets/hls-raw-mp3/media_w905519204_1.mp3 +0 -0
  237. package/test/test/assets/hls-raw-mp3/media_w905519204_2.mp3 +0 -0
  238. package/test/test/assets/hls-raw-mp3/media_w905519204_3.mp3 +0 -0
  239. package/test/test/assets/hls-raw-mp3/playlist.m3u8 +4 -0
  240. package/test/test/assets/hls-ts-aac/playlist.m3u8 +23 -0
  241. package/test/test/assets/hls-ts-aac/segment_0.ts +0 -0
  242. package/test/test/assets/hls-ts-aac/segment_1.ts +0 -0
  243. package/test/test/assets/hls-ts-aac/segment_2.ts +0 -0
  244. package/test/test/assets/hls-ts-aac/segment_3.ts +0 -0
  245. package/test/test/assets/hls-ts-aac/segment_4.ts +0 -0
  246. package/test/test/assets/hls-ts-aac/segment_5.ts +0 -0
  247. package/test/test/assets/hls-ts-aac/segment_6.ts +0 -0
  248. package/test/test/assets/hls-ts-aac/segment_7.ts +0 -0
  249. package/test/test/assets/hls-ts-ac3/ChID_voices_6ch_640kbps_dd_sub_0000.ts +0 -0
  250. package/test/test/assets/hls-ts-ac3/ChID_voices_6ch_640kbps_dd_sub_0001.ts +0 -0
  251. package/test/test/assets/hls-ts-ac3/ChID_voices_6ch_640kbps_dd_sub_0002.ts +0 -0
  252. package/test/test/assets/hls-ts-ac3/ChID_voices_6ch_640kbps_dd_sub_0003.ts +0 -0
  253. package/test/test/assets/hls-ts-ac3/ChID_voices_6ch_640kbps_dd_sub_0004.ts +0 -0
  254. package/test/test/assets/hls-ts-ac3/ChID_voices_6ch_640kbps_dd_sub_0005.ts +0 -0
  255. package/test/test/assets/hls-ts-ac3/prog_index.m3u8 +19 -0
  256. package/test/test/assets/hls-ts-ec3/ChID_voices_6ch_256kbps_ddp_sub_0000.ts +0 -0
  257. package/test/test/assets/hls-ts-ec3/ChID_voices_6ch_256kbps_ddp_sub_0001.ts +0 -0
  258. package/test/test/assets/hls-ts-ec3/ChID_voices_6ch_256kbps_ddp_sub_0002.ts +0 -0
  259. package/test/test/assets/hls-ts-ec3/ChID_voices_6ch_256kbps_ddp_sub_0003.ts +0 -0
  260. package/test/test/assets/hls-ts-ec3/ChID_voices_6ch_256kbps_ddp_sub_0004.ts +0 -0
  261. package/test/test/assets/hls-ts-ec3/ChID_voices_6ch_256kbps_ddp_sub_0005.ts +0 -0
  262. package/test/test/assets/hls-ts-ec3/prog_index.m3u8 +19 -0
  263. package/test/test/assets/hls-ts-h264/fileSequence0.ts +0 -0
  264. package/test/test/assets/hls-ts-h264/fileSequence1.ts +0 -0
  265. package/test/test/assets/hls-ts-h264/fileSequence2.ts +0 -0
  266. package/test/test/assets/hls-ts-h264/fileSequence3.ts +0 -0
  267. package/test/test/assets/hls-ts-h264/fileSequence4.ts +0 -0
  268. package/test/test/assets/hls-ts-h264/fileSequence5.ts +0 -0
  269. package/test/test/assets/hls-ts-h264/prog_index.m3u8 +25 -0
  270. package/test/test/assets/hls-ts-mp3/manifest.m3u8 +13 -0
  271. package/test/test/assets/hls-ts-mp3/media_w239891843_0.ts +0 -0
  272. package/test/test/assets/hls-ts-mp3/media_w239891843_1.ts +0 -0
  273. package/test/test/assets/hls-ts-mp3/media_w239891843_2.ts +0 -0
  274. package/test/test/assets/hls-ts-mp3/media_w239891843_3.ts +0 -0
  275. package/test/test/assets/hls-ts-muxed-aac-h264/chunk.m3u8 +17 -0
  276. package/test/test/assets/hls-ts-muxed-aac-h264/n_0_0_0.ts +0 -0
  277. package/test/test/assets/hls-ts-muxed-aac-h264/n_1_0_0.ts +0 -0
  278. package/test/test/assets/hls-ts-muxed-aac-h264/n_2_0_0.ts +0 -0
  279. package/test/test/assets/hls-ts-muxed-aac-h264/n_3_0_0.ts +0 -0
  280. package/test/test/assets/hls-ts-muxed-aac-h264/n_4_0_0.ts +0 -0
  281. package/test/test/assets/hls-ts-muxed-aac-h264/n_5_0_0.ts +0 -0
  282. package/test/test/assets/hls-ts-muxed-aac-h264/playlist.m3u8 +4 -0
  283. package/test/test/boot.js +7 -2
  284. package/test/test/util/fake_ad.js +99 -0
  285. package/test/test/util/fake_ad_manager.js +7 -1
  286. package/test/test/util/fake_networking_engine.js +41 -14
  287. package/test/test/util/fake_segment_prefetch.js +81 -0
  288. package/test/test/util/manifest_generator.js +19 -5
  289. package/test/test/util/mss_parser_util.js +115 -0
  290. package/test/test/util/offline_utils.js +1 -0
  291. package/test/test/util/simple_fakes.js +12 -3
  292. package/test/test/util/streaming_engine_util.js +14 -4
  293. package/test/test/util/ttml_utils.js +2 -2
  294. package/test/test/util/ui_utils.js +5 -1
  295. package/test/text/cue_integration.js +1 -1
  296. package/test/text/srt_text_parser_unit.js +78 -0
  297. package/test/text/text_engine_unit.js +17 -8
  298. package/test/text/ui_text_displayer_unit.js +4 -4
  299. package/test/text/vtt_text_parser_unit.js +59 -40
  300. package/test/text/web_vtt_generator_unit.js +9 -3
  301. package/test/{media/transmuxer_integration.js → transmuxer/muxjs_transmuxer_integration.js} +30 -33
  302. package/test/transmuxer/transmuxer_engine_integration.js +60 -0
  303. package/test/transmuxer/transmuxer_integration.js +296 -0
  304. package/test/util/cmcd_manager_unit.js +162 -13
  305. package/test/util/language_utils_unit.js +9 -2
  306. package/test/util/mp4_box_parsers_unit.js +39 -4
  307. package/test/util/periods_unit.js +34 -26
  308. package/test/util/stream_utils_unit.js +60 -107
  309. package/ui/controls.js +19 -1
  310. package/ui/controls.less +1 -0
  311. package/ui/externs/ui.js +13 -3
  312. package/ui/language_utils.js +15 -0
  313. package/ui/less/thumbnails.less +26 -0
  314. package/ui/locales/oc.json +42 -0
  315. package/ui/pip_button.js +83 -2
  316. package/ui/range_element.js +15 -0
  317. package/ui/resolution_selection.js +9 -2
  318. package/ui/seek_bar.js +230 -1
  319. package/ui/ui.js +5 -0
  320. package/lib/cea/i_caption_decoder.js +0 -51
  321. package/lib/cea/i_cea_parser.js +0 -68
@@ -0,0 +1,738 @@
1
+ /*! @license
2
+ * Shaka Player
3
+ * Copyright 2016 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+
7
+ goog.provide('shaka.transmuxer.TsTransmuxer');
8
+
9
+ goog.require('shaka.media.Capabilities');
10
+ goog.require('shaka.transmuxer.Ac3');
11
+ goog.require('shaka.transmuxer.ADTS');
12
+ goog.require('shaka.transmuxer.Ec3');
13
+ goog.require('shaka.transmuxer.H264');
14
+ goog.require('shaka.transmuxer.MpegAudio');
15
+ goog.require('shaka.transmuxer.TransmuxerEngine');
16
+ goog.require('shaka.util.BufferUtils');
17
+ goog.require('shaka.util.Error');
18
+ goog.require('shaka.util.ManifestParserUtils');
19
+ goog.require('shaka.util.MimeUtils');
20
+ goog.require('shaka.util.Mp4Generator');
21
+ goog.require('shaka.util.TsParser');
22
+ goog.require('shaka.util.Uint8ArrayUtils');
23
+
24
+
25
+ /**
26
+ * @implements {shaka.extern.Transmuxer}
27
+ * @export
28
+ */
29
+ shaka.transmuxer.TsTransmuxer = class {
30
+ /**
31
+ * @param {string} mimeType
32
+ */
33
+ constructor(mimeType) {
34
+ /** @private {string} */
35
+ this.originalMimeType_ = mimeType;
36
+
37
+ /** @private {number} */
38
+ this.frameIndex_ = 0;
39
+
40
+ /** @private {!Map.<number, !Uint8Array>} */
41
+ this.initSegments = new Map();
42
+
43
+ /** @private {?shaka.util.TsParser} */
44
+ this.tsParser_ = null;
45
+ }
46
+
47
+
48
+ /**
49
+ * @override
50
+ * @export
51
+ */
52
+ destroy() {
53
+ this.initSegments.clear();
54
+ }
55
+
56
+
57
+ /**
58
+ * Check if the mime type and the content type is supported.
59
+ * @param {string} mimeType
60
+ * @param {string=} contentType
61
+ * @return {boolean}
62
+ * @override
63
+ * @export
64
+ */
65
+ isSupported(mimeType, contentType) {
66
+ const Capabilities = shaka.media.Capabilities;
67
+
68
+ if (!this.isTsContainer_(mimeType)) {
69
+ return false;
70
+ }
71
+
72
+ const ContentType = shaka.util.ManifestParserUtils.ContentType;
73
+ const MimeUtils = shaka.util.MimeUtils;
74
+
75
+ const codecs = MimeUtils.getCodecs(mimeType);
76
+ const allCodecs = MimeUtils.splitCodecs(codecs);
77
+
78
+ const audioCodec = shaka.util.ManifestParserUtils.guessCodecsSafe(
79
+ ContentType.AUDIO, allCodecs);
80
+ const videoCodec = shaka.util.ManifestParserUtils.guessCodecsSafe(
81
+ ContentType.VIDEO, allCodecs);
82
+
83
+ // We don't support muxed content yet.
84
+ if (audioCodec && videoCodec) {
85
+ return false;
86
+ }
87
+
88
+ const TsTransmuxer = shaka.transmuxer.TsTransmuxer;
89
+
90
+ if (audioCodec) {
91
+ const normalizedCodec = MimeUtils.getNormalizedCodec(audioCodec);
92
+ if (!TsTransmuxer.SUPPORTED_AUDIO_CODECS_.includes(normalizedCodec)) {
93
+ return false;
94
+ }
95
+ }
96
+
97
+ if (videoCodec) {
98
+ const normalizedCodec = MimeUtils.getNormalizedCodec(videoCodec);
99
+ if (!TsTransmuxer.SUPPORTED_VIDEO_CODECS_.includes(normalizedCodec)) {
100
+ return false;
101
+ }
102
+ }
103
+
104
+ if (contentType) {
105
+ return Capabilities.isTypeSupported(
106
+ this.convertCodecs(contentType, mimeType));
107
+ }
108
+
109
+ const audioMime = this.convertCodecs(ContentType.AUDIO, mimeType);
110
+ const videoMime = this.convertCodecs(ContentType.VIDEO, mimeType);
111
+ return Capabilities.isTypeSupported(audioMime) ||
112
+ Capabilities.isTypeSupported(videoMime);
113
+ }
114
+
115
+
116
+ /**
117
+ * Check if the mimetype is 'video/mp2t'.
118
+ * @param {string} mimeType
119
+ * @return {boolean}
120
+ * @private
121
+ */
122
+ isTsContainer_(mimeType) {
123
+ return mimeType.toLowerCase().split(';')[0] == 'video/mp2t';
124
+ }
125
+
126
+
127
+ /**
128
+ * @override
129
+ * @export
130
+ */
131
+ convertCodecs(contentType, mimeType) {
132
+ if (this.isTsContainer_(mimeType)) {
133
+ const ContentType = shaka.util.ManifestParserUtils.ContentType;
134
+ // The replace it's necessary because Firefox(the only browser that
135
+ // supports MP3 in MP4) only support the MP3 codec with the mp3 string.
136
+ // MediaSource.isTypeSupported('audio/mp4; codecs="mp4a.40.34"') -> false
137
+ // MediaSource.isTypeSupported('audio/mp4; codecs="mp3"') -> true
138
+ const codecs = shaka.util.MimeUtils.getCodecs(mimeType)
139
+ .replace('mp4a.40.34', 'mp3');
140
+ if (contentType == ContentType.AUDIO) {
141
+ return `audio/mp4; codecs="${codecs}"`;
142
+ }
143
+ return `video/mp4; codecs="${codecs}"`;
144
+ }
145
+ return mimeType;
146
+ }
147
+
148
+
149
+ /**
150
+ * @override
151
+ * @export
152
+ */
153
+ getOrginalMimeType() {
154
+ return this.originalMimeType_;
155
+ }
156
+
157
+
158
+ /**
159
+ * @override
160
+ * @export
161
+ */
162
+ transmux(data, stream, reference, duration) {
163
+ if (!this.tsParser_) {
164
+ this.tsParser_ = new shaka.util.TsParser();
165
+ } else {
166
+ this.tsParser_.clearData();
167
+ }
168
+ const Uint8ArrayUtils = shaka.util.Uint8ArrayUtils;
169
+
170
+ const uint8ArrayData = shaka.util.BufferUtils.toUint8(data);
171
+
172
+ let timestamp = reference.endTime * 1000;
173
+
174
+ const tsParser = this.tsParser_.parse(uint8ArrayData);
175
+ const startTime = tsParser.getStartTime();
176
+
177
+ if (startTime.audio != null) {
178
+ timestamp = startTime.audio;
179
+ }
180
+ if (startTime.video != null) {
181
+ timestamp = startTime.video;
182
+ }
183
+ const streamInfos = [];
184
+ const codecs = tsParser.getCodecs();
185
+ try {
186
+ let streamInfo = null;
187
+ switch (codecs.video) {
188
+ case 'avc':
189
+ streamInfo =
190
+ this.getAvcStreamInfo_(tsParser, timestamp, stream, duration);
191
+ break;
192
+ }
193
+ if (streamInfo) {
194
+ streamInfos.push(streamInfo);
195
+ streamInfo = null;
196
+ }
197
+ const isMuxed = !!(codecs.video && codecs.audio);
198
+ switch (codecs.audio) {
199
+ case 'aac':
200
+ streamInfo =
201
+ this.getAacStreamInfo_(
202
+ tsParser, timestamp, stream, duration, isMuxed);
203
+ break;
204
+ case 'ac3':
205
+ streamInfo =
206
+ this.getAc3StreamInfo_(
207
+ tsParser, timestamp, stream, duration, isMuxed);
208
+ break;
209
+ case 'ec3':
210
+ streamInfo =
211
+ this.getEc3StreamInfo_(
212
+ tsParser, timestamp, stream, duration, isMuxed);
213
+ break;
214
+ case 'mp3':
215
+ streamInfo =
216
+ this.getMp3StreamInfo_(
217
+ tsParser, timestamp, stream, duration, isMuxed);
218
+ break;
219
+ }
220
+ if (streamInfo) {
221
+ streamInfos.push(streamInfo);
222
+ streamInfo = null;
223
+ }
224
+ } catch (e) {
225
+ return Promise.reject(e);
226
+ }
227
+
228
+ if (!streamInfos.length) {
229
+ return Promise.reject(new shaka.util.Error(
230
+ shaka.util.Error.Severity.CRITICAL,
231
+ shaka.util.Error.Category.MEDIA,
232
+ shaka.util.Error.Code.TRANSMUXING_FAILED));
233
+ }
234
+
235
+ const mp4Generator = new shaka.util.Mp4Generator(streamInfos);
236
+ let initSegment;
237
+ if (!this.initSegments.has(stream.id)) {
238
+ initSegment = mp4Generator.initSegment();
239
+ this.initSegments.set(stream.id, initSegment);
240
+ } else {
241
+ initSegment = this.initSegments.get(stream.id);
242
+ }
243
+ const segmentData = mp4Generator.segmentData();
244
+
245
+ this.frameIndex_++;
246
+ const transmuxData = Uint8ArrayUtils.concat(initSegment, segmentData);
247
+ return Promise.resolve(transmuxData);
248
+ }
249
+
250
+
251
+ /**
252
+ * @param {shaka.util.TsParser} tsParser
253
+ * @param {number} timestamp
254
+ * @param {shaka.extern.Stream} stream
255
+ * @param {number} duration
256
+ * @param {boolean} isMuxed
257
+ * @return {shaka.util.Mp4Generator.StreamInfo}
258
+ * @private
259
+ */
260
+ getAacStreamInfo_(tsParser, timestamp, stream, duration, isMuxed) {
261
+ const ADTS = shaka.transmuxer.ADTS;
262
+
263
+ /** @type {!Array.<shaka.util.Mp4Generator.Mp4Sample>} */
264
+ const samples = [];
265
+
266
+ let info;
267
+
268
+ for (const audioData of tsParser.getAudioData()) {
269
+ const data = audioData.data;
270
+ if (!data) {
271
+ continue;
272
+ }
273
+ let offset = 0;
274
+ info = ADTS.parseInfo(data, offset);
275
+ if (!info) {
276
+ throw new shaka.util.Error(
277
+ shaka.util.Error.Severity.CRITICAL,
278
+ shaka.util.Error.Category.MEDIA,
279
+ shaka.util.Error.Code.TRANSMUXING_FAILED);
280
+ }
281
+ stream.audioSamplingRate = info.sampleRate;
282
+ stream.channelsCount = info.channelCount;
283
+ stream.codecs = info.codec;
284
+
285
+ while (offset < data.length) {
286
+ const header = ADTS.parseHeader(data, offset);
287
+ if (!header) {
288
+ // We will increment one byte each time until we find the header.
289
+ offset++;
290
+ continue;
291
+ }
292
+ const length = header.headerLength + header.frameLength;
293
+ if (offset + length <= data.length) {
294
+ const frameData = data.subarray(
295
+ offset + header.headerLength, offset + length);
296
+
297
+ samples.push({
298
+ data: frameData,
299
+ size: header.frameLength,
300
+ duration: ADTS.AAC_SAMPLES_PER_FRAME,
301
+ cts: 0,
302
+ flags: {
303
+ isLeading: 0,
304
+ isDependedOn: 0,
305
+ hasRedundancy: 0,
306
+ degradPrio: 0,
307
+ dependsOn: 2,
308
+ isNonSync: 0,
309
+ },
310
+ });
311
+ }
312
+ offset += length;
313
+ }
314
+ }
315
+
316
+ if (!info) {
317
+ throw new shaka.util.Error(
318
+ shaka.util.Error.Severity.CRITICAL,
319
+ shaka.util.Error.Category.MEDIA,
320
+ shaka.util.Error.Code.TRANSMUXING_FAILED);
321
+ }
322
+
323
+ /** @type {number} */
324
+ const sampleRate = info.sampleRate;
325
+ /** @type {number} */
326
+ const baseMediaDecodeTime = Math.floor(timestamp * sampleRate / 1000);
327
+
328
+ let id = stream.id;
329
+ if (isMuxed) {
330
+ id += shaka.transmuxer.TsTransmuxer.START_ID_FOR_MUXED_CONTENT_;
331
+ }
332
+ return {
333
+ id: id,
334
+ type: shaka.util.ManifestParserUtils.ContentType.AUDIO,
335
+ encrypted: stream.encrypted && stream.drmInfos.length > 0,
336
+ timescale: sampleRate,
337
+ duration: duration,
338
+ videoNalus: [],
339
+ audioConfig: new Uint8Array([]),
340
+ videoConfig: new Uint8Array([]),
341
+ data: {
342
+ sequenceNumber: this.frameIndex_,
343
+ baseMediaDecodeTime: baseMediaDecodeTime,
344
+ samples: samples,
345
+ },
346
+ stream: stream,
347
+ };
348
+ }
349
+
350
+
351
+ /**
352
+ * @param {shaka.util.TsParser} tsParser
353
+ * @param {number} timestamp
354
+ * @param {shaka.extern.Stream} stream
355
+ * @param {number} duration
356
+ * @param {boolean} isMuxed
357
+ * @return {shaka.util.Mp4Generator.StreamInfo}
358
+ * @private
359
+ */
360
+ getAc3StreamInfo_(tsParser, timestamp, stream, duration, isMuxed) {
361
+ const Ac3 = shaka.transmuxer.Ac3;
362
+
363
+ /** @type {!Array.<shaka.util.Mp4Generator.Mp4Sample>} */
364
+ const samples = [];
365
+
366
+ /** @type {number} */
367
+ let sampleRate = 0;
368
+
369
+ /** @type {!Uint8Array} */
370
+ let audioConfig = new Uint8Array([]);
371
+
372
+ for (const audioData of tsParser.getAudioData()) {
373
+ const data = audioData.data;
374
+ let offset = 0;
375
+ while (offset < data.length) {
376
+ const frame = Ac3.parseFrame(data, offset);
377
+ if (!frame) {
378
+ offset++;
379
+ continue;
380
+ }
381
+ stream.audioSamplingRate = frame.sampleRate;
382
+ stream.channelsCount = frame.channelCount;
383
+ sampleRate = frame.sampleRate;
384
+ audioConfig = frame.audioConfig;
385
+
386
+ const frameData = data.subarray(
387
+ offset, offset + frame.frameLength);
388
+
389
+ samples.push({
390
+ data: frameData,
391
+ size: frame.frameLength,
392
+ duration: Ac3.AC3_SAMPLES_PER_FRAME,
393
+ cts: 0,
394
+ flags: {
395
+ isLeading: 0,
396
+ isDependedOn: 0,
397
+ hasRedundancy: 0,
398
+ degradPrio: 0,
399
+ dependsOn: 2,
400
+ isNonSync: 0,
401
+ },
402
+ });
403
+ offset += frame.frameLength;
404
+ }
405
+ }
406
+
407
+ if (sampleRate == 0 || audioConfig.byteLength == 0) {
408
+ throw new shaka.util.Error(
409
+ shaka.util.Error.Severity.CRITICAL,
410
+ shaka.util.Error.Category.MEDIA,
411
+ shaka.util.Error.Code.TRANSMUXING_FAILED);
412
+ }
413
+
414
+
415
+ /** @type {number} */
416
+ const baseMediaDecodeTime = Math.floor(timestamp * sampleRate / 1000);
417
+
418
+ let id = stream.id;
419
+ if (isMuxed) {
420
+ id += shaka.transmuxer.TsTransmuxer.START_ID_FOR_MUXED_CONTENT_;
421
+ }
422
+ return {
423
+ id: id,
424
+ type: shaka.util.ManifestParserUtils.ContentType.AUDIO,
425
+ encrypted: stream.encrypted && stream.drmInfos.length > 0,
426
+ timescale: sampleRate,
427
+ duration: duration,
428
+ videoNalus: [],
429
+ audioConfig: audioConfig,
430
+ videoConfig: new Uint8Array([]),
431
+ data: {
432
+ sequenceNumber: this.frameIndex_,
433
+ baseMediaDecodeTime: baseMediaDecodeTime,
434
+ samples: samples,
435
+ },
436
+ stream: stream,
437
+ };
438
+ }
439
+
440
+
441
+ /**
442
+ * @param {shaka.util.TsParser} tsParser
443
+ * @param {number} timestamp
444
+ * @param {shaka.extern.Stream} stream
445
+ * @param {number} duration
446
+ * @param {boolean} isMuxed
447
+ * @return {shaka.util.Mp4Generator.StreamInfo}
448
+ * @private
449
+ */
450
+ getEc3StreamInfo_(tsParser, timestamp, stream, duration, isMuxed) {
451
+ const Ec3 = shaka.transmuxer.Ec3;
452
+
453
+ /** @type {!Array.<shaka.util.Mp4Generator.Mp4Sample>} */
454
+ const samples = [];
455
+
456
+ /** @type {number} */
457
+ let sampleRate = 0;
458
+
459
+ /** @type {!Uint8Array} */
460
+ let audioConfig = new Uint8Array([]);
461
+
462
+ for (const audioData of tsParser.getAudioData()) {
463
+ const data = audioData.data;
464
+ let offset = 0;
465
+ while (offset < data.length) {
466
+ const frame = Ec3.parseFrame(data, offset);
467
+ if (!frame) {
468
+ offset++;
469
+ continue;
470
+ }
471
+ stream.audioSamplingRate = frame.sampleRate;
472
+ stream.channelsCount = frame.channelCount;
473
+ sampleRate = frame.sampleRate;
474
+ audioConfig = frame.audioConfig;
475
+
476
+ const frameData = data.subarray(
477
+ offset, offset + frame.frameLength);
478
+
479
+ samples.push({
480
+ data: frameData,
481
+ size: frame.frameLength,
482
+ duration: Ec3.EC3_SAMPLES_PER_FRAME,
483
+ cts: 0,
484
+ flags: {
485
+ isLeading: 0,
486
+ isDependedOn: 0,
487
+ hasRedundancy: 0,
488
+ degradPrio: 0,
489
+ dependsOn: 2,
490
+ isNonSync: 0,
491
+ },
492
+ });
493
+ offset += frame.frameLength;
494
+ }
495
+ }
496
+
497
+ if (sampleRate == 0 || audioConfig.byteLength == 0) {
498
+ throw new shaka.util.Error(
499
+ shaka.util.Error.Severity.CRITICAL,
500
+ shaka.util.Error.Category.MEDIA,
501
+ shaka.util.Error.Code.TRANSMUXING_FAILED);
502
+ }
503
+
504
+
505
+ /** @type {number} */
506
+ const baseMediaDecodeTime = Math.floor(timestamp * sampleRate / 1000);
507
+
508
+ let id = stream.id;
509
+ if (isMuxed) {
510
+ id += shaka.transmuxer.TsTransmuxer.START_ID_FOR_MUXED_CONTENT_;
511
+ }
512
+ return {
513
+ id: id,
514
+ type: shaka.util.ManifestParserUtils.ContentType.AUDIO,
515
+ encrypted: stream.encrypted && stream.drmInfos.length > 0,
516
+ timescale: sampleRate,
517
+ duration: duration,
518
+ videoNalus: [],
519
+ audioConfig: audioConfig,
520
+ videoConfig: new Uint8Array([]),
521
+ data: {
522
+ sequenceNumber: this.frameIndex_,
523
+ baseMediaDecodeTime: baseMediaDecodeTime,
524
+ samples: samples,
525
+ },
526
+ stream: stream,
527
+ };
528
+ }
529
+
530
+
531
+ /**
532
+ * @param {shaka.util.TsParser} tsParser
533
+ * @param {number} timestamp
534
+ * @param {shaka.extern.Stream} stream
535
+ * @param {number} duration
536
+ * @param {boolean} isMuxed
537
+ * @return {shaka.util.Mp4Generator.StreamInfo}
538
+ * @private
539
+ */
540
+ getMp3StreamInfo_(tsParser, timestamp, stream, duration, isMuxed) {
541
+ const MpegAudio = shaka.transmuxer.MpegAudio;
542
+
543
+ /** @type {!Array.<shaka.util.Mp4Generator.Mp4Sample>} */
544
+ const samples = [];
545
+
546
+ let firstHeader;
547
+
548
+ for (const audioData of tsParser.getAudioData()) {
549
+ const data = audioData.data;
550
+ if (!data) {
551
+ continue;
552
+ }
553
+ let offset = 0;
554
+ while (offset < data.length) {
555
+ const header = MpegAudio.parseHeader(data, offset);
556
+ if (!header) {
557
+ offset++;
558
+ continue;
559
+ }
560
+ if (!firstHeader) {
561
+ firstHeader = header;
562
+ }
563
+ if (offset + header.frameLength <= data.length) {
564
+ samples.push({
565
+ data: data.subarray(offset, offset + header.frameLength),
566
+ size: header.frameLength,
567
+ duration: MpegAudio.MPEG_AUDIO_SAMPLE_PER_FRAME,
568
+ cts: 0,
569
+ flags: {
570
+ isLeading: 0,
571
+ isDependedOn: 0,
572
+ hasRedundancy: 0,
573
+ degradPrio: 0,
574
+ dependsOn: 2,
575
+ isNonSync: 0,
576
+ },
577
+ });
578
+ }
579
+ offset += header.frameLength;
580
+ }
581
+ }
582
+ if (!firstHeader) {
583
+ throw new shaka.util.Error(
584
+ shaka.util.Error.Severity.CRITICAL,
585
+ shaka.util.Error.Category.MEDIA,
586
+ shaka.util.Error.Code.TRANSMUXING_FAILED);
587
+ }
588
+ /** @type {number} */
589
+ const sampleRate = firstHeader.sampleRate;
590
+ /** @type {number} */
591
+ const baseMediaDecodeTime = Math.floor(timestamp * sampleRate / 1000);
592
+
593
+ let id = stream.id;
594
+ if (isMuxed) {
595
+ id += shaka.transmuxer.TsTransmuxer.START_ID_FOR_MUXED_CONTENT_;
596
+ }
597
+ return {
598
+ id: id,
599
+ type: shaka.util.ManifestParserUtils.ContentType.AUDIO,
600
+ encrypted: stream.encrypted && stream.drmInfos.length > 0,
601
+ timescale: sampleRate,
602
+ duration: duration,
603
+ videoNalus: [],
604
+ audioConfig: new Uint8Array([]),
605
+ videoConfig: new Uint8Array([]),
606
+ data: {
607
+ sequenceNumber: this.frameIndex_,
608
+ baseMediaDecodeTime: baseMediaDecodeTime,
609
+ samples: samples,
610
+ },
611
+ stream: stream,
612
+ };
613
+ }
614
+
615
+
616
+ /**
617
+ * @param {shaka.util.TsParser} tsParser
618
+ * @param {number} timestamp
619
+ * @param {shaka.extern.Stream} stream
620
+ * @param {number} duration
621
+ * @return {shaka.util.Mp4Generator.StreamInfo}
622
+ * @private
623
+ */
624
+ getAvcStreamInfo_(tsParser, timestamp, stream, duration) {
625
+ const H264 = shaka.transmuxer.H264;
626
+ const timescale = shaka.util.TsParser.Timescale;
627
+
628
+ /** @type {!Array.<shaka.util.Mp4Generator.Mp4Sample>} */
629
+ const samples = [];
630
+
631
+ /** @type {?number} */
632
+ let baseMediaDecodeTime = null;
633
+
634
+ let nalus = [];
635
+ const videoData = tsParser.getVideoData().filter((pes) => {
636
+ return pes.pts != null && pes.dts != null;
637
+ });
638
+ for (let i = 0; i < videoData.length; i++) {
639
+ const pes = videoData[i];
640
+ let nextPes;
641
+ if (i + 1 < videoData.length) {
642
+ nextPes = videoData[i + 1];
643
+ }
644
+ const dataNalus = tsParser.parseAvcNalus(pes, nextPes);
645
+ nalus = nalus.concat(dataNalus);
646
+ const frame = H264.parseFrame(dataNalus);
647
+ if (!frame) {
648
+ continue;
649
+ }
650
+ if (baseMediaDecodeTime == null && pes.dts != null) {
651
+ baseMediaDecodeTime = pes.dts;
652
+ }
653
+ let duration;
654
+ if (i + 1 < videoData.length) {
655
+ duration = (videoData[i + 1].dts || 0) - (pes.dts || 0);
656
+ } else {
657
+ duration = (pes.dts || 0) - (videoData[i - 1].dts || 0);
658
+ }
659
+ samples.push({
660
+ data: frame.data,
661
+ size: frame.data.byteLength,
662
+ duration: duration,
663
+ cts: Math.round((pes.pts || 0) - (pes.dts || 0)),
664
+ flags: {
665
+ isLeading: 0,
666
+ isDependedOn: 0,
667
+ hasRedundancy: 0,
668
+ degradPrio: 0,
669
+ dependsOn: frame.isKeyframe ? 2 : 1,
670
+ isNonSync: frame.isKeyframe ? 0 : 1,
671
+ },
672
+ });
673
+ }
674
+
675
+ const info = H264.parseInfo(nalus);
676
+
677
+ if (!info || baseMediaDecodeTime == null) {
678
+ throw new shaka.util.Error(
679
+ shaka.util.Error.Severity.CRITICAL,
680
+ shaka.util.Error.Category.MEDIA,
681
+ shaka.util.Error.Code.TRANSMUXING_FAILED);
682
+ }
683
+ stream.height = info.height;
684
+ stream.width = info.width;
685
+
686
+ return {
687
+ id: stream.id,
688
+ type: shaka.util.ManifestParserUtils.ContentType.VIDEO,
689
+ encrypted: stream.encrypted && stream.drmInfos.length > 0,
690
+ timescale: timescale,
691
+ duration: duration,
692
+ videoNalus: [],
693
+ audioConfig: new Uint8Array([]),
694
+ videoConfig: info.videoConfig,
695
+ data: {
696
+ sequenceNumber: this.frameIndex_,
697
+ baseMediaDecodeTime: baseMediaDecodeTime,
698
+ samples: samples,
699
+ },
700
+ stream: stream,
701
+ };
702
+ }
703
+ };
704
+
705
+ /**
706
+ * Supported audio codecs.
707
+ *
708
+ * @private
709
+ * @const {!Array.<string>}
710
+ */
711
+ shaka.transmuxer.TsTransmuxer.SUPPORTED_AUDIO_CODECS_ = [
712
+ 'aac',
713
+ 'ac-3',
714
+ 'ec-3',
715
+ 'mp3',
716
+ ];
717
+
718
+ /**
719
+ * Supported audio codecs.
720
+ *
721
+ * @private
722
+ * @const {!Array.<string>}
723
+ */
724
+ shaka.transmuxer.TsTransmuxer.SUPPORTED_VIDEO_CODECS_ = [
725
+ 'avc',
726
+ ];
727
+
728
+ /**
729
+ * @private
730
+ * @const {number}
731
+ */
732
+ shaka.transmuxer.TsTransmuxer.START_ID_FOR_MUXED_CONTENT_ = 128;
733
+
734
+
735
+ shaka.transmuxer.TransmuxerEngine.registerTransmuxer(
736
+ 'video/mp2t',
737
+ () => new shaka.transmuxer.TsTransmuxer('video/mp2t'),
738
+ shaka.transmuxer.TransmuxerEngine.PluginPriority.PREFERRED);