shaka-player 4.5.0 → 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 (214) hide show
  1. package/.github/ISSUE_TEMPLATE/bug_report.md +1 -1
  2. package/AUTHORS +2 -0
  3. package/CHANGELOG.md +98 -0
  4. package/CODE_OF_CONDUCT.md +1 -1
  5. package/CONTRIBUTORS +2 -0
  6. package/README.md +38 -32
  7. package/demo/common/asset.js +11 -17
  8. package/demo/common/assets.js +117 -11
  9. package/demo/config.js +28 -1
  10. package/demo/custom.js +52 -38
  11. package/demo/main.js +11 -3
  12. package/demo/search.js +7 -0
  13. package/dist/controls.css +1 -1
  14. package/dist/controls.css.map +1 -1
  15. package/dist/demo.compiled.debug.js +133 -124
  16. package/dist/demo.compiled.debug.map +3 -3
  17. package/dist/demo.compiled.js +133 -124
  18. package/dist/demo.compiled.map +3 -3
  19. package/dist/deps.js +20 -18
  20. package/dist/locales.js +35 -31
  21. package/dist/receiver.compiled.debug.js +58 -50
  22. package/dist/receiver.compiled.debug.map +3 -3
  23. package/dist/receiver.compiled.js +58 -50
  24. package/dist/receiver.compiled.map +3 -3
  25. package/dist/shaka-player.compiled.d.ts +440 -390
  26. package/dist/shaka-player.compiled.debug.d.ts +440 -390
  27. package/dist/shaka-player.compiled.debug.externs.js +162 -77
  28. package/dist/shaka-player.compiled.debug.js +786 -736
  29. package/dist/shaka-player.compiled.debug.map +4 -4
  30. package/dist/shaka-player.compiled.externs.js +162 -77
  31. package/dist/shaka-player.compiled.js +1154 -1121
  32. package/dist/shaka-player.compiled.map +4 -4
  33. package/dist/shaka-player.ui.d.ts +491 -437
  34. package/dist/shaka-player.ui.debug.d.ts +491 -437
  35. package/dist/shaka-player.ui.debug.externs.js +167 -77
  36. package/dist/shaka-player.ui.debug.js +877 -811
  37. package/dist/shaka-player.ui.debug.map +4 -4
  38. package/dist/shaka-player.ui.externs.js +167 -77
  39. package/dist/shaka-player.ui.js +1362 -1318
  40. package/dist/shaka-player.ui.map +4 -4
  41. package/docs/tutorials/ad_monetization.md +54 -0
  42. package/docs/tutorials/basic-usage.md +2 -1
  43. package/docs/tutorials/errors.md +2 -1
  44. package/docs/tutorials/offline.md +10 -8
  45. package/docs/tutorials/plugins.md +5 -0
  46. package/docs/tutorials/ui-customization.md +13 -0
  47. package/docs/tutorials/ui.md +2 -1
  48. package/docs/tutorials/upgrade.md +3 -0
  49. package/externs/managedmediasource.js +24 -0
  50. package/externs/shaka/abr_manager.js +6 -2
  51. package/externs/shaka/cea.js +7 -0
  52. package/externs/shaka/codecs.js +5 -3
  53. package/externs/shaka/manifest.js +21 -5
  54. package/externs/shaka/manifest_parser.js +17 -0
  55. package/externs/shaka/net.js +2 -2
  56. package/externs/shaka/offline.js +9 -2
  57. package/externs/shaka/player.js +53 -7
  58. package/externs/shaka/text.js +3 -1
  59. package/externs/shaka/transmuxer.js +1 -1
  60. package/lib/abr/simple_abr_manager.js +25 -8
  61. package/lib/ads/media_tailor_ad_manager.js +14 -3
  62. package/lib/cast/cast_receiver.js +1 -1
  63. package/lib/cea/cea_decoder.js +28 -0
  64. package/lib/cea/dummy_caption_decoder.js +5 -0
  65. package/lib/dash/dash_parser.js +249 -83
  66. package/lib/dash/mpd_utils.js +52 -31
  67. package/lib/dash/segment_base.js +4 -5
  68. package/lib/dash/segment_list.js +5 -4
  69. package/lib/dash/segment_template.js +83 -26
  70. package/lib/hls/hls_classes.js +28 -43
  71. package/lib/hls/hls_parser.js +761 -649
  72. package/lib/hls/hls_utils.js +64 -5
  73. package/lib/hls/manifest_text_parser.js +7 -11
  74. package/lib/media/adaptation_set.js +20 -13
  75. package/lib/media/adaptation_set_criteria.js +70 -18
  76. package/lib/media/closed_caption_parser.js +13 -0
  77. package/lib/media/content_workarounds.js +6 -0
  78. package/lib/media/drm_engine.js +8 -13
  79. package/lib/media/manifest_parser.js +8 -113
  80. package/lib/media/media_source_capabilities.js +10 -3
  81. package/lib/media/media_source_engine.js +75 -21
  82. package/lib/media/play_rate_controller.js +8 -38
  83. package/lib/media/presentation_timeline.js +7 -1
  84. package/lib/media/quality_observer.js +1 -1
  85. package/lib/media/segment_index.js +5 -5
  86. package/lib/media/segment_prefetch.js +92 -24
  87. package/lib/media/segment_reference.js +67 -1
  88. package/lib/media/segment_utils.js +343 -0
  89. package/lib/media/stall_detector.js +0 -3
  90. package/lib/media/streaming_engine.js +41 -21
  91. package/lib/mss/mss_parser.js +18 -2
  92. package/lib/net/networking_engine.js +66 -12
  93. package/lib/net/networking_utils.js +95 -0
  94. package/lib/offline/indexeddb/v1_storage_cell.js +2 -0
  95. package/lib/offline/indexeddb/v2_storage_cell.js +2 -0
  96. package/lib/offline/manifest_converter.js +2 -0
  97. package/lib/offline/offline_manifest_parser.js +10 -0
  98. package/lib/offline/storage.js +11 -7
  99. package/lib/player.js +993 -1502
  100. package/lib/polyfill/mediasource.js +22 -1
  101. package/lib/text/mp4_ttml_parser.js +2 -2
  102. package/lib/text/srt_text_parser.js +2 -2
  103. package/lib/text/stub_text_displayer.js +51 -0
  104. package/lib/text/text_engine.js +3 -2
  105. package/lib/text/ttml_text_parser.js +28 -5
  106. package/lib/text/ui_text_displayer.js +4 -0
  107. package/lib/text/vtt_text_parser.js +7 -2
  108. package/lib/transmuxer/aac_transmuxer.js +1 -1
  109. package/lib/transmuxer/ac3_transmuxer.js +1 -1
  110. package/lib/transmuxer/ec3_transmuxer.js +1 -1
  111. package/lib/transmuxer/h264.js +5 -4
  112. package/lib/transmuxer/h265.js +5 -4
  113. package/lib/transmuxer/mp3_transmuxer.js +1 -1
  114. package/lib/transmuxer/mpeg_ts_transmuxer.js +1 -1
  115. package/lib/transmuxer/mss_transmuxer.js +1 -1
  116. package/lib/transmuxer/ts_transmuxer.js +33 -13
  117. package/lib/util/buffer_utils.js +26 -4
  118. package/lib/util/content_steering_manager.js +358 -0
  119. package/lib/util/error.js +2 -6
  120. package/lib/util/fairplay_utils.js +1 -1
  121. package/lib/util/fake_event.js +5 -1
  122. package/lib/util/id3_utils.js +50 -1
  123. package/lib/util/manifest_parser_utils.js +12 -8
  124. package/lib/util/mp4_generator.js +2 -4
  125. package/lib/util/mutex.js +59 -0
  126. package/lib/util/object_utils.js +1 -1
  127. package/lib/util/periods.js +154 -179
  128. package/lib/util/platform.js +4 -3
  129. package/lib/util/player_configuration.js +35 -6
  130. package/lib/util/stream_utils.js +105 -98
  131. package/lib/util/ts_parser.js +124 -73
  132. package/lib/util/uint8array_utils.js +5 -1
  133. package/lib/util/xml_utils.js +5 -0
  134. package/maintained-branches.md +2 -2
  135. package/package.json +1 -1
  136. package/roadmap.md +15 -5
  137. package/shaka-player.uncompiled.js +0 -1
  138. package/test/abr/simple_abr_manager_unit.js +33 -33
  139. package/test/ads/ad_manager_unit.js +3 -2
  140. package/test/cast/cast_receiver_integration.js +3 -4
  141. package/test/cast/cast_utils_unit.js +2 -0
  142. package/test/cea/cea_decoder_unit.js +7 -0
  143. package/test/codec_switching/codec_switching_integration.js +2 -1
  144. package/test/dash/dash_parser_integration.js +2 -1
  145. package/test/dash/dash_parser_live_unit.js +0 -19
  146. package/test/dash/dash_parser_manifest_unit.js +494 -2
  147. package/test/dash/mpd_utils_unit.js +61 -30
  148. package/test/hls/hls_live_unit.js +12 -3
  149. package/test/hls/hls_parser_unit.js +377 -27
  150. package/test/hls/manifest_text_parser_unit.js +32 -99
  151. package/test/media/adaptation_set_criteria_unit.js +172 -21
  152. package/test/media/adaptation_set_unit.js +1 -0
  153. package/test/media/content_workarounds_unit.js +1 -1
  154. package/test/media/drm_engine_unit.js +3 -3
  155. package/test/media/media_source_engine_unit.js +1 -1
  156. package/test/media/play_rate_controller_unit.js +0 -48
  157. package/test/media/segment_index_unit.js +2 -1
  158. package/test/mss/mss_player_integration.js +3 -2
  159. package/test/net/networking_engine_unit.js +3 -3
  160. package/test/{media/manifest_parser_unit.js → net/networking_utils_unit.js} +2 -2
  161. package/test/offline/manifest_convert_unit.js +9 -0
  162. package/test/offline/offline_integration.js +2 -1
  163. package/test/offline/storage_integration.js +21 -9
  164. package/test/player_external.js +4 -2
  165. package/test/player_integration.js +15 -4
  166. package/test/player_load_graph_integration.js +47 -151
  167. package/test/player_src_equals_external.js +1 -0
  168. package/test/player_src_equals_integration.js +71 -4
  169. package/test/player_unit.js +80 -27
  170. package/test/test/util/fake_media_source_engine.js +5 -0
  171. package/test/test/util/fake_networking_engine.js +9 -1
  172. package/test/test/util/fake_segment_prefetch.js +3 -0
  173. package/test/test/util/manifest_generator.js +4 -0
  174. package/test/test/util/manifest_parser_util.js +14 -2
  175. package/test/test/util/offline_utils.js +1 -0
  176. package/test/test/util/simple_fakes.js +2 -2
  177. package/test/test/util/streaming_engine_util.js +3 -0
  178. package/test/test/util/test_scheme.js +6 -0
  179. package/test/test/util/ui_utils.js +4 -3
  180. package/test/text/mp4_ttml_parser_unit.js +4 -4
  181. package/test/text/srt_text_parser_unit.js +1 -1
  182. package/test/text/text_displayer_layout_unit.js +1 -1
  183. package/test/text/text_engine_unit.js +6 -0
  184. package/test/text/ttml_text_parser_unit.js +33 -2
  185. package/test/transmuxer/transmuxer_engine_integration.js +9 -0
  186. package/test/transmuxer/transmuxer_integration.js +33 -3
  187. package/test/ui/ad_ui_unit.js +2 -2
  188. package/test/ui/ui_customization_unit.js +17 -16
  189. package/test/ui/ui_integration.js +30 -20
  190. package/test/ui/ui_unit.js +25 -19
  191. package/test/util/buffer_utils_unit.js +1 -1
  192. package/test/util/content_steering_manager_unit.js +427 -0
  193. package/test/util/id3_utils_unit.js +52 -0
  194. package/test/util/stream_utils_unit.js +17 -113
  195. package/test/util/ts_parser_unit.js +3 -3
  196. package/third_party/closure-uri/uri.js +13 -1
  197. package/ui/audio_language_selection.js +9 -2
  198. package/ui/externs/ui.js +17 -2
  199. package/ui/language_utils.js +43 -8
  200. package/ui/less/range_elements.less +33 -0
  201. package/ui/locales/en.json +1 -0
  202. package/ui/locales/es-419.json +1 -0
  203. package/ui/locales/es.json +1 -0
  204. package/ui/locales/source.json +4 -0
  205. package/ui/localization.js +10 -0
  206. package/ui/remote_button.js +3 -1
  207. package/ui/resolution_selection.js +47 -10
  208. package/ui/seek_bar.js +296 -3
  209. package/ui/text_selection.js +2 -1
  210. package/ui/ui.js +6 -2
  211. package/lib/routing/node.js +0 -23
  212. package/lib/routing/payload.js +0 -47
  213. package/lib/routing/walker.js +0 -587
  214. package/test/routing/walker_unit.js +0 -505
