shaka-player 4.10.13 → 4.11.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 (91) hide show
  1. package/README.md +5 -1
  2. package/dist/controls.css +3 -3
  3. package/dist/controls.css.map +1 -1
  4. package/dist/deps.js +11 -11
  5. package/dist/locales.js +38 -34
  6. package/dist/shaka-player.compiled.d.ts +68 -33
  7. package/dist/shaka-player.compiled.debug.d.ts +68 -33
  8. package/dist/shaka-player.compiled.debug.externs.js +584 -544
  9. package/dist/shaka-player.compiled.debug.js +715 -676
  10. package/dist/shaka-player.compiled.debug.map +4 -4
  11. package/dist/shaka-player.compiled.externs.js +584 -544
  12. package/dist/shaka-player.compiled.js +1394 -1371
  13. package/dist/shaka-player.compiled.map +4 -4
  14. package/dist/shaka-player.ui.d.ts +76 -34
  15. package/dist/shaka-player.ui.debug.d.ts +76 -34
  16. package/dist/shaka-player.ui.debug.externs.js +77 -26
  17. package/dist/shaka-player.ui.debug.js +774 -720
  18. package/dist/shaka-player.ui.debug.map +4 -4
  19. package/dist/shaka-player.ui.externs.js +77 -26
  20. package/dist/shaka-player.ui.js +1649 -1617
  21. package/dist/shaka-player.ui.map +4 -4
  22. package/externs/mediasession.js +10 -1
  23. package/externs/shaka/ads.js +79 -2
  24. package/externs/shaka/manifest.js +6 -1
  25. package/externs/shaka/manifest_parser.js +6 -2
  26. package/externs/shaka/net.js +23 -2
  27. package/externs/shaka/player.js +414 -103
  28. package/externs/shaka/text.js +2 -1
  29. package/lib/abr/simple_abr_manager.js +5 -0
  30. package/lib/ads/ad_manager.js +45 -1
  31. package/lib/ads/ad_utils.js +124 -1
  32. package/lib/ads/interstitial_ad.js +9 -2
  33. package/lib/ads/interstitial_ad_manager.js +216 -101
  34. package/lib/ads/media_tailor_ad.js +1 -39
  35. package/lib/ads/media_tailor_ad_manager.js +32 -16
  36. package/lib/cea/cea608_data_channel.js +40 -8
  37. package/lib/cea/cea608_memory.js +28 -0
  38. package/lib/dash/dash_parser.js +162 -25
  39. package/lib/dash/segment_base.js +3 -2
  40. package/lib/dash/segment_list.js +6 -3
  41. package/lib/dash/segment_template.js +104 -20
  42. package/lib/hls/hls_parser.js +319 -215
  43. package/lib/media/drm_engine.js +11 -3
  44. package/lib/media/media_source_engine.js +0 -8
  45. package/lib/media/preload_manager.js +16 -4
  46. package/lib/media/segment_reference.js +3 -0
  47. package/lib/media/segment_utils.js +8 -1
  48. package/lib/media/streaming_engine.js +10 -6
  49. package/lib/mss/mss_parser.js +14 -2
  50. package/lib/net/http_fetch_plugin.js +12 -5
  51. package/lib/net/http_xhr_plugin.js +7 -3
  52. package/lib/net/networking_engine.js +21 -1
  53. package/lib/offline/manifest_converter.js +1 -0
  54. package/lib/offline/storage.js +1 -0
  55. package/lib/player.js +336 -121
  56. package/lib/text/cue.js +373 -0
  57. package/lib/text/mp4_ttml_parser.js +51 -1
  58. package/lib/text/mp4_vtt_parser.js +2 -5
  59. package/lib/text/sbv_text_parser.js +2 -31
  60. package/lib/text/srt_text_parser.js +1 -1
  61. package/lib/text/text_engine.js +1 -1
  62. package/lib/text/text_utils.js +1 -0
  63. package/lib/text/ttml_text_parser.js +14 -4
  64. package/lib/text/ui_text_displayer.js +0 -4
  65. package/lib/text/vtt_text_parser.js +10 -415
  66. package/lib/util/abortable_operation.js +8 -0
  67. package/lib/util/cmcd_manager.js +38 -0
  68. package/lib/util/error.js +16 -0
  69. package/lib/util/fake_event.js +1 -0
  70. package/lib/util/manifest_parser_utils.js +12 -3
  71. package/lib/util/player_configuration.js +4 -2
  72. package/lib/util/stream_utils.js +57 -2
  73. package/lib/util/tXml.js +2 -1
  74. package/lib/util/text_parser.js +46 -0
  75. package/lib/util/ts_parser.js +32 -3
  76. package/package.json +1 -1
  77. package/shaka-player.uncompiled.js +1 -1
  78. package/ui/chapter_selection.js +179 -0
  79. package/ui/controls.js +151 -0
  80. package/ui/enums.js +1 -0
  81. package/ui/externs/ui.js +7 -1
  82. package/ui/less/containers.less +3 -4
  83. package/ui/less/overflow_menu.less +5 -0
  84. package/ui/less/tooltip.less +1 -1
  85. package/ui/locales/en.json +1 -0
  86. package/ui/locales/es.json +1 -0
  87. package/ui/locales/fr.json +1 -0
  88. package/ui/locales/source.json +4 -0
  89. package/ui/seek_bar.js +3 -2
  90. package/ui/ui.js +2 -0
  91. package/lib/polyfill/abort_controller.js +0 -158
