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
@@ -10,387 +10,6 @@
10
10
  */
11
11
 
12
12
 
13
- /**
14
- * @interface
15
- * @exportDoc
16
- */
17
- shaka.extern.CueRegion = class {
18
- constructor() {
19
- /**
20
- * Region identifier.
21
- * @type {string}
22
- * @exportDoc
23
- */
24
- this.id;
25
-
26
- /**
27
- * The X offset to start the rendering area in viewportAnchorUnits of the
28
- * video width.
29
- * @type {number}
30
- * @exportDoc
31
- */
32
- this.viewportAnchorX;
33
-
34
- /**
35
- * The X offset to start the rendering area in viewportAnchorUnits of the
36
- * video height.
37
- * @type {number}
38
- * @exportDoc
39
- */
40
- this.viewportAnchorY;
41
-
42
- /**
43
- * The X offset to start the rendering area in percentage (0-100) of this
44
- * region width.
45
- * @type {number}
46
- * @exportDoc
47
- */
48
- this.regionAnchorX;
49
-
50
- /**
51
- * The Y offset to start the rendering area in percentage (0-100) of the
52
- * region height.
53
- * @type {number}
54
- * @exportDoc
55
- */
56
- this.regionAnchorY;
57
-
58
- /**
59
- * The width of the rendering area in widthUnits.
60
- * @type {number}
61
- * @exportDoc
62
- */
63
- this.width;
64
-
65
- /**
66
- * The width of the rendering area in heightUnits.
67
- * @type {number}
68
- * @exportDoc
69
- */
70
- this.height;
71
-
72
- /**
73
- * The units (percentage, pixels or lines) the region height is in.
74
- * @type {shaka.text.CueRegion.units}
75
- * @exportDoc
76
- */
77
- this.heightUnits;
78
-
79
- /**
80
- * The units (percentage or pixels) the region width is in.
81
- * @type {shaka.text.CueRegion.units}
82
- * @exportDoc
83
- */
84
- this.widthUnits;
85
-
86
- /**
87
- * The units (percentage or pixels) the region viewportAnchors are in.
88
- * @type {shaka.text.CueRegion.units}
89
- * @exportDoc
90
- */
91
- this.viewportAnchorUnits;
92
-
93
- /**
94
- * If scroll=UP, it means that cues in the region will be added to the
95
- * bottom of the region and will push any already displayed cues in the
96
- * region up. Otherwise (scroll=NONE) cues will stay fixed at the location
97
- * they were first painted in.
98
- * @type {shaka.text.CueRegion.scrollMode}
99
- * @exportDoc
100
- */
101
- this.scroll;
102
- }
103
- };
104
-
105
-
106
- /**
107
- * @interface
108
- * @exportDoc
109
- */
110
- shaka.extern.Cue = class {
111
- constructor() {
112
- /**
113
- * The start time of the cue in seconds, relative to the start of the
114
- * presentation.
115
- * @type {number}
116
- * @exportDoc
117
- */
118
- this.startTime;
119
-
120
- /**
121
- * The end time of the cue in seconds, relative to the start of the
122
- * presentation.
123
- * @type {number}
124
- * @exportDoc
125
- */
126
- this.endTime;
127
-
128
- /**
129
- * The text payload of the cue. If nestedCues is non-empty, this should be
130
- * empty. Top-level block containers should have no payload of their own.
131
- * @type {string}
132
- * @exportDoc
133
- */
134
- this.payload;
135
-
136
- /**
137
- * The region to render the cue into. Only supported on top-level cues,
138
- * because nested cues are inline elements.
139
- * @type {shaka.extern.CueRegion}
140
- * @exportDoc
141
- */
142
- this.region;
143
-
144
- /**
145
- * The indent (in percent) of the cue box in the direction defined by the
146
- * writing direction.
147
- * @type {?number}
148
- * @exportDoc
149
- */
150
- this.position;
151
-
152
- /**
153
- * Position alignment of the cue.
154
- * @type {shaka.text.Cue.positionAlign}
155
- * @exportDoc
156
- */
157
- this.positionAlign;
158
-
159
- /**
160
- * Size of the cue box (in percents), where 0 means "auto".
161
- * @type {number}
162
- * @exportDoc
163
- */
164
- this.size;
165
-
166
- /**
167
- * Alignment of the text inside the cue box.
168
- * @type {shaka.text.Cue.textAlign}
169
- * @exportDoc
170
- */
171
- this.textAlign;
172
-
173
- /**
174
- * Text direction of the cue.
175
- * @type {shaka.text.Cue.direction}
176
- * @exportDoc
177
- */
178
- this.direction;
179
-
180
- /**
181
- * Text writing mode of the cue.
182
- * @type {shaka.text.Cue.writingMode}
183
- * @exportDoc
184
- */
185
- this.writingMode;
186
-
187
- /**
188
- * The way to interpret line field. (Either as an integer line number or
189
- * percentage from the display box).
190
- * @type {shaka.text.Cue.lineInterpretation}
191
- * @exportDoc
192
- */
193
- this.lineInterpretation;
194
-
195
- /**
196
- * The offset from the display box in either number of lines or
197
- * percentage depending on the value of lineInterpretation.
198
- * @type {?number}
199
- * @exportDoc
200
- */
201
- this.line;
202
-
203
- /**
204
- * Separation between line areas inside the cue box in px or em
205
- * (e.g. '100px'/'100em'). If not specified, this should be no less than
206
- * the largest font size applied to the text in the cue.
207
- * @type {string}.
208
- * @exportDoc
209
- */
210
- this.lineHeight;
211
-
212
- /**
213
- * Line alignment of the cue box.
214
- * Start alignment means the cue box’s top side (for horizontal cues), left
215
- * side (for vertical growing right), or right side (for vertical growing
216
- * left) is aligned at the line.
217
- * Center alignment means the cue box is centered at the line.
218
- * End alignment The cue box’s bottom side (for horizontal cues), right side
219
- * (for vertical growing right), or left side (for vertical growing left) is
220
- * aligned at the line.
221
- * @type {shaka.text.Cue.lineAlign}
222
- * @exportDoc
223
- */
224
- this.lineAlign;
225
-
226
- /**
227
- * Vertical alignments of the cues within their extents.
228
- * 'BEFORE' means displaying the captions at the top of the text display
229
- * container box, 'CENTER' means in the middle, 'AFTER' means at the bottom.
230
- * @type {shaka.text.Cue.displayAlign}
231
- * @exportDoc
232
- */
233
- this.displayAlign;
234
-
235
- /**
236
- * Text color as a CSS color, e.g. "#FFFFFF" or "white".
237
- * @type {string}
238
- * @exportDoc
239
- */
240
- this.color;
241
-
242
- /**
243
- * Text background color as a CSS color, e.g. "#FFFFFF" or "white".
244
- * @type {string}
245
- * @exportDoc
246
- */
247
- this.backgroundColor;
248
-
249
- /**
250
- * The number of horizontal and vertical cells into which the Root Container
251
- * Region area is divided.
252
- *
253
- * @type {{ columns: number, rows: number }}
254
- * @exportDoc
255
- */
256
- this.cellResolution;
257
-
258
- /**
259
- * The URL of the background image, e.g. "data:[mime type];base64,[data]".
260
- * @type {string}
261
- * @exportDoc
262
- */
263
- this.backgroundImage;
264
-
265
- /**
266
- * The border around this cue as a CSS border.
267
- * @type {string}
268
- * @exportDoc
269
- */
270
- this.border;
271
-
272
- /**
273
- * Text font size in px or em (e.g. '100px'/'100em').
274
- * @type {string}
275
- * @exportDoc
276
- */
277
- this.fontSize;
278
-
279
- /**
280
- * Text font weight. Either normal or bold.
281
- * @type {shaka.text.Cue.fontWeight}
282
- * @exportDoc
283
- */
284
- this.fontWeight;
285
-
286
- /**
287
- * Text font style. Normal, italic or oblique.
288
- * @type {shaka.text.Cue.fontStyle}
289
- * @exportDoc
290
- */
291
- this.fontStyle;
292
-
293
- /**
294
- * Text font family.
295
- * @type {string}
296
- * @exportDoc
297
- */
298
- this.fontFamily;
299
-
300
- /**
301
- * Text shadow color as a CSS text-shadow value.
302
- * @type {string}
303
- * @exportDoc
304
- */
305
- this.textShadow = '';
306
-
307
- /**
308
- * Text stroke color as a CSS color, e.g. "#FFFFFF" or "white".
309
- * @type {string}
310
- * @exportDoc
311
- */
312
- this.textStrokeColor;
313
-
314
- /**
315
- * Text stroke width as a CSS stroke-width value.
316
- * @type {string}
317
- * @exportDoc
318
- */
319
- this.textStrokeWidth;
320
-
321
- /**
322
- * Text letter spacing as a CSS letter-spacing value.
323
- * @type {string}
324
- * @exportDoc
325
- */
326
- this.letterSpacing;
327
-
328
- /**
329
- * Text line padding as a CSS line-padding value.
330
- * @type {string}
331
- * @exportDoc
332
- */
333
- this.linePadding;
334
-
335
- /**
336
- * Opacity of the cue element, from 0-1.
337
- * @type {number}
338
- * @exportDoc
339
- */
340
- this.opacity;
341
-
342
- /**
343
- * Text decoration. A combination of underline, overline
344
- * and line through. Empty array means no decoration.
345
- * @type {!Array.<!shaka.text.Cue.textDecoration>}
346
- * @exportDoc
347
- */
348
- this.textDecoration;
349
-
350
- /**
351
- * Whether or not line wrapping should be applied to the cue.
352
- * @type {boolean}
353
- * @exportDoc
354
- */
355
- this.wrapLine;
356
-
357
- /**
358
- * Id of the cue.
359
- * @type {string}
360
- * @exportDoc
361
- */
362
- this.id;
363
-
364
- /**
365
- * Nested cues, which should be laid out horizontally in one block.
366
- * Top-level cues are blocks, and nested cues are inline elements.
367
- * Cues can be nested arbitrarily deeply.
368
- * @type {!Array.<!shaka.extern.Cue>}
369
- * @exportDoc
370
- */
371
- this.nestedCues;
372
-
373
- /**
374
- * If true, this represents a container element that is "above" the main
375
- * cues. For example, the <body> and <div> tags that contain the <p> tags
376
- * in a TTML file. This controls the flow of the final cues; any nested cues
377
- * within an "isContainer" cue will be laid out as separate lines.
378
- * @type {boolean}
379
- * @exportDoc
380
- */
381
- this.isContainer;
382
-
383
- /**
384
- * Whether or not the cue only acts as a line break between two nested cues.
385
- * Should only appear in nested cues.
386
- * @type {boolean}
387
- * @exportDoc
388
- */
389
- this.lineBreak;
390
- }
391
- };
392
-
393
-
394
13
  /**
395
14
  * An interface for plugins that parse text tracks.
396
15
  *
@@ -417,7 +36,7 @@ shaka.extern.TextParser = class {
417
36
  * @param {shaka.extern.TextParser.TimeContext} timeContext
418
37
  * The time information that should be used to adjust the times values
419
38
  * for each cue.
420
- * @return {!Array.<!shaka.extern.Cue>}
39
+ * @return {!Array.<!shaka.text.Cue>}
421
40
  *
422
41
  * @exportDoc
423
42
  */