@@ -7,6 +7,60 @@ other ad providers in v3.1+.
7
7
  Please note that the current API is likely to undergo significant
8
8
  changes as our support extends.
9
9
 
10
+ #### AWS Elemental MediaTailor Integration
11
+
12
+ Shaka Player provides an integration with the [AWS Elemental MediaTailor][].
13
+ We support Client Side, Server Side and overlays ad insertion.
14
+
15
+ [AWS Elemental MediaTailor]: https://aws.amazon.com/mediatailor/
16
+
17
+ All ad insertion experiences are available through the
18
+ {@linksource shaka.extern.IAdManager} object on the Player.
19
+
20
+ If you're not using Shaka's UI library, you will
21
+ also need to create a `<div>` over your video element to serve as an ad
22
+ container.
23
+
24
+ Start by initializing the server side logic.
25
+ With Shaka UI:
26
+
27
+ ```js
28
+ const video = document.getElementById('video');
29
+ const ui = video['ui'];
30
+ const controls = video.ui.getControls();
31
+ // If you're using a non-UI build, this is the div you'll need to create
32
+ // for your layout.
33
+ const container = controls.getServerSideAdContainer();
34
+ const player = controls.getPlayer();
35
+ const netEngine = player.getNetworkingEngine();
36
+ const adManager = player.getAdManager();
37
+ adManager.initMediaTailor(container, netEngine, video);
38
+ ```
39
+
40
+ Requesting a Client Side stream:
41
+
42
+ ```js
43
+ const mediaTailorUrl = 'https://d305rncpy6ne2q.cloudfront.net/v1/session/94063eadf7d8c56e9e2edd84fdf897826a70d0df/SFP-MediaTailor-VOD-HLS-DASH/out/v1/b94f3611978f419985a18335bac9d9cb/ddb73bf548a44551a0059c346226445a/eaa5485198bf497284559efb8172425e/index.mpd';
44
+ const mediaTailorAdsParams = {
45
+ adsParams: {
46
+ assetid: 'test2',
47
+ podduration: '15',
48
+ },
49
+ };
50
+ const uri = await adManager.requestMediaTailorStream(mediaTailorUrl, mediaTailorAdsParams);
51
+ player.load(uri);
52
+ ```
53
+
54
+ Requesting a Server Side stream:
55
+
56
+ ```js
57
+ const mediaTailorUrl = 'https://ad391cc0d55b44c6a86d232548adc225.mediatailor.us-east-1.amazonaws.com/v1/session/d02fedbbc5a68596164208dd24e9b48aa60dadc7/singssai/master.m3u8';
58
+ const uri = await adManager.requestMediaTailorStream(mediaTailorUrl);
59
+ player.load(uri);
60
+ ```
61
+
62
+ Note: overlays ad insertions is the same as server side.
63
+
10
64
  #### IMA SDK Integration
