shaka-player 4.4.3 → 4.6.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 (307) hide show
  1. package/.github/ISSUE_TEMPLATE/bug_report.md +1 -1
  2. package/.github/workflows/release-please.yaml +2 -27
  3. package/AUTHORS +2 -0
  4. package/CHANGELOG.md +156 -39
  5. package/CODE_OF_CONDUCT.md +1 -1
  6. package/CONTRIBUTORS +2 -0
  7. package/README.md +54 -42
  8. package/demo/asset_card.js +18 -21
  9. package/demo/cast_receiver/index.html +0 -1
  10. package/demo/close_button.js +0 -3
  11. package/demo/common/asset.js +33 -22
  12. package/demo/common/assets.js +249 -60
  13. package/demo/config.js +219 -253
  14. package/demo/custom.js +88 -133
  15. package/demo/front.js +7 -10
  16. package/demo/index.html +19 -22
  17. package/demo/input.js +6 -11
  18. package/demo/input_container.js +8 -9
  19. package/demo/main.js +62 -126
  20. package/demo/search.js +29 -34
  21. package/demo/service_worker.js +0 -3
  22. package/demo/tooltip.js +3 -5
  23. package/demo/visualizer.js +3 -5
  24. package/demo/visualizer_button.js +1 -20
  25. package/dist/controls.css +1 -1
  26. package/dist/controls.css.map +1 -1
  27. package/dist/demo.compiled.debug.js +211 -228
  28. package/dist/demo.compiled.debug.map +4 -4
  29. package/dist/demo.compiled.js +211 -228
  30. package/dist/demo.compiled.map +4 -4
  31. package/dist/deps.js +42 -37
  32. package/dist/locales.js +34 -30
  33. package/dist/receiver.compiled.debug.js +64 -77
  34. package/dist/receiver.compiled.debug.map +4 -4
  35. package/dist/receiver.compiled.js +64 -77
  36. package/dist/receiver.compiled.map +4 -4
  37. package/dist/shaka-player.compiled.d.ts +343 -151
  38. package/dist/shaka-player.compiled.debug.d.ts +343 -151
  39. package/dist/shaka-player.compiled.debug.externs.js +356 -117
  40. package/dist/shaka-player.compiled.debug.js +952 -811
  41. package/dist/shaka-player.compiled.debug.map +4 -4
  42. package/dist/shaka-player.compiled.externs.js +356 -117
  43. package/dist/shaka-player.compiled.js +1165 -1078
  44. package/dist/shaka-player.compiled.map +4 -4
  45. package/dist/shaka-player.ui.d.ts +359 -153
  46. package/dist/shaka-player.ui.debug.d.ts +359 -153
  47. package/dist/shaka-player.ui.debug.externs.js +382 -117
  48. package/dist/shaka-player.ui.debug.js +1084 -918
  49. package/dist/shaka-player.ui.debug.map +4 -4
  50. package/dist/shaka-player.ui.externs.js +382 -117
  51. package/dist/shaka-player.ui.js +1377 -1274
  52. package/dist/shaka-player.ui.map +4 -4
  53. package/docs/design/lcevc-integration.md +14 -14
  54. package/docs/tutorials/ad_monetization.md +54 -0
  55. package/docs/tutorials/basic-usage.md +2 -1
  56. package/docs/tutorials/errors.md +2 -1
  57. package/docs/tutorials/faq.md +27 -55
  58. package/docs/tutorials/index.json +2 -1
  59. package/docs/tutorials/lcevc.md +118 -0
  60. package/docs/tutorials/offline.md +10 -8
  61. package/docs/tutorials/plugins.md +5 -0
  62. package/docs/tutorials/ui-customization.md +17 -0
  63. package/docs/tutorials/ui.md +2 -1
  64. package/docs/tutorials/upgrade.md +3 -0
  65. package/externs/css_style_declaration.js +19 -0
  66. package/externs/lcevc.js +37 -13
  67. package/externs/managedmediasource.js +24 -0
  68. package/externs/media_remote.js +68 -0
  69. package/externs/mediatailor.js +193 -0
  70. package/externs/pictureinpicture.js +11 -0
  71. package/externs/shaka/abr_manager.js +6 -2
  72. package/externs/shaka/ads.js +27 -0
  73. package/externs/shaka/cea.js +7 -0
  74. package/externs/shaka/codecs.js +5 -3
  75. package/externs/shaka/manifest.js +31 -10
  76. package/externs/shaka/manifest_parser.js +24 -1
  77. package/externs/shaka/net.js +2 -2
  78. package/externs/shaka/offline.js +13 -2
  79. package/externs/shaka/player.js +65 -8
  80. package/externs/shaka/text.js +3 -1
  81. package/externs/shaka/transmuxer.js +1 -1
  82. package/karma.conf.js +7 -3
  83. package/lib/abr/simple_abr_manager.js +66 -9
  84. package/lib/ads/ad_manager.js +104 -50
  85. package/lib/ads/media_tailor_ad.js +297 -0
  86. package/lib/ads/media_tailor_ad_manager.js +839 -0
  87. package/lib/cast/cast_receiver.js +1 -1
  88. package/lib/cea/cea_decoder.js +28 -0
  89. package/lib/cea/dummy_caption_decoder.js +5 -0
  90. package/lib/cea/ts_cea_parser.js +15 -2
  91. package/lib/config/codec_switching_strategy.js +24 -0
  92. package/lib/dash/content_protection.js +120 -2
  93. package/lib/dash/dash_parser.js +322 -93
  94. package/lib/dash/mpd_utils.js +62 -37
  95. package/lib/dash/segment_base.js +17 -10
  96. package/lib/dash/segment_list.js +18 -9
  97. package/lib/dash/segment_template.js +122 -107
  98. package/lib/dependencies/all.js +8 -7
  99. package/lib/hls/hls_classes.js +28 -43
  100. package/lib/hls/hls_parser.js +798 -658
  101. package/lib/hls/hls_utils.js +64 -5
  102. package/lib/hls/manifest_text_parser.js +7 -11
  103. package/lib/lcevc/lcevc_dec.js +220 -0
  104. package/lib/media/adaptation_set.js +32 -14
  105. package/lib/media/adaptation_set_criteria.js +86 -16
  106. package/lib/media/closed_caption_parser.js +13 -0
  107. package/lib/media/content_workarounds.js +6 -0
  108. package/lib/media/drm_engine.js +8 -13
  109. package/lib/media/manifest_parser.js +8 -113
  110. package/lib/media/media_source_capabilities.js +10 -3
  111. package/lib/media/media_source_engine.js +286 -44
  112. package/lib/media/play_rate_controller.js +8 -38
  113. package/lib/media/presentation_timeline.js +7 -1
  114. package/lib/media/quality_observer.js +1 -1
  115. package/lib/media/segment_index.js +6 -6
  116. package/lib/media/segment_prefetch.js +92 -24
  117. package/lib/media/segment_reference.js +73 -7
  118. package/lib/media/segment_utils.js +343 -0
  119. package/lib/media/stall_detector.js +0 -3
  120. package/lib/media/streaming_engine.js +73 -38
  121. package/lib/mss/mss_parser.js +19 -2
  122. package/lib/net/networking_engine.js +67 -12
  123. package/lib/net/networking_utils.js +95 -0
  124. package/lib/offline/indexeddb/v1_storage_cell.js +3 -0
  125. package/lib/offline/indexeddb/v2_storage_cell.js +3 -0
  126. package/lib/offline/manifest_converter.js +3 -0
  127. package/lib/offline/offline_manifest_parser.js +10 -0
  128. package/lib/offline/storage.js +14 -7
  129. package/lib/player.js +1098 -1537
  130. package/lib/polyfill/mediasource.js +22 -1
  131. package/lib/text/cue.js +15 -0
  132. package/lib/text/mp4_ttml_parser.js +2 -2
  133. package/lib/text/srt_text_parser.js +2 -2
  134. package/lib/text/stub_text_displayer.js +51 -0
  135. package/lib/text/text_engine.js +3 -2
  136. package/lib/text/ttml_text_parser.js +45 -5
  137. package/lib/text/ui_text_displayer.js +8 -0
  138. package/lib/text/vtt_text_parser.js +40 -22
  139. package/lib/transmuxer/aac_transmuxer.js +1 -1
  140. package/lib/transmuxer/ac3_transmuxer.js +1 -1
  141. package/lib/transmuxer/ec3_transmuxer.js +1 -1
  142. package/lib/transmuxer/h264.js +5 -4
  143. package/lib/transmuxer/h265.js +863 -0
  144. package/lib/transmuxer/mp3_transmuxer.js +1 -1
  145. package/lib/transmuxer/mpeg_ts_transmuxer.js +4 -3
  146. package/lib/transmuxer/mss_transmuxer.js +1 -1
  147. package/lib/transmuxer/ts_transmuxer.js +187 -22
  148. package/lib/util/buffer_utils.js +26 -4
  149. package/lib/util/content_steering_manager.js +358 -0
  150. package/lib/util/error.js +30 -15
  151. package/lib/util/exp_golomb.js +30 -2
  152. package/lib/util/fairplay_utils.js +1 -1
  153. package/lib/util/fake_event.js +8 -1
  154. package/lib/util/id3_utils.js +50 -1
  155. package/lib/util/manifest_parser_utils.js +12 -8
  156. package/lib/util/mp4_generator.js +6 -8
  157. package/lib/util/mutex.js +59 -0
  158. package/lib/util/object_utils.js +1 -1
  159. package/lib/util/periods.js +156 -179
  160. package/lib/util/platform.js +44 -3
  161. package/lib/util/player_configuration.js +43 -6
  162. package/lib/util/state_history.js +6 -2
  163. package/lib/util/stream_utils.js +206 -283
  164. package/lib/util/ts_parser.js +335 -98
  165. package/lib/util/uint8array_utils.js +5 -1
  166. package/lib/util/xml_utils.js +5 -0
  167. package/maintained-branches.md +3 -2
  168. package/package.json +4 -6
  169. package/roadmap.md +25 -5
  170. package/shaka-player.uncompiled.js +2 -2
  171. package/support.html +0 -1
  172. package/test/abr/simple_abr_manager_unit.js +33 -33
  173. package/test/ads/ad_manager_unit.js +3 -2
  174. package/test/cast/cast_receiver_integration.js +50 -4
  175. package/test/cast/cast_utils_unit.js +2 -0
  176. package/test/cea/cea_decoder_unit.js +7 -0
  177. package/test/codec_switching/codec_switching_integration.js +182 -0
  178. package/test/dash/dash_parser_content_protection_unit.js +2 -0
  179. package/test/dash/dash_parser_integration.js +74 -0
  180. package/test/dash/dash_parser_live_unit.js +2 -19
  181. package/test/dash/dash_parser_manifest_unit.js +536 -2
  182. package/test/dash/dash_parser_segment_base_unit.js +2 -0
  183. package/test/dash/dash_parser_segment_list_unit.js +2 -0
  184. package/test/dash/dash_parser_segment_template_unit.js +2 -0
  185. package/test/dash/mpd_utils_unit.js +61 -30
  186. package/test/demo/demo_unit.js +0 -16
  187. package/test/hls/hls_live_unit.js +14 -3
  188. package/test/hls/hls_parser_unit.js +385 -33
  189. package/test/hls/manifest_text_parser_unit.js +32 -99
  190. package/test/media/adaptation_set_criteria_unit.js +284 -15
  191. package/test/media/adaptation_set_unit.js +2 -0
  192. package/test/media/content_workarounds_unit.js +1 -1
  193. package/test/media/drm_engine_unit.js +3 -3
  194. package/test/media/media_source_engine_unit.js +166 -2
  195. package/test/media/play_rate_controller_unit.js +0 -48
  196. package/test/media/segment_index_unit.js +5 -4
  197. package/test/media/segment_prefetch_unit.js +1 -1
  198. package/test/media/streaming_engine_unit.js +17 -17
  199. package/test/mss/mss_parser_unit.js +2 -0
  200. package/test/mss/mss_player_integration.js +3 -2
  201. package/test/net/networking_engine_unit.js +3 -3
  202. package/test/{media/manifest_parser_unit.js → net/networking_utils_unit.js} +2 -2
  203. package/test/offline/manifest_convert_unit.js +14 -0
  204. package/test/offline/offline_integration.js +2 -1
  205. package/test/offline/storage_integration.js +22 -13
  206. package/test/player_external.js +4 -2
  207. package/test/player_integration.js +15 -4
  208. package/test/player_load_graph_integration.js +47 -151
  209. package/test/player_src_equals_external.js +1 -0
  210. package/test/player_src_equals_integration.js +71 -4
  211. package/test/player_unit.js +182 -158
  212. package/test/test/assets/dash-aes-128/Fragments(video=0,format=mpd-time-csf) +0 -0
  213. package/test/test/assets/dash-aes-128/Fragments(video=20000000,format=mpd-time-csf) +0 -0
  214. package/test/test/assets/dash-aes-128/Fragments(video=40000000,format=mpd-time-csf) +0 -0
  215. package/test/test/assets/dash-aes-128/Fragments(video=60000000,format=mpd-time-csf) +0 -0
  216. package/test/test/assets/dash-aes-128/Fragments(video=i,format=mpd-time-csf) +0 -0
  217. package/test/test/assets/dash-aes-128/dash.mpd +18 -0
  218. package/test/test/assets/dash-aes-128/license +1 -0
  219. package/test/test/assets/dash-multi-codec/audio_en_2c_128k_aac.mp4 +0 -0
  220. package/test/test/assets/dash-multi-codec/audio_es_2c_64k_opus.webm +0 -0
  221. package/test/test/assets/dash-multi-codec/dash.mpd +32 -0
  222. package/test/test/assets/dash-multi-codec/video_144p_108k_h264.mp4 +0 -0
  223. package/test/test/assets/hls-ts-h265/0.ts +0 -0
  224. package/test/test/assets/hls-ts-h265/hevc.m3u8 +6 -0
  225. package/test/test/assets/hls-ts-h265/index.m3u8 +7 -0
  226. package/test/test/assets/hls-ts-muxed-aac-h265/0.ts +0 -0
  227. package/test/test/assets/hls-ts-muxed-aac-h265/1.ts +0 -0
  228. package/test/test/assets/hls-ts-muxed-aac-h265/media.m3u8 +9 -0
  229. package/test/test/assets/hls-ts-muxed-ac3-h264/media.m3u8 +24 -0
  230. package/test/test/assets/hls-ts-muxed-ac3-h264/s_00000.ts +0 -0
  231. package/test/test/assets/hls-ts-muxed-ac3-h264/s_00001.ts +0 -0
  232. package/test/test/assets/hls-ts-muxed-ac3-h264/s_00002.ts +0 -0
  233. package/test/test/assets/hls-ts-muxed-ac3-h264/s_00003.ts +0 -0
  234. package/test/test/assets/hls-ts-muxed-ac3-h264/s_00004.ts +0 -0
  235. package/test/test/assets/hls-ts-muxed-ac3-h264/s_00005.ts +0 -0
  236. package/test/test/assets/hls-ts-muxed-ec3-h264/ChID_voices_1280x720p_25fps_h264_6ch_256kbps_ddp_sub_0000.ts +0 -0
  237. package/test/test/assets/hls-ts-muxed-ec3-h264/ChID_voices_1280x720p_25fps_h264_6ch_256kbps_ddp_sub_0001.ts +0 -0
  238. package/test/test/assets/hls-ts-muxed-ec3-h264/ChID_voices_1280x720p_25fps_h264_6ch_256kbps_ddp_sub_0002.ts +0 -0
  239. package/test/test/assets/hls-ts-muxed-ec3-h264/ChID_voices_1280x720p_25fps_h264_6ch_256kbps_ddp_sub_0003.ts +0 -0
  240. package/test/test/assets/hls-ts-muxed-ec3-h264/prog_index.m3u8 +14 -0
  241. package/test/test/assets/hls-ts-muxed-mp3-h264/index.m3u8 +23 -0
  242. package/test/test/assets/hls-ts-muxed-mp3-h264/seg-1-v1-a1.ts +0 -0
  243. package/test/test/assets/hls-ts-muxed-mp3-h264/seg-2-v1-a1.ts +0 -0
  244. package/test/test/assets/hls-ts-muxed-mp3-h264/seg-3-v1-a1.ts +0 -0
  245. package/test/test/assets/hls-ts-muxed-mp3-h264/seg-4-v1-a1.ts +0 -0
  246. package/test/test/assets/hls-ts-muxed-mp3-h264/seg-5-v1-a1.ts +0 -0
  247. package/test/test/assets/hls-ts-muxed-mp3-h264/seg-6-v1-a1.ts +0 -0
  248. package/test/test/assets/hls-ts-muxed-mp3-h264/seg-7-v1-a1.ts +0 -0
  249. package/test/test/assets/hls-ts-muxed-mp3-h264/seg-8-v1-a1.ts +0 -0
  250. package/test/test/util/dash_parser_util.js +4 -0
  251. package/test/test/util/fake_ad_manager.js +20 -0
  252. package/test/test/util/fake_media_source_engine.js +13 -2
  253. package/test/test/util/fake_networking_engine.js +9 -1
  254. package/test/test/util/fake_segment_prefetch.js +3 -0
  255. package/test/test/util/manifest_generator.js +11 -3
  256. package/test/test/util/manifest_parser_util.js +14 -2
  257. package/test/test/util/mss_parser_util.js +4 -0
  258. package/test/test/util/offline_utils.js +2 -0
  259. package/test/test/util/simple_fakes.js +2 -2
  260. package/test/test/util/streaming_engine_util.js +10 -4
  261. package/test/test/util/test_scheme.js +6 -0
  262. package/test/test/util/ui_utils.js +4 -3
  263. package/test/text/mp4_ttml_parser_unit.js +4 -4
  264. package/test/text/srt_text_parser_unit.js +1 -1
  265. package/test/text/text_displayer_layout_unit.js +1 -1
  266. package/test/text/text_engine_unit.js +6 -0
  267. package/test/text/ttml_text_parser_unit.js +85 -2
  268. package/test/text/vtt_text_parser_unit.js +103 -31
  269. package/test/transmuxer/transmuxer_engine_integration.js +9 -0
  270. package/test/transmuxer/transmuxer_integration.js +150 -3
  271. package/test/ui/ad_ui_unit.js +2 -2
  272. package/test/ui/ui_customization_unit.js +17 -16
  273. package/test/ui/ui_integration.js +30 -20
  274. package/test/ui/ui_unit.js +28 -29
  275. package/test/util/buffer_utils_unit.js +1 -1
  276. package/test/util/content_steering_manager_unit.js +427 -0
  277. package/test/util/id3_utils_unit.js +52 -0
  278. package/test/util/stream_utils_unit.js +207 -169
  279. package/test/util/ts_parser_unit.js +3 -3
  280. package/third_party/closure-uri/uri.js +13 -1
  281. package/ui/audio_language_selection.js +9 -2
  282. package/ui/controls.js +125 -0
  283. package/ui/externs/ui.js +24 -2
  284. package/ui/language_utils.js +43 -8
  285. package/ui/less/range_elements.less +33 -0
  286. package/ui/locales/en.json +1 -0
  287. package/ui/locales/es-419.json +1 -0
  288. package/ui/locales/es.json +1 -0
  289. package/ui/locales/source.json +4 -0
  290. package/ui/localization.js +10 -0
  291. package/ui/pip_button.js +22 -120
  292. package/ui/remote_button.js +203 -0
  293. package/ui/resolution_selection.js +47 -10
  294. package/ui/seek_bar.js +296 -3
  295. package/ui/text_selection.js +2 -1
  296. package/ui/ui.js +11 -4
  297. package/demo/common/message_ids.js +0 -309
  298. package/demo/locales/en.json +0 -288
  299. package/demo/locales/source.json +0 -1146
  300. package/externs/mux.js +0 -69
  301. package/lib/lcevc/lcevc_dil.js +0 -152
  302. package/lib/routing/node.js +0 -23
  303. package/lib/routing/payload.js +0 -43
  304. package/lib/routing/walker.js +0 -587
  305. package/lib/transmuxer/muxjs_transmuxer.js +0 -242
  306. package/test/routing/walker_unit.js +0 -504
  307. package/test/transmuxer/muxjs_transmuxer_integration.js +0 -177
