@castlabs/prestoplay 6.14.1 → 6.15.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 (61) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/cjs/cl.adobe.js +3 -3
  3. package/cjs/cl.airplay.js +3 -3
  4. package/cjs/cl.broadpeak.js +7 -7
  5. package/cjs/cl.cast.js +111 -109
  6. package/cjs/cl.conviva.js +33 -33
  7. package/cjs/cl.core.js +549 -536
  8. package/cjs/cl.crypto.js +9 -9
  9. package/cjs/cl.dash.js +74 -73
  10. package/cjs/cl.externs.js +180 -47
  11. package/cjs/cl.freewheel.js +23 -23
  12. package/cjs/cl.hls.js +68 -68
  13. package/cjs/cl.hlssmpte.js +6 -6
  14. package/cjs/cl.htmlcue.js +29 -29
  15. package/cjs/cl.ima.js +23 -23
  16. package/cjs/cl.mse.js +289 -264
  17. package/cjs/cl.muxdata.js +15 -15
  18. package/cjs/cl.onboard.js +3 -3
  19. package/cjs/cl.persistent.js +13 -13
  20. package/cjs/cl.playlist.js +6 -6
  21. package/cjs/cl.simid.js +15 -15
  22. package/cjs/cl.smooth.js +72 -71
  23. package/cjs/cl.thumbnails.js +26 -26
  24. package/cjs/cl.tizen.js +71 -71
  25. package/cjs/cl.ttml.js +28 -28
  26. package/cjs/cl.verimatrix.js +5 -5
  27. package/cjs/cl.vimond.js +13 -13
  28. package/cjs/cl.vr.js +19 -19
  29. package/cjs/cl.vtt.js +14 -14
  30. package/cjs/cl.youbora.js +17 -17
  31. package/cl.adobe.js +3 -3
  32. package/cl.airplay.js +3 -3
  33. package/cl.broadpeak.js +5 -5
  34. package/cl.cast.js +89 -88
  35. package/cl.conviva.js +27 -27
  36. package/cl.core.js +454 -442
  37. package/cl.crypto.js +9 -9
  38. package/cl.dash.js +70 -68
  39. package/cl.externs.js +176 -47
  40. package/cl.freewheel.js +19 -19
  41. package/cl.hls.js +71 -71
  42. package/cl.hlssmpte.js +5 -5
  43. package/cl.htmlcue.js +26 -26
  44. package/cl.ima.js +17 -17
  45. package/cl.mse.js +254 -235
  46. package/cl.muxdata.js +13 -13
  47. package/cl.onboard.js +4 -4
  48. package/cl.persistent.js +10 -10
  49. package/cl.playlist.js +5 -5
  50. package/cl.simid.js +13 -13
  51. package/cl.smooth.js +59 -59
  52. package/cl.thumbnails.js +19 -19
  53. package/cl.tizen.js +57 -57
  54. package/cl.ttml.js +22 -22
  55. package/cl.verimatrix.js +4 -4
  56. package/cl.vimond.js +8 -8
  57. package/cl.vr.js +15 -15
  58. package/cl.vtt.js +12 -12
  59. package/cl.youbora.js +15 -15
  60. package/package.json +1 -1
  61. package/typings.d.ts +347 -57