11
65
 
12
66
  Shaka Player provides an integration with the [Interactive Media Ads][] SDKs.
@@ -52,7 +52,8 @@ function initApp() {
52
52
  async function initPlayer() {
53
53
  // Create a Player instance.
54
54
  const video = document.getElementById('video');
55
- const player = new shaka.Player(video);
55
+ const player = new shaka.Player();
56
+ await player.attach(video);
56
57
 
57
58
  // Attach player to the window to make it easy to access in the JS console.
58
59
  window.player = player;
@@ -17,7 +17,8 @@ const handleError = (error) => {
17
17
  }
18
18
  };
19
19
 
20
- const player = new shaka.Player(video);
20
+ const player = new shaka.Player();
21
+ await player.attach(video);
21
22
 
22
23
  // handle errors that occur after load
23
24
  player.addEventListener('error', handleError);
@@ -79,14 +79,14 @@ the end of the tutorial.
79
79
  ```js
80
80
  // myapp.js
81
81
 
82
- function initApp() {
82
+ async function initApp() {
83
83
  // Install built-in polyfills to patch browser incompatibilities.
84
84
  shaka.polyfill.installAll();
85
85
 
86
86
  // Check to see if the browser supports the basic APIs Shaka needs.
87
87
  if (shaka.Player.isBrowserSupported()) {
88
88
  // Everything looks good!
89
- initPlayer();
89
+ await initPlayer();
90
90
  } else {
91
91
  // This browser does not have the minimum set of APIs we need.
92
92
  console.error('Browser not supported!');
@@ -99,10 +99,11 @@ function initApp() {
99
99
  window.addEventListener('offline', updateOnlineStatus);
100
100
  }
101
101
 
102
- function initPlayer() {
102
+ async function initPlayer() {
103
103
  // Create a Player instance.
104
104
  const video = document.getElementById('video');
105
- const player = new shaka.Player(video);
105
+ const player = new shaka.Player();
106
+ await player.attach(video);
106
107
 
107
108
  // Attach player and storage to the window to make it easy to access
108
109
  // in the JS console and so we can access it in other methods.
@@ -437,14 +438,14 @@ That’s it! For your convenience, here is the completed code:
437
438
  ```js
438
439
  // myapp.js
439
440
 
440
- function initApp() {
441
+ async function initApp() {
441
442
  // Install built-in polyfills to patch browser incompatibilities.
442
443
  shaka.polyfill.installAll();
443
444
 
444
445
  // Check to see if the browser supports the basic APIs Shaka needs.
445
446
  if (shaka.Player.isBrowserSupported()) {
446
447
  // Everything looks good!
447
- initPlayer();
448
+ await initPlayer();
448
449
  } else {
449
450
  // This browser does not have the minimum set of APIs we need.
450
451
  console.error('Browser not supported!');
@@ -457,10 +458,11 @@ function initApp() {
457
458
  window.addEventListener('offline', updateOnlineStatus);
458
459
  }
459
460
 
460
- function initPlayer() {
461
+ async function initPlayer() {
461
462
  // Create a Player instance.
462
463
  const video = document.getElementById('video');
463
- const player = new shaka.Player(video);
464
+ const player = new shaka.Player();
465
+ await player.attach(video);
464
466
 
465
467
  // Attach player and storage to the window to make it easy to access
466
468
  // in the JS console and so we can access it in other methods.
@@ -29,6 +29,7 @@ __Manifest parsers__
29
29
  - Default manifest parser plugins:
30
30
  - DASH: {@linksource shaka.dash.DashParser}
31
31
  - HLS: {@linksource shaka.hls.HlsParser}
32
+ - MSS: {@linksource shaka.mss.MssParser}
32
33
 
33
34
  __Subtitle/caption parsers__
34
35
  - Selected by MIME type
@@ -38,6 +39,10 @@ __Subtitle/caption parsers__
38
39
  {@linksource shaka.text.Mp4VttParser}
39
40
  - TTML: {@linksource shaka.text.TtmlTextParser} and
40
41
  {@linksource shaka.text.Mp4TtmlParser}
42
+ - SubRip (SRT): {@linksource shaka.text.SrtTextParser}
43
+ - LyRiCs (LRC): {@linksource shaka.text.LrcTextParser}
44
+ - SubStation Alpha (SSA, ASS): {@linksource shaka.text.SsaTextParser}
45
+ - SubViewer (SBV): {@linksource shaka.text.SbvTextParser}
41
46
 
42
47
  __Subtitle/caption displayers__
43
48
  - Configured at runtime on a Player instance
@@ -188,6 +188,19 @@ const config = {
188
188
  ui.configure(config);
189
189
  ```
190
190
 
191
+ If you've chosen to display chapters, you can specify the color for the chapter markers on
192
+ the timeline and the text color of the chapter titles that popup on hover:
193
+ ```js
194
+ const config = {
195
+ displayChapters: true,
196
+ seekBarColors: {
197
+ chapterMarks: 'rgb(27, 27, 27)',
198
+ chapterLabels: 'rgb(255, 255, 255)'
199
+ }
200
+ }
201
+ ui.configure(config);
202
+ ```
203
+
191
204
  #### Configuring playback, fast forward and rewind rates
192
205
  The rate in which the player can play, fast forward and rewind content can be configured using the `playbackRates`, `fastForwardRates` and `rewindRates` options.
193
206
 
@@ -203,7 +203,8 @@ constructor.
203
203
  ```js
204
204
  // "local" because it is for local playback only, as opposed to the player proxy
205
205
  // object, which will route your calls to the ChromeCast receiver as necessary.
206
- const localPlayer = new shaka.Player(videoElement);
206
+ const localPlayer = new shaka.Player();
207
+ await localPlayer.attach(videoElement);
207
208
  // "Overlay" because the UI will add DOM elements inside the container,
208
209
  // to visually overlay the video element
209
210
  const ui = new shaka.ui.Overlay(localPlayer, videoContainerElement,
@@ -99,3 +99,6 @@ application:
99
99
 
100
100
  - Plugin changes:
101
101
  - `Transmuxer` plugins now has three new parameters in `transmux()` method.
102
+
103
+ - Player API Changes:
104
+ - The constructor no longer takes `mediaElement` as a parameter; use the `attach` method to attach to a media element instead. (Deprecated in v4.6)
@@ -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) {};
@@ -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
@@ -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
  */
@@ -364,6 +372,7 @@ shaka.extern.FetchCryptoKeysFunction;
364
372
  * frameRate: (number|undefined),
365
373
  * pixelAspectRatio: (string|undefined),
366
374
  * hdr: (string|undefined),
375
+ * videoLayout: (string|undefined),
367
376
  * bandwidth: (number|undefined),
368
377
  * width: (number|undefined),
369
378
  * height: (number|undefined),
@@ -390,7 +399,8 @@ shaka.extern.FetchCryptoKeysFunction;
390
399
  * (!Array.<shaka.extern.Stream>|!Array.<shaka.extern.StreamDB>|
391
400
  * undefined),
392
401
  * mssPrivateData: (shaka.extern.MssPrivateData|undefined),
393
- * external: boolean
402
+ * external: boolean,
403
+ * fastSwitching: boolean
394
404
  * }}
395
405
  *
396
406
  * @description
@@ -434,6 +444,9 @@ shaka.extern.FetchCryptoKeysFunction;
434
444
  * @property {(string|undefined)} hdr
435
445
  * <i>Video streams only.</i> <br>
436
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.
437
450
  * @property {(number|undefined)} bandwidth
438
451
  * <i>Audio and video streams only.</i> <br>
439
452
  * The stream's required bandwidth in bits per second.
@@ -503,7 +516,8 @@ shaka.extern.FetchCryptoKeysFunction;
503
516
  * A map containing the description of closed captions, with the caption
504
517
  * channel number (CC1 | CC2 | CC3 | CC4) as the key and the language code
505
518
  * as the value. If the channel number is not provided by the description,
506
- * 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.
507
521
  * Example: {'CC1': 'eng'; 'CC3': 'swe'}, or {'1', 'eng'; '2': 'swe'}, etc.
508
522
  * @property {(string|undefined)} tilesLayout
509
523
  * <i>Image streams only.</i> <br>
@@ -519,6 +533,8 @@ shaka.extern.FetchCryptoKeysFunction;
519
533
  * @property {boolean} external
520
534
  * Indicate if the stream was added externally.
521
535
  * Eg: external text tracks.
536
+ * @property {boolean} fastSwitching
537
+ * Indicate if the stream should be used for fast switching.
522
538
  *
523
539
  * @exportDoc
524
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
 
@@ -226,7 +226,7 @@ shaka.extern.RequestContext;
226
226
  * it before it is sent to the scheme plugin.
227
227
  * The RequestType describes the basic type of the request (manifest, segment,
228
228
  * etc). The optional RequestContext will be provided where applicable to
229
- * provide additional infomation about the request. A request filter can run
229
+ * provide additional information about the request. A request filter can run
230
230
  * asynchronously by returning a promise; in this case, the request will not be
231
231
  * sent until the promise is resolved.
232
232
  *
@@ -244,7 +244,7 @@ shaka.extern.RequestFilter;
244
244
  * it before it is returned.
245
245
  * The RequestType describes the basic type of the request (manifest, segment,
246
246
  * etc). The optional RequestContext will be provided where applicable to
247
- * provide additional infomation about the request. A response filter can run
247
+ * provide additional information about the request. A response filter can run
248
248
  * asynchronously by returning a promise.
249
249
  *
250
250
  * @typedef {!function(shaka.net.NetworkingEngine.RequestType,
@@ -122,6 +122,7 @@ shaka.extern.ManifestDB;
122
122
  * frameRate: (number|undefined),
123
123
  * pixelAspectRatio: (string|undefined),
124
124
  * hdr: (string|undefined),
125
+ * videoLayout: (string|undefined),
125
126
  * kind: (string|undefined),
126
127
  * language: string,
127
128
  * originalLanguage: (?string|undefined),
@@ -139,7 +140,8 @@ shaka.extern.ManifestDB;
139
140
  * spatialAudio: boolean,
140
141
  * closedCaptions: Map.<string, string>,
141
142
  * tilesLayout: (string|undefined),
142
- * external: boolean
143
+ * external: boolean,
144
+ * fastSwitching: boolean
143
145
  * }}
144
146
  *
145
147
  * @property {number} id
@@ -164,6 +166,8 @@ shaka.extern.ManifestDB;
164
166
  * The Stream's pixel aspect ratio
165
167
  * @property {(string|undefined)} hdr
166
168
  * The Stream's HDR info
169
+ * @property {(string|undefined)} videoLayout
170
+ * The Stream's video layout info.
167
171
  * @property {(string|undefined)} kind
168
172
  * The kind of text stream; undefined for audio/video.
169
173
  * @property {string} language
@@ -199,7 +203,8 @@ shaka.extern.ManifestDB;
199
203
  * A map containing the description of closed captions, with the caption
200
204
  * channel number (CC1 | CC2 | CC3 | CC4) as the key and the language code
201
205
  * as the value. If the channel number is not provided by the description,
202
- * we'll set an 0-based index as the key.
206
+ * we'll set a 0-based index as the key. If the language code is not
207
+ * provided by the description we'll set the same value as channel number.
203
208
  * Example: {'CC1': 'eng'; 'CC3': 'swe'}, or {'1', 'eng'; '2': 'swe'}, etc.
204
209
  * @property {(string|undefined)} tilesLayout
205
210
  * The value is a grid-item-dimension consisting of two positive decimal
@@ -208,6 +213,8 @@ shaka.extern.ManifestDB;
208
213
  * @property {boolean} external
209
214
  * Indicate if the stream was added externally.
210
215
  * Eg: external text tracks.
216
+ * @property {boolean} fastSwitching
217
+ * Indicate if the stream should be used for fast switching.
211
218
  */
212
219
  shaka.extern.StreamDB;
213
220
 
@@ -216,6 +216,7 @@ shaka.extern.BufferedInfo;
216
216
  * frameRate: ?number,
217
217
  * pixelAspectRatio: ?string,
218
218
  * hdr: ?string,
219
+ * videoLayout: ?string,
219
220
  * mimeType: ?string,
220
221
  * audioMimeType: ?string,
221
222
  * videoMimeType: ?string,
@@ -280,6 +281,8 @@ shaka.extern.BufferedInfo;
280
281
  * The video pixel aspect ratio provided in the manifest, if present.
281
282
  * @property {?string} hdr
282
283
  * The video HDR provided in the manifest, if present.
284
+ * @property {?string} videoLayout
285
+ * The video layout provided in the manifest, if present.
283
286
  * @property {?string} mimeType
284
287
  * The MIME type of the content provided in the manifest.
285
288
  * @property {?string} audioMimeType
@@ -495,13 +498,17 @@ shaka.extern.MetadataRawFrame;
495
498
  * @typedef {{
496
499
  * key: string,
497
500
  * data: (ArrayBuffer|string|number),
498
- * description: string
501
+ * description: string,
502
+ * mimeType: ?string,
503
+ * pictureType: ?number
499
504
  * }}
500
505
  *
501
506
  * @description metadata frame parsed.
502
507
  * @property {string} key
503
508
  * @property {ArrayBuffer|string|number} data
504
509
  * @property {string} description
510
+ * @property {?string} mimeType
511
+ * @property {?number} pictureType
505
512
  * @exportDoc
506
513
  */
507
514
  shaka.extern.MetadataFrame;
@@ -573,7 +580,7 @@ shaka.extern.TimelineRegionInfo;
573
580
  * @property {?number} channelsCount
574
581
  * The number of audio channels, or null if unknown.
575
582
  * @property {?string} pixelAspectRatio
576
- * The pixel aspect ratio value; e.g "1:1".
583
+ * The pixel aspect ratio value; e.g. "1:1".
577
584
  * @property {?number} width
578
585
  * The video width in pixels.
579
586
  * @exportDoc
@@ -754,7 +761,8 @@ shaka.extern.PersistentSessionMetadata;
754
761
  * preferredKeySystems: !Array.<string>,
755
762
  * keySystemsMapping: !Object.<string, string>,
756
763
  * parseInbandPsshEnabled: boolean,
757
- * minHdcpVersion: string
764
+ * minHdcpVersion: string,
765
+ * ignoreDuplicateInitData: boolean
758
766
  * }}
759
767
  *
760
768
  * @property {shaka.extern.RetryParameters} retryParameters
@@ -810,7 +818,12 @@ shaka.extern.PersistentSessionMetadata;
810
818
  * <i>By default (''), do not check the HDCP version.</i><br>
811
819
  * Indicates the minimum version of HDCP to start the playback of encrypted
812
820
  * streams. <b>May be ignored if not supported by the device.</b>
813
- *
821
+ * @property {boolean} ignoreDuplicateInitData
822
+ * <i>Defaults to false on Tizen 2, and true for all other browsers.</i><br>
823
+ * When true indicate that the player doesn't ignore duplicate init data.
824
+ * Note: Tizen 2015 and 2016 models will send multiple webkitneedkey events
825
+ * with the same init data. If the duplicates are supressed, playback
826
+ * will stall without errors.
814
827
  * @exportDoc
815
828
  */
816
829
  shaka.extern.DrmConfiguration;
@@ -920,7 +933,9 @@ shaka.extern.DashManifestConfiguration;
920
933
  * useSafariBehaviorForLive: boolean,
921
934
  * liveSegmentsDelay: number,
922
935
  * sequenceMode: boolean,
923
- * ignoreManifestTimestampsInSegmentsMode: boolean
936
+ * ignoreManifestTimestampsInSegmentsMode: boolean,
937
+ * disableCodecGuessing: boolean,
938
+ * allowLowLatencyByteRangeOptimization: boolean
924
939
  * }}
925
940
  *
926
941
  * @property {boolean} ignoreTextStreamFailures
@@ -973,6 +988,18 @@ shaka.extern.DashManifestConfiguration;
973
988
  * to the SourceBuffer, even if the manifest and segment times disagree.
974
989
  * Only applies when sequenceMode is <code>false</code>.
975
990
  * <i>Defaults to <code>false</code>.</i>
991
+ * @property {boolean} disableCodecGuessing
992
+ * If set to true, the HLS parser won't automatically guess or assume default
993
+ * codec for playlists with no "CODECS" attribute. Instead, it will attempt to
994
+ * extract the missing information from the media segment.
995
+ * As a consequence, lazy-loading media playlists won't be possible for this
996
+ * use case, which may result in longer video startup times.
997
+ * <i>Defaults to <code>false</code>.</i>
998
+ * @property {boolean} allowLowLatencyByteRangeOptimization
999
+ * If set to true, the HLS parser will optimize operation with LL and partial
1000
+ * byte range segments. More info in
1001
+ * https://www.akamai.com/blog/performance/-using-ll-hls-with-byte-range-addressing-to-achieve-interoperabi
1002
+ * <i>Defaults to <code>true</code>.</i>
976
1003
  * @exportDoc
977
1004
  */
978
1005
  shaka.extern.HlsManifestConfiguration;
@@ -1055,7 +1082,7 @@ shaka.extern.MssManifestConfiguration;
1055
1082
  * @property {shaka.extern.MssManifestConfiguration} mss
1056
1083
  * Advanced parameters used by the MSS manifest parser.
1057
1084
  * @property {boolean} raiseFatalErrorOnManifestUpdateRequestFailure
1058
- * If true, manifest update request failures will cause a fatal errror.
1085
+ * If true, manifest update request failures will cause a fatal error.
1059
1086
  * Defaults to <code>false</code> if not provided.
1060
1087
  *
1061
1088
  * @exportDoc
@@ -1094,7 +1121,9 @@ shaka.extern.ManifestConfiguration;
1094
1121
  * segmentPrefetchLimit: number,
1095
1122
  * liveSync: boolean,
1096
1123
  * liveSyncMaxLatency: number,
1097
- * liveSyncPlaybackRate: number
1124
+ * liveSyncPlaybackRate: number,
1125
+ * liveSyncMinLatency: number,
1126
+ * liveSyncMinPlaybackRate: number
1098
1127
  * }}