@@ -36,9 +36,18 @@ const MediaSession = class {
36
36
  setActionHandler(type, callback) {
37
37
  /** @type {string} */
38
38
  this.type = type;
39
- /** @type {!function(!{action: string, seekOffset: ?number})} */
39
+
40
+ /** @type {!function(!{action: string, seekOffset: ?number,
41
+ * seekTime: ?number})}
42
+ */
40
43
  this.callback = callback;
41
44
  }
45
+
46
+ /**
47
+ * @param {?{duration: ?number, playbackRate: ?number,
48
+ * position: ?number}=} stateDict
49
+ */
50
+ setPositionState(stateDict) {}
42
51
  };
43
52
 
44
53
 
@@ -57,6 +57,65 @@ shaka.extern.AdsStats;
57
57
  shaka.extern.AdCuePoint;
58
58
 
59
59
 
60
+ /**
61
+ * @typedef {{
62
+ * id: ?string,
63
+ * startTime: number,
64
+ * endTime: ?number,
65
+ * uri: string,
66
+ * isSkippable: boolean,
67
+ * skipOffset: ?number,
68
+ * canJump: boolean,
69
+ * resumeOffset: ?number,
70
+ * playoutLimit: ?number,
71
+ * once: boolean,
72
+ * pre: boolean,
73
+ * post: boolean,
74
+ * timelineRange: boolean
75
+ * }}
76
+ *
77
+ * @description
78
+ * Contains the ad interstitial info.
79
+ *
80
+ * @property {?string} id
81
+ * The id of the interstitial.
82
+ * @property {number} startTime
83
+ * The start time of the interstitial.
84
+ * @property {?number} endTime
85
+ * The end time of the interstitial.
86
+ * @property {string} uri
87
+ * The uri of the interstitial, can be any type that
88
+ * ShakaPlayer supports (either in MSE or src=)
89
+ * @property {boolean} isSkippable
90
+ * Indicate if the interstitial is skippable.
91
+ * @property {?number} skipOffset
92
+ * Time value that identifies when skip controls are made available to the
93
+ * end user.
94
+ * @property {boolean} canJump
95
+ * Indicate if the interstitial is jumpable.
96
+ * @property {?number} resumeOffset
97
+ * Indicates where the primary playback will resume after the interstitial
98
+ * plays. It is expressed as a time lag from when interstitial playback was
99
+ * scheduled on the primary player's timeline. For live ad replacement it
100
+ * must be null.
101
+ * @property {?number} playoutLimit
102
+ * Indicate a limit for the playout time of the entire interstitial.
103
+ * @property {boolean} once
104
+ * Indicates that the interstitial should only be played once.
105
+ * @property {boolean} pre
106
+ * Indicates that an action is to be triggered before playback of the
107
+ * primary asset begins, regardless of where playback begins in the primary
108
+ * asset.
109
+ * @property {boolean} post
110
+ * Indicates that an action is to be triggered after the primary asset has
111
+ * been played to its end without error.
112
+ * @property {boolean} timelineRange
113
+ * Indicates whether the interstitial should be presented in a timeline UI
114
+ * as a single point or as a range.
115
+ */
116
+ shaka.extern.AdInterstitial;
117
+
118
+
60
119
  /**
61
120
  * An object that's responsible for all the ad-related logic
62
121
  * in the player.
@@ -187,9 +246,27 @@ shaka.extern.IAdManager = class extends EventTarget {
187
246
  /**
188
247
  * @param {!shaka.Player} basePlayer
189
248
  * @param {!HTMLMediaElement} baseVideo
190
- * @param {shaka.extern.Interstitial} interstitial
249
+ * @param {shaka.extern.HLSInterstitial} interstitial
250
+ */
251
+ onHLSInterstitialMetadata(basePlayer, baseVideo, interstitial) {}
252
+
253
+ /**
254
+ * @param {!shaka.Player} basePlayer
255
+ * @param {!HTMLMediaElement} baseVideo
256
+ * @param {shaka.extern.TimelineRegionInfo} region
257
+ */
258
+ onDASHInterstitialMetadata(basePlayer, baseVideo, region) {}
259
+
260
+ /**
261
+ * @param {shaka.extern.AdInterstitial} interstitial
262
+ */
263
+ addCustomInterstitial(interstitial) {}
264
+
265
+ /**
266
+ * @param {string} url
267
+ * @return {!Promise}
191
268
  */
