shaka-player 3.1.4 → 3.3.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/.github/ISSUE_TEMPLATE/feature_request.md +1 -1
  3. package/.github/ISSUE_TEMPLATE/question.md +1 -1
  4. package/AUTHORS +6 -5
  5. package/CHANGELOG.md +363 -0
  6. package/CONTRIBUTORS +4 -2
  7. package/README.md +4 -4
  8. package/build/types/core +3 -0
  9. package/build/types/offline +1 -0
  10. package/build/types/polyfill +2 -0
  11. package/build/types/ui +2 -0
  12. package/demo/common/asset.js +9 -7
  13. package/demo/common/assets.js +28 -1
  14. package/demo/common/message_ids.js +15 -2
  15. package/demo/config.js +35 -2
  16. package/demo/index.html +1 -1
  17. package/demo/locales/en.json +14 -1
  18. package/demo/locales/source.json +56 -4
  19. package/demo/main.js +2 -1
  20. package/dist/controls.css +26 -2
  21. package/dist/controls.css.map +1 -1
  22. package/dist/demo.compiled.debug.js +24 -21
  23. package/dist/demo.compiled.debug.map +3 -3
  24. package/dist/demo.compiled.js +24 -21
  25. package/dist/demo.compiled.map +3 -3
  26. package/dist/deps.js +33 -25
  27. package/dist/locales.js +31 -29
  28. package/dist/receiver.compiled.debug.js +14 -12
  29. package/dist/receiver.compiled.debug.map +3 -3
  30. package/dist/receiver.compiled.js +14 -12
  31. package/dist/receiver.compiled.map +3 -3
  32. package/dist/shaka-player.compiled.d.ts +258 -20
  33. package/dist/shaka-player.compiled.debug.d.ts +258 -20
  34. package/dist/shaka-player.compiled.debug.externs.js +1005 -695
  35. package/dist/shaka-player.compiled.debug.js +720 -640
  36. package/dist/shaka-player.compiled.debug.map +4 -4
  37. package/dist/shaka-player.compiled.externs.js +1005 -695
  38. package/dist/shaka-player.compiled.js +850 -817
  39. package/dist/shaka-player.compiled.map +4 -4
  40. package/dist/shaka-player.ui.d.ts +274 -21
  41. package/dist/shaka-player.ui.debug.d.ts +274 -21
  42. package/dist/shaka-player.ui.debug.externs.js +766 -429
  43. package/dist/shaka-player.ui.debug.js +863 -765
  44. package/dist/shaka-player.ui.debug.map +4 -4
  45. package/dist/shaka-player.ui.externs.js +766 -429
  46. package/dist/shaka-player.ui.js +1042 -996
  47. package/dist/shaka-player.ui.map +4 -4
  48. package/docs/design/bg-fetch-after.gv +29 -0
  49. package/docs/design/bg-fetch-after.gv.png +0 -0
  50. package/docs/design/bg-fetch-before.gv +18 -0
  51. package/docs/design/bg-fetch-before.gv.png +0 -0
  52. package/docs/design/bg-fetch.md +134 -0
  53. package/docs/tutorials/blob-url.md +15 -0
  54. package/docs/tutorials/index.json +1 -0
  55. package/docs/tutorials/ui-customization.md +66 -0
  56. package/docs/tutorials/ui.md +5 -5
  57. package/externs/aria.js +6 -0
  58. package/externs/ima.js +3 -0
  59. package/externs/shaka/ads.js +29 -1
  60. package/externs/shaka/manifest.js +18 -2
  61. package/externs/shaka/manifest_parser.js +10 -1
  62. package/externs/shaka/net.js +20 -4
  63. package/externs/shaka/offline.js +36 -2
  64. package/externs/shaka/player.js +182 -13
  65. package/externs/shaka/text.js +24 -10
  66. package/externs/texttrack.js +3 -0
  67. package/externs/webcrypto.js +18 -0
  68. package/lib/abr/ewma.js +14 -0
  69. package/lib/abr/ewma_bandwidth_estimator.js +16 -2
  70. package/lib/abr/simple_abr_manager.js +6 -0
  71. package/lib/ads/ad_manager.js +16 -15
  72. package/lib/ads/client_side_ad.js +8 -0
  73. package/lib/ads/client_side_ad_manager.js +14 -6
  74. package/lib/ads/server_side_ad.js +7 -0
  75. package/lib/ads/server_side_ad_manager.js +19 -2
  76. package/lib/cast/cast_proxy.js +8 -0
  77. package/lib/cast/cast_utils.js +7 -1
  78. package/lib/cea/cea608_data_channel.js +56 -56
  79. package/lib/cea/cea608_memory.js +33 -33
  80. package/lib/cea/cea708_service.js +43 -43
  81. package/lib/cea/cea708_window.js +38 -38
  82. package/lib/cea/cea_decoder.js +13 -14
  83. package/lib/cea/cea_utils.js +23 -23
  84. package/lib/cea/dtvcc_packet_builder.js +7 -7
  85. package/lib/cea/i_caption_decoder.js +2 -3
  86. package/lib/cea/i_cea_parser.js +2 -2
  87. package/lib/cea/mp4_cea_parser.js +6 -6
  88. package/lib/dash/dash_parser.js +53 -14
  89. package/lib/dash/segment_base.js +25 -1
  90. package/lib/dash/segment_list.js +18 -9
  91. package/lib/dash/segment_template.js +23 -10
  92. package/lib/hls/hls_parser.js +210 -30
  93. package/lib/media/closed_caption_parser.js +1 -2
  94. package/lib/media/drm_engine.js +162 -192
  95. package/lib/media/quality_observer.js +291 -0
  96. package/lib/media/segment_index.js +9 -1
  97. package/lib/media/segment_reference.js +37 -5
  98. package/lib/media/streaming_engine.js +48 -10
  99. package/lib/net/http_fetch_plugin.js +31 -11
  100. package/lib/net/http_plugin_utils.js +1 -0
  101. package/lib/net/http_xhr_plugin.js +40 -14
  102. package/lib/net/networking_engine.js +82 -18
  103. package/lib/offline/download_info.js +68 -0
  104. package/lib/offline/download_manager.js +14 -7
  105. package/lib/offline/indexeddb/base_storage_cell.js +35 -0
  106. package/lib/offline/indexeddb/storage_mechanism.js +1 -1
  107. package/lib/offline/indexeddb/v1_storage_cell.js +1 -0
  108. package/lib/offline/indexeddb/v2_storage_cell.js +1 -0
  109. package/lib/offline/indexeddb/v5_storage_cell.js +5 -0
  110. package/lib/offline/manifest_converter.js +3 -1
  111. package/lib/offline/storage.js +404 -297
  112. package/lib/offline/stored_content_utils.js +2 -0
  113. package/lib/player.js +622 -153
  114. package/lib/polyfill/aria.js +82 -0
  115. package/lib/polyfill/random_uuid.js +52 -0
  116. package/lib/routing/walker.js +2 -3
  117. package/lib/text/cue.js +12 -0
  118. package/lib/text/srt_text_parser.js +4 -4
  119. package/lib/text/text_engine.js +2 -2
  120. package/lib/text/ttml_text_parser.js +25 -2
  121. package/lib/text/ui_text_displayer.js +2 -2
  122. package/lib/text/vtt_text_parser.js +2 -2
  123. package/lib/text/web_vtt_generator.js +55 -12
  124. package/lib/util/cmcd_manager.js +826 -0
  125. package/lib/util/error.js +12 -0
  126. package/lib/util/language_utils.js +12 -0
  127. package/lib/util/manifest_parser_utils.js +1 -0
  128. package/lib/util/mp4_box_parsers.js +20 -20
  129. package/lib/util/multi_map.js +8 -0
  130. package/lib/util/mutex.js +52 -0
  131. package/lib/util/periods.js +98 -64
  132. package/lib/util/player_configuration.js +31 -1
  133. package/lib/util/stream_utils.js +140 -85
  134. package/lib/util/xml_utils.js +31 -12
  135. package/package.json +1 -1
  136. package/roadmap.md +24 -22
  137. package/shaka-player.uncompiled.js +4 -0
  138. package/test/cast/cast_utils_unit.js +1 -0
  139. package/test/cea/cea608_memory_unit.js +1 -1
  140. package/test/cea/cea708_service_unit.js +8 -8
  141. package/test/cea/cea708_window_unit.js +6 -6
  142. package/test/cea/cea_decoder_unit.js +1 -1
  143. package/test/cea/dtvcc_packet_builder_unit.js +2 -2
  144. package/test/dash/dash_parser_content_protection_unit.js +2 -0
  145. package/test/dash/dash_parser_live_unit.js +101 -1
  146. package/test/dash/dash_parser_manifest_unit.js +78 -2
  147. package/test/dash/dash_parser_segment_base_unit.js +2 -0
  148. package/test/dash/dash_parser_segment_list_unit.js +2 -1
  149. package/test/dash/dash_parser_segment_template_unit.js +2 -1
  150. package/test/hls/hls_live_unit.js +2 -0
  151. package/test/hls/hls_parser_unit.js +252 -0
  152. package/test/media/drm_engine_integration.js +86 -12
  153. package/test/media/drm_engine_unit.js +310 -450
  154. package/test/media/quality_observer_unit.js +139 -0
  155. package/test/media/segment_reference_unit.js +16 -1
  156. package/test/media/streaming_engine_integration.js +2 -1
  157. package/test/media/streaming_engine_unit.js +2 -0
  158. package/test/net/http_plugin_unit.js +20 -15
  159. package/test/offline/manifest_convert_unit.js +2 -0
  160. package/test/offline/storage_integration.js +117 -23
  161. package/test/player_integration.js +151 -0
  162. package/test/player_src_equals_integration.js +52 -0
  163. package/test/player_unit.js +11 -33
  164. package/test/test/assets/chapters.srt +11 -0
  165. package/test/test/assets/chapters.vtt +10 -0
  166. package/test/test/util/cea_utils.js +12 -12
  167. package/test/test/util/dash_parser_util.js +4 -0
  168. package/test/test/util/fake_ad.js +7 -0
  169. package/test/test/util/fake_ad_manager.js +7 -0
  170. package/test/test/util/fake_drm_engine.js +9 -2
  171. package/test/test/util/manifest_generator.js +5 -2
  172. package/test/test/util/manifest_parser_util.js +3 -1
  173. package/test/test/util/test_scheme.js +14 -1
  174. package/test/text/ttml_text_parser_unit.js +47 -0
  175. package/test/text/web_vtt_generator_unit.js +81 -7
  176. package/test/ui/ui_unit.js +250 -0
  177. package/test/util/cmcd_manager_unit.js +277 -0
  178. package/test/util/stream_utils_unit.js +118 -10
  179. package/ui/airplay_button.js +2 -1
  180. package/ui/audio_language_selection.js +9 -5
  181. package/ui/cast_button.js +5 -6
  182. package/ui/constants.js +0 -3
  183. package/ui/context_menu.js +109 -0
  184. package/ui/controls.js +41 -7
  185. package/ui/controls.less +1 -0
  186. package/ui/enums.js +4 -0
  187. package/ui/externs/ui.js +28 -1
  188. package/ui/fast_forward_button.js +16 -8
  189. package/ui/fullscreen_button.js +2 -3
  190. package/ui/language_utils.js +1 -1
  191. package/ui/less/buttons.less +0 -4
  192. package/ui/less/containers.less +74 -0
  193. package/ui/less/overflow_menu.less +0 -10
  194. package/ui/less/tooltip.less +97 -0
  195. package/ui/locales/en.json +1 -0
  196. package/ui/locales/source.json +4 -0
  197. package/ui/loop_button.js +6 -3
  198. package/ui/mute_button.js +3 -4
  199. package/ui/overflow_menu.js +7 -28
  200. package/ui/pip_button.js +10 -7
  201. package/ui/play_button.js +2 -2
  202. package/ui/playback_rate_selection.js +11 -15
  203. package/ui/presentation_time.js +1 -3
  204. package/ui/resolution_selection.js +11 -7
  205. package/ui/rewind_button.js +17 -9
  206. package/ui/seek_bar.js +6 -6
  207. package/ui/settings_menu.js +36 -4
  208. package/ui/small_play_button.js +1 -0
  209. package/ui/spacer.js +1 -1
  210. package/ui/statistics_button.js +253 -0
  211. package/ui/text_selection.js +19 -15
  212. package/ui/ui.js +30 -0
  213. package/ui/ui_utils.js +1 -1
  214. package/ui/volume_bar.js +2 -4