1099
1128
  *
1100
1129
  * @description
@@ -1223,6 +1252,13 @@ shaka.extern.ManifestConfiguration;
1223
1252
  * Playback rate used for latency chasing. It is recommended to use a value
1224
1253
  * between 1 and 2. Effective only if liveSync is true. Defaults to
1225
1254
  * <code>1.1</code>.
1255
+ * @property {number} liveSyncMinLatency
1256
+ * Minimun acceptable latency, in seconds. Effective only if liveSync is
1257
+ * true. Defaults to <code>0</code>.
1258
+ * @property {number} liveSyncMinPlaybackRate
1259
+ * Minimun playback rate used for latency chasing. It is recommended to use a
1260
+ * value between 0 and 1. Effective only if liveSync is true. Defaults to
1261
+ * <code>1</code>.
1226
1262
  * @exportDoc
1227
1263
  */
1228
1264
  shaka.extern.StreamingConfiguration;
@@ -1529,6 +1565,7 @@ shaka.extern.OfflineConfiguration;
1529
1565
  * preferredAudioCodecs: !Array.<string>,
1530
1566
  * preferredAudioChannelCount: number,
1531
1567
  * preferredVideoHdrLevel: string,
1568
+ * preferredVideoLayout: string,
1532
1569
  * preferredDecodingAttributes: !Array.<string>,