192
- onInterstitialMetadata(basePlayer, baseVideo, interstitial) {}
269
+ addAdUrlInterstitial(url) {}
193
270
  };
194
271
 
195
272
 
@@ -25,7 +25,8 @@
25
25
  * nextUrl: ?string,
26
26
  * periodCount: number,
27
27
  * gapCount: number,
28
- * isLowLatency: boolean
28
+ * isLowLatency: boolean,
29
+ * startTime: ?number
29
30
  * }}
30
31
  *
31
32
  * @description
@@ -111,6 +112,10 @@
111
112
  * If in src= mode or nothing is loaded, NaN.
112
113
  * @property {bolean} isLowLatency
113
114
  * If true, the manifest is Low Latency.
115
+ * @property {?number} startTime
116
+ * Indicate the startTime of the playback, when <code>startTime</code> is
117
+ * <code>null</code>, playback will start at the default start time.
118
+ * Note: It only overrides the load startTime when it is not defined.
114
119
  *
115
120
  * @exportDoc
116
121
  */
@@ -47,9 +47,10 @@ shaka.extern.ManifestParser = class {
47
47
  * configuration changes. Will be called at least once before start().
48
48
  *
49
49
  * @param {shaka.extern.ManifestConfiguration} config
50
+ * @param {(function():boolean)=} isPreloadFn
50
51
  * @exportDoc
51
52
  */
52
- configure(config) {}
53
+ configure(config, isPreloadFn) {}
53
54
 
54
55
  /**
55
56
  * Initialize and start the parser. When |start| resolves, it should return
@@ -139,7 +140,8 @@ shaka.extern.ManifestParser = class {
139
140
  * getBandwidthEstimate: function():number,
140
141
  * onMetadata: function(string, number, ?number,
141
142
  * !Array.<shaka.extern.MetadataFrame>),
142
- * disableStream: function(!shaka.extern.Stream)
143
+ * disableStream: function(!shaka.extern.Stream),
144
+ * addFont: function(string, string)
143
145
  * }}
144
146
  *
145
147
  * @description
@@ -184,6 +186,8 @@ shaka.extern.ManifestParser = class {
184
186
  * @property {function(!shaka.extern.Stream)} disableStream
185
187
  * Called to temporarily disable a stream i.e. disabling all variant
186
188
  * containing said stream.
189
+ * @property {function(string, string)} addFont
190
+ * Called when a new font needs to be added.
187
191
  * @exportDoc
188
192
  */
189
193
  shaka.extern.ManifestParser.PlayerInterface;
@@ -169,7 +169,8 @@ shaka.extern.Response;
169
169
  * shaka.extern.Request,
170
170
  * shaka.net.NetworkingEngine.RequestType,
171
171
  * shaka.extern.ProgressUpdated,
172
- * shaka.extern.HeadersReceived):
172
+ * shaka.extern.HeadersReceived,
173
+ * shaka.extern.SchemePluginConfig):
173
174
  * !shaka.extern.IAbortableOperation.<shaka.extern.Response>}
174
175
  * @description
175
176
  * Defines a plugin that handles a specific scheme.
@@ -185,6 +186,23 @@ shaka.extern.Response;
185
186
  shaka.extern.SchemePlugin;
186
187
 
187
188
 
189
+ /**
190
+ * @typedef {{
191
+ * minBytesForProgressEvents: (number|undefined)
192
+ * }}
193
+ *
194
+ * @description
195
+ * Defines configuration object to use by SchemePlugins.
196
+ *
197
+ * @property {(number|undefined)} minBytesForProgressEvents
198
+ * Defines minimum number of bytes that should be use to emit progress event,
199
+ * if possible.
200
+ *
201
+ * @exportDoc
202
+ */
203
+ shaka.extern.SchemePluginConfig;
204
+
205
+
188
206
  /**
189
207
  * @typedef {function(number, number, number)}
190
208
  *
@@ -217,7 +235,8 @@ shaka.extern.HeadersReceived;
217
235
  * @typedef {{
218
236
  * type: (shaka.net.NetworkingEngine.AdvancedRequestType|undefined),
219
237
  * stream: (shaka.extern.Stream|undefined),
220
- * segment: (shaka.media.SegmentReference|undefined)
238
+ * segment: (shaka.media.SegmentReference|undefined),
239
+ * isPreload: (boolean|undefined)
221
240
  * }}
222
241
  *
223
242
  * @description
@@ -229,6 +248,8 @@ shaka.extern.HeadersReceived;
229
248
  * The duration of the segment in seconds
230
249
  * @property {shaka.media.SegmentReference=} segment
231
250
  * The request's segment reference
251
+ * @property {boolean=} isPreload
252
+ * Whether the request came from a preload or a normal load.
232
253
  * @exportDoc
233
254
  */
234
255
  shaka.extern.RequestContext;