@@ -0,0 +1,60 @@
1
+ /**
2
+ * @fileoverview Externs for Transmuxer.
3
+ *
4
+ * @externs
5
+ */
6
+
7
+
8
+ /**
9
+ * An interface for transmuxer plugins.
10
+ *
11
+ * @interface
12
+ * @exportDoc
13
+ */
14
+ shaka.extern.Transmuxer = class {
15
+ /**
16
+ * Destroy
17
+ */
18
+ destroy() {}
19
+
20
+ /**
21
+ * Check if the mime type and the content type is supported.
22
+ * @param {string} mimeType
23
+ * @param {string=} contentType
24
+ * @return {boolean}
25
+ */
26
+ isSupported(mimeType, contentType) {}
27
+
28
+ /**
29
+ * For any stream, convert its codecs to MP4 codecs.
30
+ * @param {string} contentType
31
+ * @param {string} mimeType
32
+ * @return {string}
33
+ */
34
+ convertCodecs(contentType, mimeType) {}
35
+
36
+ /**
37
+ * Returns the original mimetype of the transmuxer.
38
+ * @return {string}
39
+ */
40
+ getOrginalMimeType() {}
41
+
42
+ /**
43
+ * Transmux a input data to MP4.
44
+ * @param {BufferSource} data
45
+ * @param {shaka.extern.Stream} stream
46
+ * @param {?shaka.media.SegmentReference} reference The segment reference, or
47
+ * null for init segments
48
+ * @param {number} duration
49
+ * @param {string} contentType
50
+ * @return {!Promise.<!Uint8Array>}
51
+ */
52
+ transmux(data, stream, reference, duration, contentType) {}
53
+ };
54
+
55
+
56
+ /**
57
+ * @typedef {function():!shaka.extern.Transmuxer}
58
+ * @exportDoc
59
+ */
60
+ shaka.extern.TransmuxerPlugin;
package/karma.conf.js CHANGED
@@ -194,6 +194,9 @@ module.exports = (config) => {
194
194
  // muxjs module next
195
195
  'node_modules/mux.js/dist/mux.min.js',
196
196
 
197
+ // codem-isoboxer module next
198
+ 'node_modules/codem-isoboxer/dist/iso_boxer.min.js',
199
+
197
200
  // EME encryption scheme polyfill, compiled into Shaka Player, but outside
198
201
  // of the Closure deps system, so not in shaka-player.uncompiled.js. This
199
202
  // is specifically the compiled, minified, cross-browser build of it.
@@ -234,6 +237,16 @@ module.exports = (config) => {
234
237
  {pattern: 'test/**/*.js', included: false},
235
238
  {pattern: 'test/test/assets/*', included: false},
236
239
  {pattern: 'test/test/assets/3675/*', included: false},
240
+ {pattern: 'test/test/assets/hls-raw-aac/*', included: false},
241
+ {pattern: 'test/test/assets/hls-raw-ac3/*', included: false},
242
+ {pattern: 'test/test/assets/hls-raw-ec3/*', included: false},
243
+ {pattern: 'test/test/assets/hls-raw-mp3/*', included: false},
244
+ {pattern: 'test/test/assets/hls-ts-aac/*', included: false},
245
+ {pattern: 'test/test/assets/hls-ts-ac3/*', included: false},
246
+ {pattern: 'test/test/assets/hls-ts-ec3/*', included: false},
247
+ {pattern: 'test/test/assets/hls-ts-h264/*', included: false},
248
+ {pattern: 'test/test/assets/hls-ts-mp3/*', included: false},
249
+ {pattern: 'test/test/assets/hls-ts-muxed-aac-h264/*', included: false},
237
250
  {pattern: 'dist/shaka-player.ui.js', included: false},
238
251
  {pattern: 'dist/locales.js', included: false},
239
252
  {pattern: 'demo/**/*.js', included: false},
@@ -64,7 +64,8 @@ shaka.abr.SimpleAbrManager = class {
64
64
  }
65
65
  const chosenVariant = this.chooseVariant();
66
66
  if (chosenVariant) {
67
- this.switch_(chosenVariant);
67
+ this.switch_(chosenVariant, this.config_.clearBufferSwitch,
68
+ this.config_.safeMarginSwitch);
68
69
  }
69
70
  }
70
71
  };