@@ -64,6 +64,9 @@ shaka.ads.ServerSideAdManager = class {
64
64
  /** @private {string} */
65
65
  this.backupUrl_ = '';
66
66
 
67
+ /** @private {!Array.<!shaka.extern.AdCuePoint>} */
68
+ this.currentCuePoints_ = [];
69
+
67
70
  /** @private {shaka.util.EventManager} */
68
71
  this.eventManager_ = new shaka.util.EventManager();
69
72
 
@@ -212,6 +215,7 @@ shaka.ads.ServerSideAdManager = class {
212
215
  // this.streamManager_.reset();
213
216
  this.backupUrl_ = '';
214
217
  this.snapForwardTime_ = null;
218
+ this.currentCuePoints_ = [];
215
219
  }
216
220
 
217
221
  /** @override */
@@ -249,6 +253,13 @@ shaka.ads.ServerSideAdManager = class {
249
253
  }
250
254
  }
251
255
 
256
+ /**
257
+ * @return {!Array.<!shaka.extern.AdCuePoint>}
258
+ */
259
+ getCuePoints() {
260
+ return this.currentCuePoints_;
261
+ }
262
+
252
263
  /**
253
264
  * If a seek jumped over the ad break, return to the start of the
254
265
  * ad break, then complete the seek after the ad played through.
@@ -376,13 +387,19 @@ shaka.ads.ServerSideAdManager = class {
376
387
  onCuePointsChanged_(e) {
377
388
  const streamData = e.getStreamData();
378
389
 
379
- /** @type {!Array.<!shaka.ads.CuePoint>} */
390
+ /** @type {!Array.<!shaka.extern.AdCuePoint>} */
380
391
  const cuePoints = [];