package/externs/lcevc.js CHANGED
@@ -1,25 +1,27 @@
1
1
  /**
2
- * @fileoverview Externs for LcevcDil
2
+ * @fileoverview Externs for LcevcDec
3
3
  * compiler.
4
4
  *
5
5
  * @externs
6
6
  */
7
7
 
8
- // This empty namespace is declared to check if LcevcDil libraries are loaded.
8
+ // This empty namespace is declared to check if LcevcDec libraries are loaded.
9
+ /** @const */
9
10
  var libDPIModule = {};
10
- var LcevcDil = {};
11
+ /** @const */
12
+ var LCEVCdec = {};
11
13
 
12
14
  /**
13
- * LCEVC DIL constructor
15
+ * LCEVC Dec constructor
14
16
  * @constructor
15
17
  */
16
- LcevcDil.LcevcDIL = class {
18
+ LCEVCdec.LCEVCdec = class {
17
19
  /**
18
20
  * @param {HTMLVideoElement} media
19
21
  * @param {HTMLCanvasElement} canvas
20
- * @param {shaka.extern.LcevcConfiguration} dilConfig
22
+ * @param {shaka.extern.LcevcConfiguration} lcevcConfig
21
23
  */
22
- constructor(media, canvas, dilConfig) {
24
+ constructor(media, canvas, lcevcConfig) {
23
25
  }
24
26
 
25
27
  /**
@@ -30,13 +32,14 @@ LcevcDil.LcevcDIL = class {
30
32
  * @param {!BufferSource} data Video Buffer Data.
31
33
  * @param {string} type Type of Video Buffer Data.
32
34
  * @param {number} variantId Variant that the fragment belongs to.
35
+ * @param {number} timestampOffset Timestamp offset for appended segments
33
36
  */
34
- appendBuffer(data, type, variantId) {}
37
+ appendBuffer(data, type, variantId, timestampOffset) {}
35
38
 
36
39
  /**
37
40
  * Set current variant as variantId to the LCEVC decoder
38
41
  * @param {!number} variantId
39
- * @param {!boolean} autoBufferSwitch is lcevcDil mode that switches variant
42
+ * @param {!boolean} autoBufferSwitch is lcevcDec mode that switches variant
40
43
  * when the downloaded buffer from last variant has finished playing and
41
44
  * buffers from the new variant starts to play.
42
45
  */
@@ -49,15 +52,28 @@ LcevcDil.LcevcDIL = class {
49
52
  setContainerFormat(containerFormat) {}
50
53
 
51
54
  /**
52
- * Close LCEVC DIL
55
+ * Set streaming Format for LCEVC Data Parsing.
56
+ * @param {!number} streamingFormat container type of the stream.
57
+ */
58
+ setStreamingFormat(streamingFormat) {}
59
+
60
+ /**
61
+ * Close LCEVC DEC
53
62
  */
54
63
  close() {}
55
64
  };
56
65
 
66
+ /**
67
+ * The older module interface, for backward compatibility.
68
+ * Typed to the same interface, but under a different name.
69
+ * @type {typeof LCEVCdec.LCEVCdec}
70
+ */
71
+ LCEVCdec.LcevcDil;
72
+
57
73
  /**
58
74
  * LCEVC Support Check
59
75
  */
60
- LcevcDil.SupportObject = {
76
+ LCEVCdec.SupportObject = {
61
77
 
62
78
  /**
63
79
  * Check if canvas has WebGL support
@@ -72,10 +88,18 @@ LcevcDil.SupportObject = {
72
88
  * LCEVC Support Checklist Result
73
89
  * @type {boolean}
74
90
  */
75
- LcevcDil.SupportObject.SupportStatus;
91
+ LCEVCdec.SupportObject.SupportStatus;
76
92
 
77
93
  /**
78
94
  * LCEVC Support CheckList Error if any.
79
95
  * @type {string}
80
96
  */
81
- LcevcDil.SupportObject.SupportError;
97
+ LCEVCdec.SupportObject.SupportError;
98
+
99
+ /**
100
+ * Typedef for the module interface. Both LCEVCdec (new module) and LcevcDil
101
+ * (old module) implement roughly the same interface.
102
+ *
103
+ * @typedef {typeof LCEVCdec}
104
+ */
105
+ var LCEVCmodule;
@@ -0,0 +1,24 @@
1
+ /*! @license
2
+ * Shaka Player
3
+ * Copyright 2016 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+
7
+ /**
8
+ * @fileoverview Externs for ManagedMediaSource which were missing in the
9
+ * Closure compiler.
10
+ *
11
+ * @externs
12
+ */
13
+
14
+ /**
15
+ * @constructor
16
+ * @extends {MediaSource}
17
+ */
18
+ function ManagedMediaSource() {}
19
+
20
+ /**
21
+ * @param {string} type
22
+ * @return {boolean}
23
+ */
24
+ ManagedMediaSource.isTypeSupported = function(type) {};
@@ -0,0 +1,68 @@
1
+ /*! @license
2
+ * Shaka Player
3
+ * Copyright 2016 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+
7
+ /**
8
+ * @fileoverview Externs for HTMLMediaElement which were missing in the
9
+ * Closure compiler.
10
+ *
11
+ * @externs
12
+ */
13
+
14
+
15
+ /**
16
+ * @constructor
17
+ * @implements {EventTarget}
18
+ */
19
+ function RemotePlayback() {}
20
+
21
+
22
+ /**
23
+ * Represents the RemotePlayback connection's state.
24
+ * @type {string}
25
+ */
26
+ RemotePlayback.prototype.state;
27
+
28
+
29
+ /**
30
+ * The watchAvailability() method of the RemotePlayback interface watches
31
+ * the list of available remote playback devices and returns a Promise that
32
+ * resolves with the callbackId of a remote playback device.
33
+ *
34
+ * @param {!function(boolean)} callback
35
+ * @return {!Promise}
36
+ */
37
+ RemotePlayback.prototype.watchAvailability = function(callback) {};
38
+
39
+
40
+ /**
41
+ * The cancelWatchAvailability() method of the RemotePlayback interface
42
+ * cancels the request to watch for one or all available devices.
43
+ *
44
+ * @param {number} id
45
+ * @return {!Promise}
46
+ */
47
+ RemotePlayback.prototype.cancelWatchAvailability = function(id) {};
48
+
49
+
50
+ /**
51
+ * The prompt() method of the RemotePlayback interface prompts the user
52
+ * to select an available remote playback device and give permission
53
+ * for the current media to be played using that device.
54
+ *
55
+ * If the user gives permission, the state will be set to connecting and
56
+ * the user agent will connect to the device to initiate playback.
57
+ *
58
+ * If the user chooses to instead disconnect from the device, the state will
59
+ * be set to disconnected and user agent will disconnect from this device.
60
+ *
61
+ * @return {!Promise}
62
+ */
63
+ RemotePlayback.prototype.prompt = function() {};
64
+
65
+
66
+ /** @type {RemotePlayback} */
67
+ HTMLMediaElement.prototype.remote;
68
+
@@ -0,0 +1,193 @@
1
+ /*! @license
2
+ * Shaka Player
3
+ * Copyright 2016 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+
7
+ /**
8
+ * @fileoverview Externs for Media Tailor.
9
+ * @externs
10
+ */
11
+
12
+
13
+ /** @const */
14
+ var mediaTailor = {};
15
+
16
+
17
+ /**
18
+ * @typedef {{
19
+ * manifestUrl: ?string,
20
+ * trackingUrl: ?string
21
+ * }}
22
+ *
23
+ * @property {?string} manifestUrl
24
+ * @property {?string} trackingUrl
25
+ * @exportDoc
26
+ */
27
+ mediaTailor.SessionResponse;
28
+
29
+
30
+ /**
31
+ * @typedef {{
32
+ * avails: !Array.<mediaTailor.AdBreak>
33
+ * }}
34
+ *
35
+ * @property {!Array.<mediaTailor.AdBreak>} avails
36
+ * @exportDoc
37
+ */
38
+ mediaTailor.TrackingResponse;
39
+
40
+
41
+ /**
42
+ * @typedef {{
43
+ * adBreakTrackingEvents: !Array.<mediaTailor.TrackingEvent>,
44
+ * ads: !Array.<mediaTailor.Ad>,
45
+ * durationInSeconds: number,
46
+ * nonLinearAdsList: !Array.<mediaTailor.Ad>,
47
+ * startTimeInSeconds: number
48
+ * }}
49
+ *
50
+ * @property {!Array.<mediaTailor.TrackingEvent>} adBreakTrackingEvents
51
+ * @property {!Array.<mediaTailor.Ad>} ads
52
+ * @property {number} durationInSeconds
53
+ * @property {!Array.<mediaTailor.Ad>} nonLinearAdsList
54
+ * @property {number} startTimeInSeconds
55
+ * @exportDoc
56
+ */
57
+ mediaTailor.AdBreak;
58
+
59
+
60
+ /**
61
+ * @typedef {{
62
+ * adId: string,
63
+ * adParameters: string,
64
+ * adSystem: string,
65
+ * adTitle: string,
66
+ * creativeId: string,
67
+ * creativeSequence: string,
68
+ * durationInSeconds: number,
69
+ * skipOffset: ?number,
70
+ * startTimeInSeconds: number,
71
+ * nonLinearAdList: !Array.<mediaTailor.NonLinearAd>,
72
+ * trackingEvents: !Array.<mediaTailor.TrackingEvent>
73
+ * }}
74
+ *
75
+ * @property {string} adId
76
+ * @property {string} adParameters
77
+ * @property {string} adSystem
78
+ * @property {string} adTitle
79
+ * @property {string} creativeId
80
+ * @property {string} creativeSequence
81
+ * @property {number} durationInSeconds
82
+ * @property {?number} skipOffset
83
+ * @property {number} startTimeInSeconds
84
+ * @property {!Array.<mediaTailor.NonLinearAd>} nonLinearAdList
85
+ * @property {!Array.<mediaTailor.TrackingEvent>} trackingEvents
86
+ * @exportDoc
87
+ */
88
+ mediaTailor.Ad;
89
+
90
+
91
+ /**
92
+ * @typedef {{
93
+ * adId: string,
94
+ * adParameters: string,
95
+ * adSystem: string,
96
+ * adTitle: string,
97
+ * creativeAdId: string,
98
+ * creativeId: string,
99
+ * creativeSequence: string,
100
+ * height: ?number,
101
+ * width: ?number,
102
+ * staticResource: string
103
+ * }}
104
+ *
105
+ * @property {string} adId
106
+ * @property {string} adParameters
107
+ * @property {string} adSystem
108
+ * @property {string} adTitle
109
+ * @property {string} creativeAdId
110
+ * @property {string} creativeId
111
+ * @property {string} creativeSequence
112
+ * @property {?number} height
113
+ * @property {?number} width
114
+ * @property {string} staticResource
115
+ * @exportDoc
116
+ */
117
+ mediaTailor.NonLinearAd;
118
+
119
+
120
+ /**
121
+ * @typedef {{
122
+ * beaconUrls: !Array.<string>,
123
+ * eventType: string
124
+ * }}
125
+ *
126
+ * @property {!Array.<string>} beaconUrls
127
+ * @property {string} eventType
128
+ * @exportDoc
129
+ */
130
+ mediaTailor.TrackingEvent;
131
+
132
+
133
+ /** @const */
134
+ var mediaTailorExternalResource = {};
135
+
136
+
137
+ /**
138
+ * @typedef {{
139
+ * apps: !Array.<mediaTailorExternalResource.App>
140
+ * }}
141
+ *
142
+ * @property {!Array.<mediaTailorExternalResource.App>} apps
143
+ * @exportDoc
144
+ */
145
+ mediaTailorExternalResource.Response;
146
+
147
+
148
+ /**
149
+ * @typedef {{
150
+ * placeholder: mediaTailorExternalResource.AppPlaceholder,
151
+ * data: mediaTailorExternalResource.AppData
152
+ * }}
153
+ *
154
+ * @property {mediaTailorExternalResource.AppPlaceholder} placeholder
155
+ * @property {mediaTailorExternalResource.AppData} data
156
+ * @exportDoc
157
+ */
158
+ mediaTailorExternalResource.App;
159
+
160
+
161
+ /**
162
+ * @typedef {{
163
+ * left: number,
164
+ * top: number
165
+ * }}
166
+ *
167
+ * @property {number} left
168
+ * @property {number} top
169
+ * @exportDoc
170
+ */
171
+ mediaTailorExternalResource.AppPlaceholder;
172
+
173
+
174
+ /**
175
+ * @typedef {{
176
+ * source: !Array.<mediaTailorExternalResource.AppDataSource>
177
+ * }}
178
+ *
179
+ * @property {!Array.<mediaTailorExternalResource.AppDataSource>} source
180
+ * @exportDoc
181
+ */
182
+ mediaTailorExternalResource.AppData;
183
+
184
+
185
+ /**
186
+ * @typedef {{
187
+ * url: string
188
+ * }}
189
+ *
190
+ * @property {string} url
191
+ * @exportDoc
192
+ */
193
+ mediaTailorExternalResource.AppDataSource;
@@ -97,3 +97,14 @@ DocumentPictureInPicture.prototype.dispatchEvent = function(event) {};
97
97
  * @type {!DocumentPictureInPicture}
98
98
  */
99
99
  Window.prototype.documentPictureInPicture;
100
+
101
+
102
+ /**
103
+ * @constructor
104
+ * @extends {Event}
105
+ */
106
+ function DocumentPictureInPictureEvent() {}
107
+
108
+
109
+ /** @type {Window} */
110
+ DocumentPictureInPictureEvent.prototype.window;
@@ -60,10 +60,12 @@ shaka.extern.AbrManager = class {
60
60
 
61
61
  /**
62
62
  * Chooses one variant to switch to. Called by the Player.
63
+ * @param {boolean=} preferFastSwitching If not provided meant "avoid fast
64
+ * switching if possible".
63
65
  * @return {shaka.extern.Variant}
64
66
  * @exportDoc
65
67
  */
66
- chooseVariant() {}
68
+ chooseVariant(preferFastSwitching) {}
67
69
 
68
70
  /**
69
71
  * Enables automatic Variant choices from the last ones passed to setVariants.
@@ -88,9 +90,11 @@ shaka.extern.AbrManager = class {
88
90
  * @param {number} deltaTimeMs The duration, in milliseconds, that the request
89
91
  * took to complete.
90
92
  * @param {number} numBytes The total number of bytes transferred.
93
+ * @param {boolean} allowSwitch Indicate if the segment is allowed to switch
94
+ * to another stream.
91
95
  * @exportDoc
92
96
  */
93
- segmentDownloaded(deltaTimeMs, numBytes) {}
97
+ segmentDownloaded(deltaTimeMs, numBytes, allowSwitch) {}
94
98
 
95
99
  /**
96
100
  * Gets an estimate of the current bandwidth in bit/sec. This is used by the
@@ -94,6 +94,21 @@ shaka.extern.IAdManager = class extends EventTarget {
94
94
  */
95
95
  updateClientSideAdsRenderingSettings(adsRenderingSettings) {}
96
96
 
97
+ /**
98
+ * @param {!HTMLElement} adContainer
99
+ * @param {!shaka.net.NetworkingEngine} networkingEngine
100
+ * @param {!HTMLMediaElement} video
101
+ */
102
+ initMediaTailor(adContainer, networkingEngine, video) {}
103
+
104
+ /**
105
+ * @param {string} url
106
+ * @param {Object} adsParams
107
+ * @param {string=} backupUrl
108
+ * @return {!Promise.<string>}
109
+ */
110
+ requestMediaTailorStream(url, adsParams, backupUrl) {}
111
+
97
112
  /**
98
113
  * @param {!HTMLElement} adContainer
99
114
  * @param {!HTMLMediaElement} video
@@ -117,6 +132,11 @@ shaka.extern.IAdManager = class extends EventTarget {
117
132
  */
118
133
  getServerSideCuePoints() {}
119
134
 
135
+ /**
136
+ * @return {!Array.<!shaka.extern.AdCuePoint>}
137
+ */
138
+ getCuePoints() {}
139
+
120
140
  /**
121
141
  * Get statistics for the current playback session. If the player is not
122
142
  * playing content, this will return an empty stats object.
@@ -128,6 +148,13 @@ shaka.extern.IAdManager = class extends EventTarget {
128
148
  */
129
149
  onDashTimedMetadata(region) {}
130
150
 
151
+ /**
152
+ * Fired when the manifest is updated.
153
+ *
154
+ * @param {boolean} isLive
155
+ */
156
+ onManifestUpdated(isLive) {}
157
+
131
158
  /**
132
159
  * @param {shaka.extern.ID3Metadata} metadata
133
160
  * @param {number} timestampOffset
@@ -84,6 +84,13 @@ shaka.extern.ICaptionDecoder = class {
84
84
  * @exportDoc
85
85
  */
86
86
  clear() {}
87
+
88
+ /**
89
+ * Returns the streams that the CEA decoder found.
90
+ * @return {!Array.<string>}
91
+ * @exportDoc
92
+ */
93
+ getStreams() {}
87
94
  };
88
95
 
89
96
  /**
@@ -1,16 +1,18 @@
1
1
  /**
2
2
  * @typedef {{
3
- * data: Uint8Array,
3
+ * data: !Uint8Array,
4
4
  * packetLength: number,
5
5
  * pts: ?number,
6
- * dts: ?number
6
+ * dts: ?number,
7
+ * nalus: !Array.<!shaka.extern.VideoNalu>
7
8
  * }}
8
9
  *
9
10
  * @summary MPEG_PES.
10
- * @property {Uint8Array} data
11
+ * @property {!Uint8Array} data
11
12
  * @property {number} packetLength
12
13
  * @property {?number} pts
13
14
  * @property {?number} dts
15
+ * @property {!Array.<!shaka.extern.VideoNalu>} nalus
14
16
  */
15
17
  shaka.extern.MPEG_PES;
16
18
 
@@ -152,18 +152,26 @@ shaka.extern.InitDataOverride;
152
152
  /**
153
153
  * @typedef {{
154
154
  * maxLatency: ?number,
155
- * maxPlaybackRate: ?number
155
+ * maxPlaybackRate: ?number,
156
+ * minLatency: ?number,
157
+ * minPlaybackRate: ?number
156
158
  * }}
157
159
  *
158
160
  * @description
159
- * Maximum latency and playback rate for a manifest. When max latency is reached
160
- * playbackrate is updated to maxPlaybackRate to decrease latency.
161
+ * Maximum and minimun latency and playback rate for a manifest. When max
162
+ * latency is reached playbackrate is updated to maxPlaybackRate to decrease
163
+ * latency. When min latency is reached playbackrate is updated to
164
+ * minPlaybackRate to increase latency.
161
165
  * More information {@link https://dashif.org/docs/CR-Low-Latency-Live-r8.pdf here}.
162
166
  *
163
167
  * @property {?number} maxLatency
164
168
  * Maximum latency in seconds.
165
169
  * @property {?number} maxPlaybackRate
166
170
  * Maximum playback rate.
171
+ * @property {?number} minLatency
172
+ * Minimun latency in seconds.
173
+ * @property {?number} minPlaybackRate
174
+ * Minimun playback rate.
167
175
  *
168
176
  * @exportDoc
169
177
  */
@@ -318,10 +326,10 @@ shaka.extern.CreateSegmentIndexFunction;
318
326
  * }}
319
327
  *
320
328
  * @description
321
- * AES-128 key and iv info from the HLS manifest.
329
+ * AES-128 key and iv info from the manifest.
322
330
  *
323
331
  * @property {string} method
324
- * The key method defined in the HLS manifest.
332
+ * The key method defined in the manifest.
325
333
  * @property {webCrypto.CryptoKey|undefined} cryptoKey
326
334
  * Web crypto key object of the AES-128 CBC key. If unset, the "fetchKey"
327
335
  * property should be provided.
@@ -330,15 +338,15 @@ shaka.extern.CreateSegmentIndexFunction;
330
338
  * Should be provided if the "cryptoKey" property is unset.
331
339
  * Should update this object in-place, to set "cryptoKey".
332
340
  * @property {(!Uint8Array|undefined)} iv
333
- * The IV in the HLS manifest, if defined. See HLS RFC 8216 Section 5.2 for
334
- * handling undefined IV.
341
+ * The IV in the manifest, if defined. For HLS see HLS RFC 8216 Section 5.2
342
+ * for handling undefined IV.
335
343
  * @property {number} firstMediaSequenceNumber
336
344
  * The starting Media Sequence Number of the playlist, used when IV is
337
345
  * undefined.
338
346
  *
339
347
  * @exportDoc
340
348
  */
341
- shaka.extern.HlsAes128Key;
349
+ shaka.extern.aes128Key;
342
350
 
343
351
 
344
352
  /**
@@ -355,6 +363,7 @@ shaka.extern.FetchCryptoKeysFunction;
355
363
  * @typedef {{
356
364
  * id: number,
357
365
  * originalId: ?string,
366
+ * groupId: ?string,
358
367
  * createSegmentIndex: shaka.extern.CreateSegmentIndexFunction,
359
368
  * closeSegmentIndex: (function()|undefined),
360
369
  * segmentIndex: shaka.media.SegmentIndex,
@@ -363,6 +372,7 @@ shaka.extern.FetchCryptoKeysFunction;
363
372
  * frameRate: (number|undefined),
364
373
  * pixelAspectRatio: (string|undefined),
365
374
  * hdr: (string|undefined),
375
+ * videoLayout: (string|undefined),
366
376
  * bandwidth: (number|undefined),
367
377
  * width: (number|undefined),
368
378
  * height: (number|undefined),
@@ -389,7 +399,8 @@ shaka.extern.FetchCryptoKeysFunction;
389
399
  * (!Array.<shaka.extern.Stream>|!Array.<shaka.extern.StreamDB>|
390
400
  * undefined),
391
401
  * mssPrivateData: (shaka.extern.MssPrivateData|undefined),
392
- * external: boolean
402
+ * external: boolean,
403
+ * fastSwitching: boolean
393
404
  * }}
394
405
  *
395
406
  * @description
@@ -403,6 +414,10 @@ shaka.extern.FetchCryptoKeysFunction;
403
414
  * The original ID, if any, that appeared in the manifest. For example, in
404
415
  * DASH, this is the "id" attribute of the Representation element. In HLS,
405
416
  * this is the "NAME" attribute.
417
+ * @property {?string} groupId
418
+ * <i>Optional.</i> <br>
419
+ * The ID of the stream's parent element. In DASH, this will be a unique
420
+ * ID that represents the representation's parent adaptation element
406
421
  * @property {shaka.extern.CreateSegmentIndexFunction} createSegmentIndex
407
422
  * <i>Required.</i> <br>
408
423
  * Creates the Stream's segmentIndex (asynchronously).
@@ -429,6 +444,9 @@ shaka.extern.FetchCryptoKeysFunction;
429
444
  * @property {(string|undefined)} hdr
430
445
  * <i>Video streams only.</i> <br>
431
446
  * The Stream's HDR info
447
+ * @property {(string|undefined)} videoLayout
448
+ * <i>Video streams only.</i> <br>
449
+ * The Stream's video layout info.
432
450
  * @property {(number|undefined)} bandwidth
433
451
  * <i>Audio and video streams only.</i> <br>
434
452
  * The stream's required bandwidth in bits per second.
@@ -498,7 +516,8 @@ shaka.extern.FetchCryptoKeysFunction;
498
516
  * A map containing the description of closed captions, with the caption
499
517
  * channel number (CC1 | CC2 | CC3 | CC4) as the key and the language code
500
518
  * as the value. If the channel number is not provided by the description,
501
- * we'll set an 0-based index as the key.
519
+ * we'll set a 0-based index as the key. If the language code is not
520
+ * provided by the description we'll set the same value as channel number.
502
521
  * Example: {'CC1': 'eng'; 'CC3': 'swe'}, or {'1', 'eng'; '2': 'swe'}, etc.
503
522
  * @property {(string|undefined)} tilesLayout
504
523
  * <i>Image streams only.</i> <br>
@@ -514,6 +533,8 @@ shaka.extern.FetchCryptoKeysFunction;
514
533
  * @property {boolean} external
515
534
  * Indicate if the stream was added externally.
516
535
  * Eg: external text tracks.
536
+ * @property {boolean} fastSwitching
537
+ * Indicate if the stream should be used for fast switching.
517
538
  *
518
539
  * @exportDoc
519
540
  */
@@ -94,6 +94,23 @@ shaka.extern.ManifestParser = class {
94
94
  * @exportDoc
95
95
  */
96
96
  onExpirationUpdated(sessionId, expiration) {}
97
+
98
+ /**
99
+ * Tells the parser that the initial variant has been chosen.
100
+ *
101
+ * @param {shaka.extern.Variant} variant
102
+ * @exportDoc
103
+ */
104
+ onInitialVariantChosen(variant) {}
105
+
106
+ /**
107
+ * Tells the parser that a location should be banned. This is called on
108
+ * retry.
109
+ *
110
+ * @param {string} uri
111
+ * @exportDoc
112
+ */
113
+ banLocation(uri) {}
97
114
  };
98
115
 
99
116
 
@@ -109,7 +126,9 @@ shaka.extern.ManifestParser = class {
109
126
  * isAutoLowLatencyMode: function():boolean,
110
127
  * enableLowLatencyMode: function(),
111
128
  * updateDuration: function(),
112
- * newDrmInfo: function(shaka.extern.Stream)
129
+ * newDrmInfo: function(shaka.extern.Stream),
130
+ * onManifestUpdated: function(),
131
+ * getBandwidthEstimate: function():number
113
132
  * }}
114
133
  *
115
134
  * @description
@@ -144,6 +163,10 @@ shaka.extern.ManifestParser = class {
144
163
  * @property {function(shaka.extern.Stream)} newDrmInfo
145
164
  * Inform the player of new DRM info that needs to be processed for the given
146
165
  * stream.
166
+ * @property {function()} onManifestUpdated
167
+ * Should be called when the manifest is updated.
168
+ * @property {function():number} getBandwidthEstimate
169
+ * Get the estimated bandwidth in bits per second.
147
170
  * @exportDoc
148
171
  */
149
172
  shaka.extern.ManifestParser.PlayerInterface;