@@ -106,7 +107,8 @@ shaka.abr.SimpleAbrManager = class {
106
107
  if (this.config_.restrictToElementSize) {
107
108
  const chosenVariant = this.chooseVariant();
108
109
  if (chosenVariant) {
109
- this.switch_(chosenVariant);
110
+ this.switch_(chosenVariant, this.config_.clearBufferSwitch,
111
+ this.config_.safeMarginSwitch);
110
112
  }
111
113
  }
112
114
  });
@@ -382,7 +384,8 @@ shaka.abr.SimpleAbrManager = class {
382
384
  'Calling switch_(), bandwidth=' + currentBandwidthKbps + ' kbps');
383
385
  // If any of these chosen streams are already chosen, Player will filter
384
386
  // them out before passing the choices on to StreamingEngine.
385
- this.switch_(chosenVariant);
387
+ this.switch_(chosenVariant, this.config_.clearBufferSwitch,
388
+ this.config_.safeMarginSwitch);
386
389
  }
387
390
  }
388
391
 
@@ -7,6 +7,7 @@
7
7
 
8
8
  goog.provide('shaka.ads.AdManager');
9
9
 
10
+ goog.require('goog.asserts');
10
11
  goog.require('shaka.Player');
11
12
  goog.require('shaka.ads.AdsStats');