package/typings.d.ts CHANGED
@@ -1161,6 +1161,13 @@ export namespace clpp {
1161
1161
  * HtmlCue component configuration.
1162
1162
  */
1163
1163
  htmlcue?: Partial<clpp.HtmlCueConfiguration>;
1164
+ /**
1165
+ * A unique identifier of this configuration object.
1166
+ * This attribute is optional, except for configuration objects passed to
1167
+ * {@link clpp.plist.ScPlaylist} for which the ID is mandatory, since we
1168
+ * need a clear way to distinguish different items of the playlist.
1169
+ */
1170
+ id?: string;
1164
1171
  /**
1165
1172
  * Ads plugin configuration.
1166
1173
  */
@@ -1204,6 +1211,10 @@ export namespace clpp {
1204
1211
  * back into foreground.
1205
1212
  */
1206
1213
  pauseWhenInBackground?: boolean;
1214
+ /**
1215
+ * Playlist-related configuration.
1216
+ */
1217
+ playlist?: Partial<clpp.PlaylistConfiguration>;
1207
1218
  /**
1208
1219
  * Defaults to `false`.
1209
1220
  *
@@ -1290,8 +1301,7 @@ export namespace clpp {
1290
1301
  */
1291
1302
  safari?: Partial<clpp.SafariConfiguration>;
1292
1303
  /**
1293
- * SIMID plugin
1294
- * configuration
1304
+ * SIMID plugin configuration
1295
1305
  */
1296
1306
  simid?: Partial<clpp.SimidConfiguration>;
1297
1307
  /**
@@ -1391,6 +1401,49 @@ export namespace clpp {
1391
1401
  webOSStartupPatch: boolean;
1392
1402
  }
1393
1403
 
1404
+ /**
1405
+ * Playlist-related configuration.
1406
+ */
1407
+ export type PlaylistConfiguration = {
1408
+ /**
1409
+ * Defaults to "VOD".
1410
+ *
1411
+ * This option applies to the single-controller playlist and the accepted
1412
+ * values are "VOD" and "DVR". In "VOD" mode the playlist can contain
1413
+ * VOD items only. In "DVR" mode the playlist can contain VOD items and
1414
+ * one DVR item at the end of the playlist.
1415
+ */
1416
+ content?: string;
1417
+ /**
1418
+ * Defaults to false.
1419
+ *
1420
+ * This option applies to the single-controller playlist. If true, the
1421
+ * timeline will be cropped based on the values of `startTime` and `endTime`.
1422
+ */
1423
+ cropTimeline?: boolean;
1424
+ /**
1425
+ * This option applies to the single-controller playlist. It is the time
1426
+ * at which the playlist should stop. The time is relative to the
1427
+ * start of the first playlist item and may span several items.
1428
+ */
1429
+ endTime?: number;
1430
+ /**
1431
+ * This option applies to the single-controller playlist. IT is the time
1432
+ * within the first playlist item at which the playlist should start
1433
+ * playback. The time is relative to the start of the first playlist item.
1434
+ */
1435
+ startTime?: number;
1436
+ /**
1437
+ * Defaults to "basic".
1438
+ *
1439
+ * This option applies to the single-controller playlist and the accepted
1440
+ * values are "basic" and "flat". In "basic" mode each item has its own
1441
+ * timeline, in "flat" mode all items of the playlist are concatenated into
1442
+ * a single timeline.
1443
+ */
1444
+ timeline?: string;
1445
+ }
1446
+
1394
1447
  /**
1395
1448
  * Playlist item.
1396
1449
  */
@@ -2240,14 +2293,22 @@ export namespace clpp {
2240
2293
  * EventStream element. In HLS this is the EXT-X-DATERANGE tag.
2241
2294
  */
2242
2295
  export type TimelineCue = {
2296
+ /**
2297
+ * ID of the configuration object of the asset to which this cue belongs
2298
+ * if it is defined in {@link clpp.PlayerConfiguration}.
2299
+ */
2300
+ configurationId?: string;
2243
2301
  /**
2244
2302
  * The presentation time (in seconds) that the cue should end.
2303
+ * Allowed values follow the same rules as startTime. It is possible
2304
+ * for endTime and startTime to be equal, in which case the cue is
2305
+ * considered to be a discrete point on the timeline.
2245
2306
  */
2246
2307
  endTime: number;
2247
2308
  /**
2248
- * The XML element that defines the Event.
2309
+ * The XML element that defines the Event. Defined only for DASH.
2249
2310
  */
2250
- eventElement: Element;
2311
+ eventElement: Element|null;
2251
2312
  /**
2252
2313
  * Specifies an identifier for this instance of the cue.
2253
2314
  */
@@ -2258,6 +2319,11 @@ export namespace clpp {
2258
2319
  schemeIdUri: string;
2259
2320
  /**
2260
2321
  * The presentation time (in seconds) that the cue should start.
2322
+ * Specifically for VOD streams the startTime is relative to the start of
2323
+ * the stream, so the value is something between 0 and duration.
2324
+ * For live streams the startTime is absolute, so the value is something
2325
+ * between the start of the first period and the end of the last period
2326
+ * of the stream.
2261
2327
  */
2262
2328
  startTime: number;
2263
2329
  /**
@@ -3124,6 +3190,28 @@ export namespace clpp {
3124
3190
  * Triggered when a playlist item has been added, removed or moved.
3125
3191
  */
3126
3192
  PLAYLIST_MODIFIED = "playlist-modified",
3193
+ /**
3194
+ * Triggered when a new timeline window has been added to the timeline of
3195
+ * a single-controller playlist, or when the duration of an existing timeline
3196
+ * window changes.
3197
+ */
3198
+ SC_PLAYLIST_TIMELINE_CHANGED = "sc-playlist-timeline-changed",
3199
+ /**
3200
+ * Triggered when the currently active/selected item of a single-controller
3201
+ * playlist changes.
3202
+ */
3203
+ SC_PLAYLIST_ITEM_CHANGED = "sc-playlist-item-changed",
3204
+ /**
3205
+ * Triggered when playback reaches the end of the last item of
3206
+ * a single-controller playlist, or if `playlist.endTime` is configured
3207
+ * then it's triggered when the end time is reached.
3208
+ */
3209
+ SC_PLAYLIST_ENDED = "sc-playlist-ended",
3210
+ /**
3211
+ * Triggered when the last item of the playlist is an EVENT stream and it
3212
+ * turns from dynamic to static.
3213
+ */
3214
+ SC_PLAYLIST_LIVE_TURNED_STATIC = "sc-playlist-live-turned-static",
3127
3215
  /**
3128
3216
  * Triggered when CDN switch was successful.
3129
3217
  */
@@ -4845,6 +4933,21 @@ export namespace clpp {
4845
4933
  * E.g. it is not a direct parent of the video element.
4846
4934
  */
4847
4935
  INVALID_CONTAINER_ELEMENT = 7006,
4936
+ /**
4937
+ * Error raised when a method is passed an invalid argument.
4938
+ */
4939
+ INVALID_ARGUMENT = 7007,
4940
+ /**
4941
+ * Error raised when two methods which depend on each other are called
4942
+ * in the wrong order.
4943
+ */
4944
+ WRONG_ORDER_OF_OPERATIONS = 7008,
4945
+ /**
4946
+ * Error raised when calling a method which is not supported or passing
4947
+ * arguments or a configuration of arguments that are not supported. This
4948
+ * may also be platform dependent.
4949
+ */
4950
+ NOT_SUPPORTED = 7009,
4848
4951
  /**
4849
4952
  * The provided {@link clpp.PlayerConfiguration} is invalid.
4850
4953
  */
@@ -6427,57 +6530,6 @@ export namespace clpp {
6427
6530
  *
6428
6531
  */
6429
6532
  export class Player {
6430
- /**
6431
- * Player that plays HLS interstitials.
6432
- * Fires events @see {@link clpp.interstitial.Event}.
6433
- * Support:
6434
- *
6435
- * X-ASSET-LIST, X-ASSET-URI, X-RESUME-OFFSET, X-PLAYOUT-LIMIT
6436
- *
6437
- * Limitations:
6438
- *
6439
- *
6440
- * Only supports VOD.
6441
- *
6442
- *
6443
- * Interstitials must not be too close to each other.
6444
- *
6445
- *
6446
- * Interstitials cannot overlap.
6447
- *
6448
- *
6449
- * No error handling (for when some asset/list fails to load).
6450
- *
6451
- *
6452
- * No support for #EXT-X-DATERANGE.CUE
6453
- *
6454
- *
6455
- * No support for X-RESTRICT
6456
- *
6457
- *
6458
- * No support for _HLS_start_offset query in live (because no support
6459
- * for live)
6460
- *
6461
- *
6462
- * No support for _HLS_primary_id
6463
- *
6464
- *
6465
- * TODO configurable re-play of interstitial
6466
- *
6467
- *
6468
- * TODO configurable skipping
6469
- *
6470
- *
6471
- * TODO support live primary asset (working with position)
6472
- *
6473
- *
6474
- * Idea: if MultiController does not release primary player and just stops
6475
- * it, we can save some network requests and context changes. Currently we
6476
- * release the primary player.
6477
- *
6478
- *
6479
- */
6480
- constructor(options: clpp.interstitial.Options);
6481
6533
  /**
6482
6534
  * Request that this object be destroyed, releasing all resources and shutting
6483
6535
  * down all operations. Returns a Promise which is resolved when destruction
@@ -6709,6 +6761,86 @@ export namespace clpp {
6709
6761
  }
6710
6762
  }
6711
6763
 
6764
+ namespace media {
6765
+ export class Timeline {
6766
+ /**
6767
+ * Get the currently active window of the timeline.
6768
+ *
6769
+ * @example // Get the current timeline window.
6770
+ *
6771
+ * const timelineWindow = timeline.getCurrentWindow();
6772
+ */
6773
+ getCurrentWindow(): clpp.media.TimelineWindow|null;
6774
+ /**
6775
+ * Get the index of the currently active window of the timeline.
6776
+ *
6777
+ * @example // Get the index of the current timeline window.
6778
+ *
6779
+ * const index = timeline.getCurrentWindowIndex(); // 0
6780
+ */
6781
+ getCurrentWindowIndex(): number;
6782
+ /**
6783
+ * Get a window of the timeline at the given index.
6784
+ *
6785
+ * @example // Get timeline window at index.
6786
+ *
6787
+ * const timelineWindow = timeline.getWindow(0);
6788
+ */
6789
+ getWindow(index: number): clpp.media.TimelineWindow|null;
6790
+ /**
6791
+ * Get the number of windows in the timeline.
6792
+ *
6793
+ * @example // Get the number of timeline windows.
6794
+ *
6795
+ * const count = timeline.getWindowCount(); // 4
6796
+ */
6797
+ getWindowCount(): number;
6798
+ /**
6799
+ * Get all the windows of the timeline.
6800
+ *
6801
+ * @example // Get all timeline windows.
6802
+ *
6803
+ * const windows = timeline.getWindows(); // [...]
6804
+ */
6805
+ getWindows(): Array<clpp.media.TimelineWindow>;
6806
+ }
6807
+
6808
+ export class TimelineWindow {
6809
+ /**
6810
+ * Get the duration of the timeline window.
6811
+ *
6812
+ * @example // Get the duration.
6813
+ *
6814
+ * const duration = timelineWindow.getDuration(); // 600
6815
+ */
6816
+ getDuration(): number;
6817
+ /**
6818
+ * Get the ID of the timeline window.
6819
+ *
6820
+ * @example // Get the ID.
6821
+ *
6822
+ * const id = timelineWindow.getId(); // "asset1"
6823
+ */
6824
+ getId(): string;
6825
+ /**
6826
+ * Get the start time of the timeline window.
6827
+ *
6828
+ * @example // Get the start of the window.
6829
+ *
6830
+ * const startTime = timelineWindow.getStart(); // 400
6831
+ */
6832
+ getStart(): number;
6833
+ /**
6834
+ * Check whether the timeline window is static or dynamic.
6835
+ *
6836
+ * @example // Check if the window is dynamic.
6837
+ *
6838
+ * const dynamic = timelineWindow.isDynamic(); // false
6839
+ */
6840
+ isDynamic(): boolean;
6841
+ }
6842
+ }
6843
+
6712
6844
  namespace muxdata {
6713
6845
  export class MuxDataPlugin {
6714
6846
  static Id: string;
@@ -7550,6 +7682,164 @@ export namespace clpp {
7550
7682
  */
7551
7683
  setItems(configs: Array<clpp.PlayerConfiguration>): void;
7552
7684
  }
7685
+
7686
+ /**
7687
+ * The single-controller playlist is intended for smooth continuous
7688
+ * back-to-back playback of multiple items. The playlist class inherits from
7689
+ * {@link clpp.Player} so all methods defined there can also be called on
7690
+ * the playlist instance (e.g. {@link clpp.Player#on|on()},
7691
+ * {@link clpp.Player#off|off()}, {@link clpp.Player#getPosition|getPosition()},
7692
+ * {@link clpp.Player#seek|seek()}, etc).
7693
+ * Limitations: Plugins are disabled and the method. Encryption
7694
+ * is supported only if all the items are encrypted with the same method
7695
+ * and key.
7696
+ */
7697
+ export class ScPlaylist {
7698
+ /**
7699
+ * The single-controller playlist is intended for smooth continuous
7700
+ * back-to-back playback of multiple items. The playlist class inherits from
7701
+ * {@link clpp.Player} so all methods defined there can also be called on
7702
+ * the playlist instance (e.g. {@link clpp.Player#on|on()},
7703
+ * {@link clpp.Player#off|off()}, {@link clpp.Player#getPosition|getPosition()},
7704
+ * {@link clpp.Player#seek|seek()}, etc).
7705
+ * Limitations: Plugins are disabled and the method. Encryption
7706
+ * is supported only if all the items are encrypted with the same method
7707
+ * and key.
7708
+ *
7709
+ * @param element The media element or the ID
7710
+ * of the media element to use as the underlying player
7711
+ * @param opt_configuration The global
7712
+ * player configuration
7713
+ * @param opt_viewConfiguration The global player view configuration
7714
+ */
7715
+ constructor(element: HTMLMediaElement|string, opt_configuration?: clpp.PlayerConfiguration, opt_viewConfiguration?: clpp.PlayerSurfaceConfiguration);
7716
+ /**
7717
+ * Append an item to the end of the playlist.
7718
+ * This method cannot be called before
7719
+ * {@link clpp.plist.ScPlaylist#open|open()}.
7720
+ *
7721
+ * @param config an item which must contain
7722
+ * at least an `id` and a `source`.
7723
+ *
7724
+ * @example // Append an item to the playlist.
7725
+ *
7726
+ * await playlist.addItem({
7727
+ * id: 'ASSET3',
7728
+ * source: { url: '...' }
7729
+ * });
7730
+ */
7731
+ addItem(config: clpp.PlayerConfiguration): Promise<void>;
7732
+ /**
7733
+ * Destroy this playlist instance.
7734
+ * The instance will not be usable after it was destroyed.
7735
+ *
7736
+ * @example // Destroy the playlist.
7737
+ *
7738
+ * await playlist.destroy();
7739
+ * // Do not call any methods on the playlist after this point
7740
+ */
7741
+ destroy(): Promise<void>;
7742
+ /**
7743
+ * Get the currently playing item.
7744
+ *
7745
+ * @example // Get the config of the current item.
7746
+ *
7747
+ * const item = playlist.getCurrentItem(); // { id: 'ASSET1', ... }
7748
+ */
7749
+ getCurrentItem(): clpp.PlayerConfiguration|null;
7750
+ /**
7751
+ * Get the index of the currently playing item.
7752
+ *
7753
+ * @example // Get the index of the current item.
7754
+ *
7755
+ * const index = playlist.getCurrentItemIndex(); // 0
7756
+ */
7757
+ getCurrentItemIndex(): number;
7758
+ /**
7759
+ * Get all the items of the playlist.
7760
+ *
7761
+ * @example // Get playlist items.
7762
+ *
7763
+ * const items = playlist.getPlaylist(); // [...]
7764
+ */
7765
+ getPlaylist(): Array<clpp.PlayerConfiguration>;
7766
+ /**
7767
+ * Get the number of items in the playlist.
7768
+ *
7769
+ * @example // Get the number of items in the playlist.
7770
+ *
7771
+ * const countItems = playlist.getSize(); // 4
7772
+ */
7773
+ getSize(): number;
7774
+ /**
7775
+ * Get the timeline of the playlist.
7776
+ *
7777
+ * @example // Get timeline windows.
7778
+ *
7779
+ * const timeline = playlist.getTimeline();
7780
+ * const windows = timeline?.getWindows();
7781
+ *
7782
+ * @example // Get the current timeline window.
7783
+ *
7784
+ * const timeline = playlist.getTimeline();
7785
+ * const timelineWindow = timeline?.getCurrentWindow();
7786
+ */
7787
+ getTimeline(): clpp.media.Timeline|null;
7788
+ /**
7789
+ * Load items to the playlist and start playing the first one.
7790
+ *
7791
+ * @param index the index of the item to start playback at.
7792
+ * Currently only 0 is supported.
7793
+ * @param configs a list of items
7794
+ * where each config must contain at least an `id` and a `source`.
7795
+ *
7796
+ * @example // Open a playlist of two items, start from the position of 2 minutes and automatically start playback.
7797
+ *
7798
+ * await playlist.open(0, [
7799
+ * {
7800
+ * id: 'ASSET1',
7801
+ * source: { url: '...' },
7802
+ * autoplay: true,
7803
+ * playlist: {
7804
+ * startTime: 120,
7805
+ * }
7806
+ * },
7807
+ * {
7808
+ * id: 'ASSET2',
7809
+ * source: { url: '...' }
7810
+ * }
7811
+ * ]);
7812
+ */
7813
+ open(index: number, configs: Array<clpp.PlayerConfiguration>): Promise<void>;
7814
+ /**
7815
+ * Release the playlist instance resources.
7816
+ * The playlist can load another source after it was released.
7817
+ *
7818
+ * @example // Release and reset the playlist.
7819
+ *
7820
+ * await playlist.release();
7821
+ */
7822
+ release(): Promise<void>;
7823
+ /**
7824
+ * Seek to a position relative to the current position.
7825
+ * This may result in seeking to one of the following/preceding items
7826
+ * in the playlist.
7827
+ *
7828
+ * @param offset the offset in seconds relative to the current
7829
+ * position to seek by. A positive value seeks forward, a negative value
7830
+ * seeks backward.
7831
+ *
7832
+ * @example // Seek 2 minutes forward.
7833
+ *
7834
+ * await playlist.seekWith(120);
7835
+ *
7836
+ * @example // Seek 2 minutes backward.
7837
+ *
7838
+ * await playlist.seekWith(-120);
7839
+ */
7840
+ seekWith(offset: number): Promise<void>;
7841
+ setCdnErrorCallback(): void;
7842
+ }
7553
7843
  }
7554
7844
 
7555
7845
  namespace smooth {
@@ -8225,8 +8515,8 @@ export namespace clpp {
8225
8515
  * alternate encoding/alphabet also known as "base64url".
8226
8516
  *
8227
8517
  * @param data
8228
- * @param opt_padding If true, pad the output with equals signs.
8229
- * Defaults to true.
8518
+ * @param opt_padding If true, pad the output with equals
8519
+ * signs. Defaults to true.
8230
8520
  */
8231
8521
  static toBase64Url(data: BufferSource, opt_padding?: boolean): string;
8232
8522
  /**