381
392
  for (const point of streamData.cuepoints) {
382
- const shakaCuePoint = new shaka.ads.CuePoint(point.start, point.end);
393
+ /** @type {shaka.extern.AdCuePoint} */
394
+ const shakaCuePoint = {
395
+ start: point.start,
396
+ end: point.end,
397
+ };
383
398
  cuePoints.push(shakaCuePoint);
384
399
  }
385
400
 
401
+ this.currentCuePoints_ = cuePoints;
402
+
386
403
  this.onEvent_(new shaka.util.FakeEvent(
387
404
  shaka.ads.AdManager.CUEPOINTS_CHANGED,
388
405
  (new Map()).set('cuepoints', cuePoints)));
@@ -648,6 +648,14 @@ shaka.cast.CastProxy = class extends shaka.util.FakeEventTarget {
648
648
  return () => this.localPlayer_.getNetworkingEngine();
649
649
  }
650
650
 
651
+ if (name == 'getDrmEngine') {
652
+ // Always returns a local instance.
653
+ if (this.sender_.isCasting()) {
654
+ shaka.log.warning('NOTE: getDrmEngine() is always local!');
655
+ }
656
+ return () => this.localPlayer_.getDrmEngine();
657
+ }
658
+
651
659
  if (name == 'getAdManager') {
652
660
  // Always returns a local instance.
653
661
  if (this.sender_.isCasting()) {
@@ -305,10 +305,11 @@ shaka.cast.CastUtils.PlayerGetterMethods = {
305
305
  'getAssetUri': 2,
306
306
  'getAudioLanguages': 4,
307
307
  'getAudioLanguagesAndRoles': 4,
308
+ 'getBufferFullness': 1,
308
309
  'getBufferedInfo': 2,
309
310
  // NOTE: The 'getSharedConfiguration' property is not proxied as it would
310
311
  // not be possible to share a reference.
311
- 'getConfiguration': 2,
312
+ 'getConfiguration': 4,
312
313
  'getExpiration': 2,
313
314
  'getKeyStatuses': 2,
314
315
  // NOTE: The 'getManifest' property is not proxied, as it is very large.
@@ -371,10 +372,13 @@ shaka.cast.CastUtils.PlayerInitAfterLoadState = [
371
372
  * @const {!Array.<string>}
372
373
  */
373
374
  shaka.cast.CastUtils.PlayerVoidMethods = [
375
+ 'addChaptersTrack',
374
376
  'addTextTrack',
375
377
  'addTextTrackAsync',
376
378
  'cancelTrickPlay',
377
379
  'configure',
380
+ 'getChapters',
381
+ 'getChaptersTracks',
378
382
  'resetConfiguration',
379
383
  'retryStreaming',
380
384
  'selectAudioLanguage',
@@ -384,6 +388,8 @@ shaka.cast.CastUtils.PlayerVoidMethods = [
384
388
  'selectVariantsByLabel',
385
389
  'setTextTrackVisibility',
386
390
  'trickPlay',
391
+ 'updateStartTime',
392
+ 'goToLive',
387
393
  ];
388
394
 
389
395
 
@@ -9,7 +9,7 @@ goog.provide('shaka.cea.Cea608DataChannel');
9
9
  goog.require('shaka.cea.Cea608Memory');
10
10
  goog.require('shaka.cea.CeaUtils');
11
11
  goog.require('shaka.log');
12
- goog.requireType('shaka.cea.ICaptionDecoder.ClosedCaption');
12
+ goog.requireType('shaka.cea.ICaptionDecoder');
13
13
 
14
14
 
15
15
  /**
@@ -17,8 +17,8 @@ goog.requireType('shaka.cea.ICaptionDecoder.ClosedCaption');
17
17
  */
18
18
  shaka.cea.Cea608DataChannel = class {
19
19
  /**
20
- * @param {!number} fieldNum Field number.
21
- * @param {!number} channelNum Channel number.
20
+ * @param {number} fieldNum Field number.
21
+ * @param {number} channelNum Channel number.
22
22
  */
23
23
  constructor(fieldNum, channelNum) {
24
24
  /**
@@ -58,7 +58,7 @@ shaka.cea.Cea608DataChannel = class {
58
58
 
59
59
  /**
60
60
  * End time of the previous caption, serves as start time of next caption.
61
- * @private {!number}
61
+ * @private {number}
62
62
  */
63
63
  this.prevEndTime_ = 0;
64
64
 
@@ -83,9 +83,9 @@ shaka.cea.Cea608DataChannel = class {
83
83
 
84
84
  /**
85
85
  * Gets the row index from a Preamble Address Code byte pair.
86
- * @param {!number} b1 Byte 1.
87
- * @param {!number} b2 Byte 2.
88
- * @return {!number} Row index.
86
+ * @param {number} b1 Byte 1.
87
+ * @param {number} b2 Byte 2.
88
+ * @return {number} Row index.
89
89
  * @private
90
90
  */
91
91
  pacToRow_(b1, b2) {
@@ -106,8 +106,8 @@ shaka.cea.Cea608DataChannel = class {
106
106
  * PAC - Preamble Address Code.
107
107
  * b1 is of the form |P|0|0|1|C|0|ROW|
108
108
  * b2 is of the form |P|1|N|ATTRIBUTE|U|
109
- * @param {!number} b1 Byte 1.
110
- * @param {!number} b2 Byte 2.
109
+ * @param {number} b1 Byte 1.
110
+ * @param {number} b2 Byte 2.
111
111
  * @private
112
112
  */
113
113
  controlPac_(b1, b2) {
@@ -165,7 +165,7 @@ shaka.cea.Cea608DataChannel = class {
165
165
 
166
166
  /**
167
167
  * Mid-Row control code handler.
168
- * @param {!number} b2 Byte #2.
168
+ * @param {number} b2 Byte #2.
169
169
  * @private
170
170
  */
171
171
  controlMidrow_(b2) {
@@ -198,8 +198,8 @@ shaka.cea.Cea608DataChannel = class {
198
198
 
199
199
  /**
200
200
  * Background attribute control code handler.
201
- * @param {!number} b1 Byte #1
202
- * @param {!number} b2 Byte #2.
201
+ * @param {number} b1 Byte #1
202
+ * @param {number} b2 Byte #2.
203
203
  * @private
204
204
  */
205
205
  controlBackgroundAttribute_(b1, b2) {
@@ -279,7 +279,7 @@ shaka.cea.Cea608DataChannel = class {
279
279
  * CR only affects scroll windows (Rollup and Text modes).
280
280
  * Any currently buffered line needs to be emitted, along
281
281
  * with a window scroll action.
282
- * @param {!number} pts in seconds.
282
+ * @param {number} pts in seconds.
283
283
  * @return {?shaka.cea.ICaptionDecoder.ClosedCaption}
284
284
  * @private
285
285
  */
@@ -311,8 +311,8 @@ shaka.cea.Cea608DataChannel = class {
311
311
  * Handles RU2, RU3, RU4 - Roll-Up, N rows.
312
312
  * If in TEXT, POPON or PAINTON, any displayed captions are erased.
313
313
  * This means must force emit entire display buffer.
314
- * @param {!number} scrollSize New scroll window size.
315
- * @param {!number} pts
314
+ * @param {number} scrollSize New scroll window size.
315
+ * @param {number} pts
316
316
  * @return {?shaka.cea.ICaptionDecoder.ClosedCaption}
317
317
  * @private
318
318
  */
@@ -356,7 +356,7 @@ shaka.cea.Cea608DataChannel = class {
356
356
  * Handles EDM - Erase Displayed Mem
357
357
  * Mode check:
358
358
  * EDM affects all captioning modes (but not Text mode);
359
- * @param {!number} pts
359
+ * @param {number} pts
360
360
  * @return {?shaka.cea.ICaptionDecoder.ClosedCaption}
361
361
  * @private
362
362
  */
@@ -375,7 +375,7 @@ shaka.cea.Cea608DataChannel = class {
375
375
  /**
376
376
  * Handles RDC - Resume Direct Captions. Initiates Paint-On captioning mode.
377
377
  * RDC does not affect current display, so nothing needs to be forced out yet.
378
- * @param {!number} pts in seconds
378
+ * @param {number} pts in seconds
379
379
  * @private
380
380
  */
381
381
  controlRdc_(pts) {
@@ -403,7 +403,7 @@ shaka.cea.Cea608DataChannel = class {
403
403
  * Handles EOC - End Of Caption (flip mem)
404
404
  * This forces Pop-On mode, and swaps the displayed and nondisplayed memories.
405
405
  * @private
406
- * @param {!number} pts
406
+ * @param {number} pts
407
407
  * @return {?shaka.cea.ICaptionDecoder.ClosedCaption}
408
408
  */
409
409
  controlEoc_(pts) {
@@ -472,8 +472,8 @@ shaka.cea.Cea608DataChannel = class {
472
472
 
473
473
  /**
474
474
  * Handles a Basic North American byte pair.
475
- * @param {!number} b1 Byte 1.
476
- * @param {!number} b2 Byte 2.
475
+ * @param {number} b1 Byte 1.
476
+ * @param {number} b2 Byte 2.
477
477
  */
478
478
  handleBasicNorthAmericanChar(b1, b2) {
479
479
  this.curbuf_.addChar(
@@ -484,8 +484,8 @@ shaka.cea.Cea608DataChannel = class {
484
484
 
485
485
  /**
486
486
  * Handles an Extended Western European byte pair.
487
- * @param {!number} b1 Byte 1.
488
- * @param {!number} b2 Byte 2.
487
+ * @param {number} b1 Byte 1.
488
+ * @param {number} b2 Byte 2.
489
489
  * @private
490
490
  */
491
491
  handleExtendedWesternEuropeanChar_(b1, b2) {
@@ -539,9 +539,9 @@ shaka.cea.Cea608DataChannel = class {
539
539
 
540
540
  /**
541
541
  * Checks if this is a Miscellaneous control code.
542
- * @param {!number} b1 Byte 1.
543
- * @param {!number} b2 Byte 2.
544
- * @return {!boolean}
542
+ * @param {number} b1 Byte 1.
543
+ * @param {number} b2 Byte 2.
544
+ * @return {boolean}
545
545
  * @private
546
546
  */
547
547
  isMiscellaneous_(b1, b2) {
@@ -553,9 +553,9 @@ shaka.cea.Cea608DataChannel = class {
553
553
 
554
554
  /**
555
555
  * Checks if this is a PAC control code.
556
- * @param {!number} b1 Byte 1.
557
- * @param {!number} b2 Byte 2.
558
- * @return {!boolean}
556
+ * @param {number} b1 Byte 1.
557
+ * @param {number} b2 Byte 2.
558
+ * @return {boolean}
559
559
  * @private
560
560
  */
561
561
  isPAC_(b1, b2) {
@@ -567,9 +567,9 @@ shaka.cea.Cea608DataChannel = class {
567
567
 
568
568
  /**
569
569
  * Checks if this is a Midrow style change control code.
570
- * @param {!number} b1 Byte 1.
571
- * @param {!number} b2 Byte 2.
572
- * @return {!boolean}
570
+ * @param {number} b1 Byte 1.
571
+ * @param {number} b2 Byte 2.
572
+ * @return {boolean}
573
573
  * @private
574
574
  */
575
575
  isMidrowStyleChange_(b1, b2) {
@@ -581,9 +581,9 @@ shaka.cea.Cea608DataChannel = class {
581
581
 
582
582
  /**
583
583
  * Checks if this is a background attribute control code.
584
- * @param {!number} b1 Byte 1.
585
- * @param {!number} b2 Byte 2.
586
- * @return {!boolean}
584
+ * @param {number} b1 Byte 1.
585
+ * @param {number} b2 Byte 2.
586
+ * @return {boolean}
587
587
  * @private
588
588
  */
589
589
  isBackgroundAttribute_(b1, b2) {
@@ -596,9 +596,9 @@ shaka.cea.Cea608DataChannel = class {
596
596
 
597
597
  /**
598
598
  * Checks if the character is in the Special North American char. set.
599
- * @param {!number} b1 Byte 1.
600
- * @param {!number} b2 Byte 2.
601
- * @return {!boolean}
599
+ * @param {number} b1 Byte 1.
600
+ * @param {number} b2 Byte 2.
601
+ * @return {boolean}
602
602
  * @private
603
603
  */
604
604
  isSpecialNorthAmericanChar_(b1, b2) {
@@ -610,9 +610,9 @@ shaka.cea.Cea608DataChannel = class {
610
610
 
611
611
  /**
612
612
  * Checks if the character is in the Extended Western European char. set.
613
- * @param {!number} b1 Byte 1.
614
- * @param {!number} b2 Byte 2.
615
- * @return {!boolean}
613
+ * @param {number} b1 Byte 1.
614
+ * @param {number} b2 Byte 2.
615
+ * @return {boolean}
616
616
  * @private
617
617
  */
618
618
  isExtendedWesternEuropeanChar_(b1, b2) {
@@ -624,8 +624,8 @@ shaka.cea.Cea608DataChannel = class {
624
624
 
625
625
  /**
626
626
  * Checks if the data contains a control code.
627
- * @param {!number} b1 Byte 1.
628
- * @return {!boolean}
627
+ * @param {number} b1 Byte 1.
628
+ * @return {boolean}
629
629
  */
630
630
  static isControlCode(b1) {
631
631
  // For control codes, the first byte takes the following form:
@@ -636,7 +636,7 @@ shaka.cea.Cea608DataChannel = class {
636
636
 
637
637
  /**
638
638
  * Command codes.
639
- * @enum {!number}
639
+ * @enum {number}
640
640
  * @private
641
641
  */
642
642
  shaka.cea.Cea608DataChannel.MiscCmd_ = {
@@ -691,7 +691,7 @@ shaka.cea.Cea608DataChannel.MiscCmd_ = {
691
691
 
692
692
  /**
693
693
  * Caption type.
694
- * @private @const @enum {!number}
694
+ * @private @const @enum {number}
695
695
  */
696
696
  shaka.cea.Cea608DataChannel.CaptionType = {
697
697
  NONE: 0,
@@ -702,7 +702,7 @@ shaka.cea.Cea608DataChannel.CaptionType = {
702
702
  };
703
703
 
704
704
  /**
705
- * @const {!Array<!string>}
705
+ * @const {!Array<string>}
706
706
  */
707
707
  shaka.cea.Cea608DataChannel.BG_COLORS = [
708
708
  'black',
@@ -716,7 +716,7 @@ shaka.cea.Cea608DataChannel.BG_COLORS = [
716
716
  ];
717
717
 
718
718
  /**
719
- * @const {!Array<!string>}
719
+ * @const {!Array<string>}
720
720
  */
721
721
  shaka.cea.Cea608DataChannel.TEXT_COLORS = [
722
722
  'white',
@@ -743,20 +743,20 @@ shaka.cea.Cea608DataChannel.Style;
743
743
  /**
744
744
  * CEA closed captions packet.
745
745
  * @typedef {{
746
- * pts: !number,
747
- * type: !number,
748
- * ccData1: !number,
749
- * ccData2: !number,
750
- * order: !number
746
+ * pts: number,
747
+ * type: number,
748
+ * ccData1: number,
749
+ * ccData2: number,
750
+ * order: number
751
751
  * }}
752
752
  *
753
- * @property {!number} pts
753
+ * @property {number} pts
754
754
  * Presentation timestamp (in second) at which this packet was received.
755
- * @property {!number} type
755
+ * @property {number} type
756
756
  * Type of the packet. Either 0 or 1, representing the CEA-608 field.
757
- * @property {!number} ccData1 CEA-608 byte 1.
758
- * @property {!number} ccData2 CEA-608 byte 2.
759
- * @property {(!number)} order
757
+ * @property {number} ccData1 CEA-608 byte 1.
758
+ * @property {number} ccData2 CEA-608 byte 2.
759
+ * @property {number} order
760
760
  * A number indicating the order this packet was received in a sequence
761
761
  * of packets. Used to break ties in a stable sorting algorithm
762
762
  */
@@ -8,7 +8,7 @@ goog.provide('shaka.cea.Cea608Memory');
8
8
 
9
9
  goog.require('shaka.cea.CeaUtils');
10
10
  goog.require('shaka.text.Cue');
11
- goog.requireType('shaka.cea.ICaptionDecoder.ClosedCaption');
11
+ goog.requireType('shaka.cea.ICaptionDecoder');
12
12
 
13
13
 
14
14
  /**
@@ -16,8 +16,8 @@ goog.requireType('shaka.cea.ICaptionDecoder.ClosedCaption');
16
16
  */
17
17
  shaka.cea.Cea608Memory = class {
18
18
  /**
19
- * @param {!number} fieldNum Field number.
20
- * @param {!number} channelNum Channel number.
19
+ * @param {number} fieldNum Field number.
20
+ * @param {number} channelNum Channel number.
21
21
  */
22
22
  constructor(fieldNum, channelNum) {
23
23
  /**
@@ -28,45 +28,45 @@ shaka.cea.Cea608Memory = class {
28
28
 
29
29
  /**
30
30
  * Current row.
31
- * @private {!number}
31
+ * @private {number}
32
32
  */
33
33
  this.row_ = 1;
34
34
 
35
35
  /**
36
36
  * Number of rows in the scroll window. Used for rollup mode.
37
- * @private {!number}
37
+ * @private {number}
38
38
  */
39
39
  this.scrollRows_ = 0;
40
40
 
41
41
  /**
42
42
  * Field number.
43
- * @private {!number}
43
+ * @private {number}
44
44
  */
45
45
  this.fieldNum_ = fieldNum;
46
46
 
47
47
  /**
48
48
  * Channel number.
49
- * @private {!number}
49
+ * @private {number}
50
50
  */
51
51
  this.channelNum_ = channelNum;
52
52
 
53
53
  /**
54
- * @private {!boolean}
54
+ * @private {boolean}
55
55
  */
56
56
  this.underline_ = false;
57
57
 
58
58
  /**
59
- * @private {!boolean}
59
+ * @private {boolean}
60
60
  */
61
61
  this.italics_ = false;
62
62
 
63
63
  /**
64
- * @private {!string}
64
+ * @private {string}
65
65
  */
66
66
  this.textColor_ = shaka.cea.CeaUtils.DEFAULT_TXT_COLOR;
67
67
 
68
68
  /**
69
- * @private {!string}
69
+ * @private {string}
70
70
  */
71
71
  this.backgroundColor_ = shaka.cea.CeaUtils.DEFAULT_BG_COLOR;
72
72
 
@@ -75,8 +75,8 @@ shaka.cea.Cea608Memory = class {
75
75
 
76
76
  /**
77
77
  * Emits a closed caption based on the state of the buffer.
78
- * @param {!number} startTime Start time of the cue.
79
- * @param {!number} endTime End time of the cue.
78
+ * @param {number} startTime Start time of the cue.
79
+ * @param {number} endTime End time of the cue.
80
80
  * @return {?shaka.cea.ICaptionDecoder.ClosedCaption}
81
81
  */
82
82
  forceEmit(startTime, endTime) {
@@ -96,28 +96,28 @@ shaka.cea.Cea608Memory = class {
96
96
  }
97
97
 
98
98
  /**
99
- * @return {!number}
99
+ * @return {number}
100
100
  */
101
101
  getRow() {
102
102
  return this.row_;
103
103
  }
104
104
 
105
105
  /**
106
- * @param {!number} row
106
+ * @param {number} row
107
107
  */
108
108
  setRow(row) {
109
109
  this.row_ = row;
110
110
  }
111
111
 
112
112
  /**
113
- * @return {!number}
113
+ * @return {number}
114
114
  */
115
115
  getScrollSize() {
116
116
  return this.scrollRows_;
117
117
  }
118
118
 
119
119
  /**
120
- * @param {!number} scrollRows
120
+ * @param {number} scrollRows
121
121
  */
122
122
  setScrollSize(scrollRows) {
123
123
  this.scrollRows_ = scrollRows;
@@ -126,7 +126,7 @@ shaka.cea.Cea608Memory = class {
126
126
  /**
127
127
  * Adds a character to the buffer.
128
128
  * @param {!shaka.cea.Cea608Memory.CharSet} set Character set.
129
- * @param {!number} b CC byte to add.
129
+ * @param {number} b CC byte to add.
130
130
  */
131
131
  addChar(set, b) {
132
132
  // Valid chars are in the range [0x20, 0x7f]
@@ -179,9 +179,9 @@ shaka.cea.Cea608Memory = class {
179
179
 
180
180
  /**
181
181
  * Moves rows of characters.
182
- * @param {!number} dst Destination row index.
183
- * @param {!number} src Source row index.
184
- * @param {!number} count Count of rows to move.
182
+ * @param {number} dst Destination row index.
183
+ * @param {number} src Source row index.
184
+ * @param {number} count Count of rows to move.
185
185
  */
186
186
  moveRows(dst, src, count) {
187
187
  if (dst >= src) {
@@ -197,8 +197,8 @@ shaka.cea.Cea608Memory = class {
197
197
 
198
198
  /**
199
199
  * Resets rows of characters.
200
- * @param {!number} idx Starting index.
201
- * @param {!number} count Count of rows to reset.
200
+ * @param {number} idx Starting index.
201
+ * @param {number} count Count of rows to reset.
202
202
  */
203
203
  resetRows(idx, count) {
204
204
  for (let i = 0; i <= count; i++) {
@@ -223,28 +223,28 @@ shaka.cea.Cea608Memory = class {
223
223
  }
224
224
 
225
225
  /**
226
- * @param {!boolean} underline
226
+ * @param {boolean} underline
227
227
  */
228
228
  setUnderline(underline) {
229
229
  this.underline_ = underline;
230
230
  }
231
231
 
232
232
  /**
233
- * @param {!boolean} italics
233
+ * @param {boolean} italics
234
234
  */
235
235
  setItalics(italics) {
236
236
  this.italics_ = italics;
237
237
  }
238
238
 
239
239
  /**
240
- * @param {!string} color
240
+ * @param {string} color
241
241
  */
242
242
  setTextColor(color) {
243
243
  this.textColor_ = color;
244
244
  }
245
245
 
246
246
  /**
247
- * @param {!string} color
247
+ * @param {string} color
248
248
  */
249
249
  setBackgroundColor(color) {
250
250
  this.backgroundColor_ = color;
@@ -253,13 +253,13 @@ shaka.cea.Cea608Memory = class {
253
253
 
254
254
  /**
255
255
  * Maximum number of rows in the buffer.
256
- * @const {!number}
256
+ * @const {number}
257
257
  */
258
258
  shaka.cea.Cea608Memory.CC_ROWS = 15;
259
259
 
260
260
  /**
261
261
  * Characters sets.
262
- * @const @enum {!number}
262
+ * @const @enum {number}
263
263
  */
264
264
  shaka.cea.Cea608Memory.CharSet = {
265
265
  BASIC_NORTH_AMERICAN: 0,
@@ -270,7 +270,7 @@ shaka.cea.Cea608Memory.CharSet = {
270
270
 
271
271
  /**
272
272
  * Basic North American char set deviates from ASCII with these exceptions.
273
- * @private @const {!Map<!number, !string>}
273
+ * @private @const {!Map<number, string>}
274
274
  */
275
275
  shaka.cea.Cea608Memory.CharSet.BasicNorthAmericanChars = new Map([
276
276
  [0x27, '’'], [0x2a, 'á'], [0x5c, 'é'], [0x5c, 'é'], [0x5e, 'í'], [0x5f, 'ó'],
@@ -280,7 +280,7 @@ shaka.cea.Cea608Memory.CharSet.BasicNorthAmericanChars = new Map([
280
280
  /**
281
281
  * Special North American char set.
282
282
  * Note: Transparent Space is currently implemented as a regular space.
283
- * @private @const {!Map<!number, !string>}
283
+ * @private @const {!Map<number, string>}
284
284
  */
285
285
  shaka.cea.Cea608Memory.CharSet.SpecialNorthAmericanChars = new Map([
286
286
  [0x30, '®'], [0x31, '°'], [0x32, '½'], [0x33, '¿'], [0x34, '™'], [0x35, '¢'],
@@ -290,7 +290,7 @@ shaka.cea.Cea608Memory.CharSet.SpecialNorthAmericanChars = new Map([
290
290
 
291
291
  /**
292
292
  * Extended Spanish/Misc/French char set.
293
- * @private @const {!Map<!number, !string>}
293
+ * @private @const {!Map<number, string>}
294
294
  */
295
295
  shaka.cea.Cea608Memory.CharSet.ExtendedSpanishFrench = new Map([
296
296
  [0x20, 'Á'], [0x21, 'É'], [0x22, 'Ó'], [0x23, 'Ú'], [0x24, 'Ü'], [0x25, 'ü'],
@@ -303,7 +303,7 @@ shaka.cea.Cea608Memory.CharSet.ExtendedSpanishFrench = new Map([
303
303
 
304
304
  /**
305
305
  * Extended Portuguese/German/Danish char set.
306
- * @private @const {!Map<!number, !string>}
306
+ * @private @const {!Map<number, string>}
307
307
  */
308
308
  shaka.cea.Cea608Memory.CharSet.ExtendedPortugueseGerman = new Map([
309
309
  [0x20, 'Ã'], [0x21, 'ã'], [0x22, 'Í'], [0x23, 'Ì'], [0x24, 'ì'], [0x25, 'Ò'],