12
13
  goog.require('shaka.ads.ClientSideAdManager');
@@ -314,6 +315,17 @@ goog.require('shaka.util.IReleasable');
314
315
  */
315
316
 
316
317
 
318
+ /**
319
+ * @event shaka.ads.AdManager.AD_ERROR
320
+ * @description Fired when a fatal error is encountered.
321
+ * @property {string} type
322
+ * 'ad-error'
323
+ * @property {Object} originalEvent
324
+ * The native SDK event, if available.
325
+ * @exportDoc
326
+ */
327
+
328
+
317
329
  /**
318
330
  * @event shaka.ads.AdManager.AdInteractionEvent
319
331
  * @description Fired when an ad triggers the interaction callback.
@@ -374,6 +386,8 @@ shaka.ads.AdManager = class extends shaka.util.FakeEventTarget {
374
386
  this.stats_ = new shaka.ads.AdsStats();
375
387
  /** @private {string} locale */
376
388
  this.locale_ = navigator.language;
389
+ /** @private {?shaka.extern.AdsConfiguration} */
390
+ this.config_ = null;
377
391
  }
378
392
 
379
393
 
@@ -390,7 +404,22 @@ shaka.ads.AdManager = class extends shaka.util.FakeEventTarget {
390
404
  * @override
391
405
  * @export
392
406
  */
393
- initClientSide(adContainer, video) {
407
+ configure(config) {
408
+ this.config_ = config;
409
+ if (this.csAdManager_) {
410
+ this.csAdManager_.configure(this.config_);
411
+ }
412
+ if (this.ssAdManager_) {
413
+ this.ssAdManager_.configure(this.config_);
414
+ }
415
+ }
416
+
417
+
418
+ /**
419
+ * @override
420
+ * @export
421
+ */
422
+ initClientSide(adContainer, video, adsRenderingSettings) {
394
423
  // Check that Client Side IMA SDK has been included
395
424
  // NOTE: (window['google'] && google.ima) check for any
396
425
  // IMA SDK, including SDK for Server Side ads.
@@ -409,7 +438,7 @@ shaka.ads.AdManager = class extends shaka.util.FakeEventTarget {
409
438
  }
410
439
 
411
440
  this.csAdManager_ = new shaka.ads.ClientSideAdManager(
412
- adContainer, video, this.locale_,
441
+ adContainer, video, this.locale_, adsRenderingSettings,
413
442
  (e) => {
414
443
  const event = /** @type {!shaka.util.FakeEvent} */ (e);
415
444
  if (event && event.type) {
@@ -432,6 +461,9 @@ shaka.ads.AdManager = class extends shaka.util.FakeEventTarget {
432
461
  }
433
462
  this.dispatchEvent(event);
434
463
  });
464
+
465
+ goog.asserts.assert(this.config_, 'Config must not be null!');
466
+ this.csAdManager_.configure(this.config_);
435
467
  }
436
468
 
437
469
 
@@ -487,6 +519,22 @@ shaka.ads.AdManager = class extends shaka.util.FakeEventTarget {
487
519
  }
488
520
 
489
521
 
522
+ /**
523
+ * @override
524
+ * @export
525
+ */
526
+ updateClientSideAdsRenderingSettings(adsRenderingSettings) {
527
+ if (!this.csAdManager_) {
528
+ throw new shaka.util.Error(
529
+ shaka.util.Error.Severity.RECOVERABLE,
530
+ shaka.util.Error.Category.ADS,
531
+ shaka.util.Error.Code.CS_AD_MANAGER_NOT_INITIALIZED);
532
+ }
533
+
534
+ this.csAdManager_.updateAdsRenderingSettings(adsRenderingSettings);
535
+ }
536
+
537
+
490
538
  /**
491
539
  * @override
492
540
  * @export
@@ -533,6 +581,9 @@ shaka.ads.AdManager = class extends shaka.util.FakeEventTarget {
533
581
  }
534
582
  this.dispatchEvent(event);
535
583
  });
584
+
585
+ goog.asserts.assert(this.config_, 'Config must not be null!');
586
+ this.ssAdManager_.configure(this.config_);
536
587
  }
537
588
 
538
589
 
@@ -902,6 +953,13 @@ shaka.ads.AdManager.AD_METADATA = 'ad-metadata';
902
953
  */
903
954
  shaka.ads.AdManager.AD_RECOVERABLE_ERROR = 'ad-recoverable-error';
904
955
 
956
+ /**
957
+ * The event name for when the ad manager dispatch errors.
958
+ *
959
+ * @const {string}
960
+ * @export
961
+ */
962
+ shaka.ads.AdManager.AD_ERROR = 'ad-error';
905
963
 
906
964
  /**
907
965
  * The event name for when the client side SDK signalled its readiness