1533
1570
  * preferForcedSubs: boolean,
1534
1571
  * restrictions: shaka.extern.Restrictions,
@@ -1589,6 +1626,12 @@ shaka.extern.OfflineConfiguration;
1589
1626
  * Defaults to 'AUTO'.
1590
1627
  * Note that one some platforms, such as Chrome, attempting to play PQ content
1591
1628
  * may cause problems.
1629
+ * @property {string} preferredVideoLayout
1630
+ * The preferred video layout of the video.
1631
+ * Can be 'CH-STEREO', 'CH-MONO', or '' for no preference.
1632
+ * If the content is predominantly stereoscopic you should use 'CH-STEREO'.
1633
+ * If the content is predominantly monoscopic you should use 'CH-MONO'.
1634
+ * Defaults to ''.
1592
1635
  * @property {!Array.<string>} preferredDecodingAttributes
1593
1636
  * The list of preferred attributes of decodingInfo, in the order of their
1594
1637
  * priorities.
@@ -1637,6 +1680,7 @@ shaka.extern.LanguageRole;
1637
1680
 
1638
1681
  /**
1639
1682
  * @typedef {{
1683
+ * segment: shaka.media.SegmentReference,
1640
1684
  * imageHeight: number,
1641
1685
  * imageWidth: number,
1642
1686
  * height: number,
@@ -1649,6 +1693,8 @@ shaka.extern.LanguageRole;
1649
1693
  * sprite: boolean
1650
1694
  * }}
1651
1695
  *
1696
+ * @property {shaka.media.SegmentReference} segment
1697
+ * The segment of this thumbnail.
1652
1698
  * @property {number} imageHeight
1653
1699
  * The image height in px. The image height could be different to height if
1654
1700
  * the layout is different to 1x1.
@@ -36,11 +36,13 @@ shaka.extern.TextParser = class {
36
36
  * @param {shaka.extern.TextParser.TimeContext} timeContext
37
37
  * The time information that should be used to adjust the times values
38
38
  * for each cue.
39
+ * @param {?(string|undefined)} uri
40
+ * The media uri.
39
41
  * @return {!Array.<!shaka.text.Cue>}
40
42
  *
41
43
  * @exportDoc
42
44
  */
43
- parseMedia(data, timeContext) {}
45
+ parseMedia(data, timeContext, uri) {}
44
46
 
45
47
  /**
46
48
  * Notifies the stream if the manifest is in sequence mode or not.
@@ -37,7 +37,7 @@ shaka.extern.Transmuxer = class {
37
37
  * Returns the original mimetype of the transmuxer.
38
38
  * @return {string}
39
39
  */
40
- getOrginalMimeType() {}
40
+ getOriginalMimeType() {}
41
41
 
42
42
  /**
43
43
  * Transmux a input data to MP4.