@castlabs/prestoplay 6.27.0 → 6.29.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 (67) hide show
  1. package/CHANGELOG.md +34 -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 +125 -114
  6. package/cjs/cl.conviva.js +32 -32
  7. package/cjs/cl.core.js +632 -624
  8. package/cjs/cl.crypto.js +9 -9
  9. package/cjs/cl.dash.js +89 -89
  10. package/cjs/cl.externs.js +201 -100
  11. package/cjs/cl.freewheel.js +25 -25
  12. package/cjs/cl.hls.js +78 -78
  13. package/cjs/cl.hlssmpte.js +6 -6
  14. package/cjs/cl.htmlcue.js +30 -30
  15. package/cjs/cl.ima.js +24 -24
  16. package/cjs/cl.mediatailor.js +3 -3
  17. package/cjs/cl.mse.js +351 -351
  18. package/cjs/cl.muxdata.js +14 -15
  19. package/cjs/cl.onboard.js +4 -3
  20. package/cjs/cl.persistent.js +14 -14
  21. package/cjs/cl.playlist.js +6 -6
  22. package/cjs/cl.simid.js +16 -17
  23. package/cjs/cl.smooth.js +71 -72
  24. package/cjs/cl.thumbnails.js +26 -26
  25. package/cjs/cl.tizen.js +72 -72
  26. package/cjs/cl.ttml.js +29 -29
  27. package/cjs/cl.verimatrix.js +5 -5
  28. package/cjs/cl.vimond.js +12 -12
  29. package/cjs/cl.vr.js +19 -19
  30. package/cjs/cl.vtt.js +14 -14
  31. package/cjs/cl.yospace.js +4 -4
  32. package/cjs/cl.youbora.js +39 -39
  33. package/cl.adobe.js +3 -3
  34. package/cl.airplay.js +3 -3
  35. package/cl.broadpeak.js +6 -5
  36. package/cl.cast.js +98 -90
  37. package/cl.conviva.js +27 -27
  38. package/cl.core.js +509 -501
  39. package/cl.crypto.js +8 -8
  40. package/cl.dash.js +83 -82
  41. package/cl.externs.js +197 -100
  42. package/cl.freewheel.js +19 -19
  43. package/cl.hls.js +82 -80
  44. package/cl.hlssmpte.js +5 -5
  45. package/cl.htmlcue.js +26 -26
  46. package/cl.ima.js +18 -17
  47. package/cl.mediatailor.js +2 -3
  48. package/cl.mse.js +303 -305
  49. package/cl.muxdata.js +13 -13
  50. package/cl.onboard.js +4 -4
  51. package/cl.persistent.js +10 -10
  52. package/cl.playlist.js +5 -5
  53. package/cl.simid.js +14 -14
  54. package/cl.smooth.js +60 -60
  55. package/cl.thumbnails.js +19 -19
  56. package/cl.tizen.js +57 -57
  57. package/cl.ttml.js +22 -22
  58. package/cl.verimatrix.js +4 -4
  59. package/cl.vimond.js +8 -8
  60. package/cl.vr.js +15 -15
  61. package/cl.vtt.js +12 -12
  62. package/cl.yospace.js +3 -3
  63. package/cl.youbora.js +31 -29
  64. package/package.json +1 -1
  65. package/typings.d.ts +221 -152
  66. package/cjs/cl.sessions.js +0 -21
  67. package/cl.sessions.js +0 -10
package/typings.d.ts CHANGED
@@ -304,6 +304,20 @@ export namespace clpp {
304
304
  uuid: string;
305
305
  }
306
306
 
307
+ /**
308
+ * Chromecast configuration.
309
+ */
310
+ export type ChromecastConfiguration = {
311
+ /**
312
+ * Enable to pass on current sender {@link clpp.AbrConfiguration} to receiver.
313
+ */
314
+ useSenderAbrConfig?: boolean;
315
+ /**
316
+ * Enable to pass on current sender {@link clpp.StreamingConfiguration} to reciver.
317
+ */
318
+ useSenderStreamingConfig?: boolean;
319
+ }
320
+
307
321
  /**
308
322
  * Common Media Client Data (CMCD) configuration.
309
323
  */
@@ -1141,6 +1155,10 @@ export namespace clpp {
1141
1155
  * The Playready path. Default is 'playready'.
1142
1156
  */
1143
1157
  playreadyUrl: string;
1158
+ /**
1159
+ * Widevine server certificate.
1160
+ */
1161
+ serverCertificate?: string|Uint8Array|null;
1144
1162
  /**
1145
1163
  * The Widevine path. Default is 'widevine'.
1146
1164
  */
@@ -1270,6 +1288,10 @@ export namespace clpp {
1270
1288
  * Broadpeak plugin configuration.
1271
1289
  */
1272
1290
  broadpeak?: Partial<clpp.BroadpeakConfiguration>;
1291
+ /**
1292
+ * Chromecast configuration.
1293
+ */
1294
+ chromecast?: Partial<clpp.ChromecastConfiguration>;
1273
1295
  /**
1274
1296
  * Connectivity check configuration is used to determine network connection.
1275
1297
  * If not configured, connectivity check will be disabled.
@@ -1325,7 +1347,7 @@ export namespace clpp {
1325
1347
  /**
1326
1348
  * A unique identifier of this configuration object.
1327
1349
  * This attribute is optional, except for configuration objects passed to
1328
- * {@link clpp.plist.ScPlaylist} for which the ID is mandatory, since we
1350
+ * {@link clpp.playlist.ScPlaylist} for which the ID is mandatory, since we
1329
1351
  * need a clear way to distinguish different items of the playlist.
1330
1352
  */
1331
1353
  id?: string;
@@ -1460,10 +1482,6 @@ export namespace clpp {
1460
1482
  * Safari-related configuration.
1461
1483
  */
1462
1484
  safari?: Partial<clpp.SafariConfiguration>;
1463
- /**
1464
- * Sessions plugin configuration.
1465
- */
1466
- sessions?: Partial<clpp.SessionsConfiguration>;
1467
1485
  /**
1468
1486
  * SIMID plugin configuration.
1469
1487
  */
@@ -1628,6 +1646,11 @@ export namespace clpp {
1628
1646
  * Optional. The URL of the poster.
1629
1647
  */
1630
1648
  image?: string;
1649
+ /**
1650
+ * Optional. If false, the item cannot be skipped via playlist controls. This
1651
+ * property is respected only in {@link clpp.cast.playlist.CastPlaylist}.
1652
+ */
1653
+ skippable?: boolean;
1631
1654
  /**
1632
1655
  * Optional. The title.
1633
1656
  */
@@ -1883,16 +1906,6 @@ export namespace clpp {
1883
1906
  ldlDelay: number;
1884
1907
  }
1885
1908
 
1886
- /**
1887
- * Configuration section for PRESTOplay Sessions.
1888
- */
1889
- export type SessionsConfiguration = {
1890
- /**
1891
- * The event injection API URL.
1892
- */
1893
- apiUrl: string;
1894
- }
1895
-
1896
1909
  /**
1897
1910
  * Configuration container for SIMID
1898
1911
  */
@@ -3235,8 +3248,7 @@ export namespace clpp {
3235
3248
  */
3236
3249
  TRACKS_ADDED = "tracksadded",
3237
3250
  /**
3238
- * Triggered when the players load method is called and the
3239
- * player started to loaded the sources
3251
+ * Triggered when the player started to load the source.
3240
3252
  */
3241
3253
  LOAD_START = "loadstart",
3242
3254
  /**
@@ -4316,7 +4328,7 @@ export namespace clpp {
4316
4328
  */
4317
4329
  start(): void;
4318
4330
  /**
4319
- * Stop iterating the playlist.
4331
+ * Stop iterating the playlist. Does not stop the playback.
4320
4332
  */
4321
4333
  stop(): void;
4322
4334
  }
@@ -4521,6 +4533,9 @@ export namespace clpp {
4521
4533
  }
4522
4534
 
4523
4535
  namespace Error {
4536
+ /**
4537
+ * Error category.
4538
+ */
4524
4539
  export enum Category {
4525
4540
  /**
4526
4541
  * Errors from the network stack.
@@ -4564,6 +4579,9 @@ export namespace clpp {
4564
4579
  ADS = 10,
4565
4580
  }
4566
4581
 
4582
+ /**
4583
+ * Error code.
4584
+ */
4567
4585
  export enum Code {
4568
4586
  /**
4569
4587
  * A network request was made using an unsupported URI scheme.
@@ -4603,12 +4621,6 @@ export namespace clpp {
4603
4621
  * following properties:
4604
4622
  */
4605
4623
  MALFORMED_DATA_URI = 1004,
4606
- /**
4607
- * A network request was made with a data URI using an unknown encoding.
4608
- * The {@link clpp.Error#data|data} property contains an object with the
4609
- * following properties:
4610
- */
4611
- UNKNOWN_DATA_URI_ENCODING = 1005,
4612
4624
  /**
4613
4625
  * A request modifier threw an error. The {@link clpp.Error#cause|cause}
4614
4626
  * contains the original error.
@@ -4624,16 +4636,6 @@ export namespace clpp {
4624
4636
  * This error is only used by unit and integration tests.
4625
4637
  */
4626
4638
  MALFORMED_TEST_URI = 1008,
4627
- /**
4628
- * An unexpected network request was made to the FakeNetworkingEngine.
4629
- * This error is only used by unit and integration tests.
4630
- */
4631
- UNEXPECTED_TEST_REQUEST = 1009,
4632
- /**
4633
- * The number of retry attempts have run out.
4634
- * This is an internal error and shouldn't be propagated.
4635
- */
4636
- ATTEMPTS_EXHAUSTED = 1010,
4637
4639
  /**
4638
4640
  * A network request was made with a malformed URL.
4639
4641
  * The {@link clpp.Error#data|data} property contains an object with the
@@ -4648,15 +4650,6 @@ export namespace clpp {
4648
4650
  * The text parser failed to parse a text stream due to an invalid cue.
4649
4651
  */
4650
4652
  INVALID_TEXT_CUE = 2001,
4651
- /**
4652
- * Was unable to detect the encoding of the response text. Suggest adding
4653
- * byte-order-markings to the response data.
4654
- */
4655
- UNABLE_TO_DETECT_ENCODING = 2003,
4656
- /**
4657
- * The response data contains invalid Unicode character encoding.
4658
- */
4659
- BAD_ENCODING = 2004,
4660
4653
  /**
4661
4654
  * The XML parser failed to parse an xml stream, or the XML lacks mandatory
4662
4655
  * elements for TTML.
@@ -4672,13 +4665,6 @@ export namespace clpp {
4672
4665
  * MP4 segment does not contain VTT.
4673
4666
  */
4674
4667
  INVALID_MP4_VTT = 2008,
4675
- /**
4676
- * When examining media in advance, we were unable to extract the cue time.
4677
- * This should only be possible with HLS, where we do not have explicit
4678
- * segment start times. The {@link clpp.Error#cause|cause}
4679
- * is the underlying exception or Error object.
4680
- */
4681
- UNABLE_TO_EXTRACT_CUE_START_TIME = 2009,
4682
4668
  /**
4683
4669
  * An error occurred while fetching or appending a text stream.
4684
4670
  * The {@link clpp.Error#data|data} is the underlying exception
@@ -4821,19 +4807,11 @@ export namespace clpp {
4821
4807
  * must be one of {@link clpp.Track.Type}.
4822
4808
  */
4823
4809
  INVALID_TRACK_TYPE = 3101,
4824
- /**
4825
- * An error raised when the requested track is unknown.
4826
- */
4827
- UNKNOWN_TRACK = 3102,
4828
4810
  /**
4829
4811
  * A media segment could not be decrypted. This can happen e.g for
4830
4812
  * HLS + AES-128 content.
4831
4813
  */
4832
4814
  MEDIA_DECRYPTION_ERROR = 3103,
4833
- /**
4834
- * An error raised when the play is not allowed.
4835
- */
4836
- PLAY_NOT_ALLOWED = 3200,
4837
4815
  /**
4838
4816
  * An error raised when the player fails to be paused.
4839
4817
  */
@@ -5064,8 +5042,7 @@ export namespace clpp {
5064
5042
  */
5065
5043
  CANNOT_ADD_EXTERNAL_TEXT_TO_LIVE_STREAM = 4040,
5066
5044
  /**
5067
- * We do not support playing Fairplay-encrypted transport streams
5068
- * (MPEG-TS) with MSE.
5045
+ * Due to limitations of the MSE API Fairplay-protected MPEG-TS is not supported.
5069
5046
  */
5070
5047
  HLS_MSE_ENCRYPTED_TS_NOT_SUPPORTED = 4041,
5071
5048
  /**
@@ -5086,10 +5063,6 @@ export namespace clpp {
5086
5063
  * only certain simple playlists are supported.
5087
5064
  */
5088
5065
  HLS_DISCONTINUITY_NOT_SUPPORTED = 4045,
5089
- /**
5090
- * Encountered a feature of HLS which is not currently supported.
5091
- */
5092
- HLS_UNSUPPORTED_FEATURE = 4046,
5093
5066
  /**
5094
5067
  * The content of the media playlist is incompatible with new content
5095
5068
  * after an update.
@@ -5275,11 +5248,6 @@ export namespace clpp {
5275
5248
  * another load call has been executed.
5276
5249
  */
5277
5250
  OPERATION_ABORTED = 7001,
5278
- /**
5279
- * The call to Player.load() failed because the Player does not have a video
5280
- * element. The video element must be provided to the constructor.
5281
- */
5282
- NO_VIDEO_ELEMENT = 7002,
5283
5251
  /**
5284
5252
  * The player could not load the configured {@link clpp.Source}.
5285
5253
  * Either the player is missing some capabilities (e.g. from one or more
@@ -5495,6 +5463,9 @@ export namespace clpp {
5495
5463
  SESSIONS_INVALID_CONFIGURATION = 15000,
5496
5464
  }
5497
5465
 
5466
+ /**
5467
+ * Error severity.
5468
+ */
5498
5469
  export enum Severity {
5499
5470
  /**
5500
5471
  * An error occurred that the player will try to recover from. If retrying
@@ -5892,8 +5863,9 @@ export namespace clpp {
5892
5863
  * @param opt_playerConfig optional
5893
5864
  * configuration to cast. If omitted, player will try to cast current
5894
5865
  * content.
5866
+ * @param opt_queueOptions optional queue items and starting index to load.
5895
5867
  */
5896
- cast(opt_playerConfig?: clpp.PlayerConfiguration): Promise<void>;
5868
+ cast(opt_playerConfig?: clpp.PlayerConfiguration, opt_queueOptions?: Record<string, any>): Promise<void>;
5897
5869
  /**
5898
5870
  * Change receiver id. It will close current session, if any.
5899
5871
  *
@@ -6164,6 +6136,89 @@ export namespace clpp {
6164
6136
  updateContentMetadata(metadata: clpp.cast.utils.ReceiverMetadataObject|null): void;
6165
6137
  }
6166
6138
 
6139
+ namespace playlist {
6140
+ /**
6141
+ * Creates a playlist controller bound to the provided player.
6142
+ */
6143
+ export class CastPlaylist {
6144
+ /**
6145
+ * Creates a playlist controller bound to the provided player.
6146
+ *
6147
+ * @param player sender player instance
6148
+ * @param castAppId Chromecast receiver application ID
6149
+ * @param playlistItems items to enqueue
6150
+ */
6151
+ constructor(player: clpp.Player, castAppId: string, playlistItems: Array<clpp.PlaylistItem>);
6152
+ /**
6153
+ * Appends a new item locally and mirrors it to the cast queue when casting.
6154
+ */
6155
+ append(item: clpp.PlaylistItem): Promise<void>;
6156
+ /**
6157
+ * Returns whether casting is currently active.
6158
+ */
6159
+ canCast(): boolean;
6160
+ /**
6161
+ * Stops playlist, destroys the current underlying castProxy
6162
+ * and releases player.
6163
+ */
6164
+ destroy(): void;
6165
+ /**
6166
+ * Returns the index of the currently active playlist item.
6167
+ */
6168
+ getCurrentIndex(): number;
6169
+ /**
6170
+ * Returns the current local playlist queue.
6171
+ */
6172
+ getPlaylistItems(): Array<clpp.PlaylistItem>;
6173
+ /**
6174
+ * Returns whether casting is currently active.
6175
+ */
6176
+ isCasting(): boolean;
6177
+ /**
6178
+ * Moves to the next playlist item using cast queue when casting.
6179
+ */
6180
+ next(): Promise<void>;
6181
+ /**
6182
+ * Registers a handler for cast availability or connection status changes.
6183
+ *
6184
+ * @param handler callback invoked with event payload
6185
+ */
6186
+ onCastStatusChanged(handler: Function): clpp.EventCallback;
6187
+ /**
6188
+ * Registers a handler invoked when the active playlist index changes.
6189
+ *
6190
+ * @param handler callback invoked with event payload
6191
+ */
6192
+ onPlaylistItemChange(handler: Function): clpp.EventCallback;
6193
+ /**
6194
+ * Registers a handler invoked when the playlist content is modified.
6195
+ *
6196
+ * @param handler callback invoked with event payload
6197
+ */
6198
+ onPlaylistModified(handler: Function): clpp.EventCallback;
6199
+ /**
6200
+ * Pauses playback on the underlying player.
6201
+ */
6202
+ pause(): void;
6203
+ /**
6204
+ * Plays the underlying player.
6205
+ */
6206
+ play(): void;
6207
+ /**
6208
+ * Moves to the previous playlist item using cast queue when casting.
6209
+ */
6210
+ previous(): Promise<void>;
6211
+ /**
6212
+ * Starts playlist playback from the current index.
6213
+ */
6214
+ start(): void;
6215
+ /**
6216
+ * Starts casting with the current queue or disconnects if already casting.
6217
+ */
6218
+ toggleCast(): Promise<void>;
6219
+ }
6220
+ }
6221
+
6167
6222
  namespace utils {
6168
6223
  /**
6169
6224
  * Callback function used to modify load request data before play.
@@ -6476,6 +6531,10 @@ export namespace clpp {
6476
6531
  setDrmSystem(identifier: clpp.drm.KeySystem, config: clpp.PlayreadyDrmSystem|clpp.FairplayDrmSystem|clpp.WidevineDrmSystem): void;
6477
6532
  }
6478
6533
 
6534
+ export class DrmToday {
6535
+
6536
+ }
6537
+
6479
6538
  export class HeaderDrm {
6480
6539
  /**
6481
6540
  * @param wvLicenseUrl The Widevine License URL
@@ -7012,7 +7071,7 @@ export namespace clpp {
7012
7071
  export type LogInterceptor = Function;
7013
7072
 
7014
7073
  /**
7015
- * All available log levels
7074
+ * Log level.
7016
7075
  */
7017
7076
  export enum Level {
7018
7077
  /**
@@ -8003,82 +8062,7 @@ export namespace clpp {
8003
8062
  }
8004
8063
  }
8005
8064
 
8006
- namespace plist {
8007
- /**
8008
- * A playlist item.
8009
- * It consists of an asset/config, a player instances selected
8010
- * to play this asset and the underlying video element to which the player is
8011
- * attached.
8012
- */
8013
- export type Item = {
8014
- /**
8015
- * Source configuration.
8016
- */
8017
- config: clpp.PlayerConfiguration;
8018
- /**
8019
- * The index of the item in the playlist.
8020
- */
8021
- index: number;
8022
- /**
8023
- * A player instance.
8024
- */
8025
- player: clpp.Player|null;
8026
- /**
8027
- * A promise that resolves when the item is preloaded.
8028
- */
8029
- preloadPromise: Promise<void>;
8030
- /**
8031
- * The role of the item.
8032
- */
8033
- role: string;
8034
- /**
8035
- * The state of the item (e.g. 'preloading', 'preloaded', 'preload-failed').
8036
- */
8037
- state: string;
8038
- /**
8039
- * The video element attached to the player.
8040
- */
8041
- videoEl: HTMLVideoElement|null;
8042
- }
8043
-
8044
- /**
8045
- * Playlist options.
8046
- */
8047
- export type Options = {
8048
- /**
8049
- * ID of the HTML element to be used as a container
8050
- * for video elements created by this playlist.
8051
- */
8052
- anchorId: string;
8053
- /**
8054
- * If true, when one item finishes playback the next item is played
8055
- * automatically and so on until the end of the playlist.
8056
- */
8057
- autoplayNext?: boolean;
8058
- /**
8059
- * Default configuration for player instances.
8060
- */
8061
- config: clpp.PlayerConfiguration;
8062
- /**
8063
- * If true, preloaded items will have also their media segments preloaded
8064
- * thus reducing the time to start playback to minimum. This option is
8065
- * intended to be used with VOD streams.
8066
- */
8067
- preloadMedia?: boolean;
8068
- /**
8069
- * A custom callback to toggle the visibility of a video element. By default
8070
- * this is done via z-index.
8071
- */
8072
- toggleVisible?: Function;
8073
- /**
8074
- * Transition method, can be "pause" or "keep-playing". In cause of "pause"
8075
- * the current video will be paused when calling
8076
- * {@link clpp.plist.McPlaylist.playNext} or
8077
- * {@link clpp.plist.McPlaylist.playPrev}.
8078
- */
8079
- transition?: string;
8080
- }
8081
-
8065
+ namespace playlist {
8082
8066
  /**
8083
8067
  * Multi-controller playlist intended for fast live TV channel zapping.
8084
8068
  * It is based on an architecture which leverages multiple video elements
@@ -8154,12 +8138,13 @@ export namespace clpp {
8154
8138
  hasPrev(): boolean;
8155
8139
  /**
8156
8140
  * Play the first item.
8157
- * Make sure to set items via {@link clpp.plist.McPlaylist.setItems} and
8158
- * select the index to start from via {@link clpp.plist.McPlaylist.setIndex}
8141
+ * Make sure to set items via {@link clpp.playlist.McPlaylist.setItems} and
8142
+ * select the index to start from via
8143
+ * {@link clpp.playlist.McPlaylist.setIndex}
8159
8144
  * before calling this method.
8160
8145
  * To switch to the next or previous item use methods
8161
- * {@link clpp.plist.McPlaylist.playNext} and
8162
- * {@link clpp.plist.McPlaylist.playPrev}.
8146
+ * {@link clpp.playlist.McPlaylist.playNext} and
8147
+ * {@link clpp.playlist.McPlaylist.playPrev}.
8163
8148
  */
8164
8149
  playFirst(): Promise<void>;
8165
8150
  /**
@@ -8218,7 +8203,7 @@ export namespace clpp {
8218
8203
  /**
8219
8204
  * Append an item to the end of the playlist.
8220
8205
  * This method cannot be called before
8221
- * {@link clpp.plist.ScPlaylist#open|open()}.
8206
+ * {@link clpp.playlist.ScPlaylist#open|open()}.
8222
8207
  *
8223
8208
  * @param config an item which must contain
8224
8209
  * at least an `id` and a `source`.
@@ -8344,6 +8329,83 @@ export namespace clpp {
8344
8329
  }
8345
8330
  }
8346
8331
 
8332
+ namespace plist {
8333
+ /**
8334
+ * A playlist item.
8335
+ * It consists of an asset/config, a player instances selected
8336
+ * to play this asset and the underlying video element to which the player is
8337
+ * attached.
8338
+ */
8339
+ export type Item = {
8340
+ /**
8341
+ * Source configuration.
8342
+ */
8343
+ config: clpp.PlayerConfiguration;
8344
+ /**
8345
+ * The index of the item in the playlist.
8346
+ */
8347
+ index: number;
8348
+ /**
8349
+ * A player instance.
8350
+ */
8351
+ player: clpp.Player|null;
8352
+ /**
8353
+ * A promise that resolves when the item is preloaded.
8354
+ */
8355
+ preloadPromise: Promise<void>;
8356
+ /**
8357
+ * The role of the item.
8358
+ */
8359
+ role: string;
8360
+ /**
8361
+ * The state of the item (e.g. 'preloading', 'preloaded', 'preload-failed').
8362
+ */
8363
+ state: string;
8364
+ /**
8365
+ * The video element attached to the player.
8366
+ */
8367
+ videoEl: HTMLVideoElement|null;
8368
+ }
8369
+
8370
+ /**
8371
+ * Playlist options.
8372
+ */
8373
+ export type Options = {
8374
+ /**
8375
+ * ID of the HTML element to be used as a container
8376
+ * for video elements created by this playlist.
8377
+ */
8378
+ anchorId: string;
8379
+ /**
8380
+ * If true, when one item finishes playback the next item is played
8381
+ * automatically and so on until the end of the playlist.
8382
+ */
8383
+ autoplayNext?: boolean;
8384
+ /**
8385
+ * Default configuration for player instances.
8386
+ */
8387
+ config: clpp.PlayerConfiguration;
8388
+ /**
8389
+ * If true, preloaded items will have also their media segments preloaded
8390
+ * thus reducing the time to start playback to minimum. This option is
8391
+ * intended to be used with VOD streams.
8392
+ */
8393
+ preloadMedia?: boolean;
8394
+ /**
8395
+ * A custom callback to toggle the visibility of a video element. By default
8396
+ * this is done via z-index.
8397
+ */
8398
+ toggleVisible?: Function;
8399
+ /**
8400
+ * Transition method, can be "pause" or "keep-playing". In cause of "pause"
8401
+ * the current video will be paused when calling
8402
+ * {@link clpp.playlist.McPlaylist.playNext} or
8403
+ * {@link clpp.playlist.McPlaylist.playPrev}.
8404
+ */
8405
+ transition?: string;
8406
+ }
8407
+ }
8408
+
8347
8409
  namespace smooth {
8348
8410
  export class SmoothComponent {
8349
8411
 
@@ -8953,6 +9015,13 @@ export namespace clpp {
8953
9015
  }
8954
9016
 
8955
9017
  export class PlayerConfiguration {
9018
+ /**
9019
+ * Builds player configuration object including defaults to be serialized.
9020
+ *
9021
+ * @param configs Partial config objects to merge
9022
+ * @param options
9023
+ */
9024
+ static build(configs: Array<any>, options?: Record<string, any>): clpp.PlayerConfiguration;
8956
9025
  /**
8957
9026
  * Creates a configuration out of the data object and the
8958
9027
  * default configuration.
@@ -1,21 +0,0 @@
1
- (function(){var g={}; var _ = _ || {}
2
- var f=function(window){var GA="apiUrl config is missing",HA="prestoplay-web",IA=function(a,b){a.l=a.l.filter(function(c){return c!==b})},JA=function(a){var b=0>a;a=Math.abs(a);var c=a>>>0;a=Math.floor((a-c)/4294967296);a>>>=0;b&&(a=~a>>>0,c=(~c>>>0)+1,4294967295<c&&(c=0,a++,4294967295<a&&(a=0)));return[c,a]},KA=function(){this.a=[]},NA=function(a,b,c){LA(a,b,c,function(d,e){MA(d,e)})},MA=function(a,b){if(0<=b)OA(a,b);else{for(var c=b,d=0;9>d;d++)a.a.push(c&127|128),c>>=7;a.a.push(1)}},QA=function(a,b,c){LA(a,b,c,function(d,
3
- e){if(0<=e){var f=_.v(JA(e)),g=f.next().value;f=f.next().value;PA(d,g,f)}else f=_.v(JA(e)),g=f.next().value,f=f.next().value,PA(d,g,f)})},SA=function(a,b,c){RA(a,b,c,function(d,e){for(var f=0;f<e.length;f++){var g=e.charCodeAt(f);if(128>g)d.a.push(g);else if(2048>g)d.a.push(g>>6|192),d.a.push(g&63|128);else if(65536>g)if(55296<=g&&56319>=g&&f+1<e.length){var h=e.charCodeAt(f+1);56320<=h&&57343>=h&&(g=1024*(g-55296)+h-56320+65536,d.a.push(g>>18|240),d.a.push(g>>12&63|128),d.a.push(g>>6&63|128),d.a.push(g&
4
- 63|128),f++)}else d.a.push(g>>12|224),d.a.push(g>>6&63|128),d.a.push(g&63|128)}})},UA=function(a,b,c){RA(a,b,c,function(d,e){TA(d,e.a())})},VA=function(a,b,c){RA(a,b,c,function(d,e){TA(d,e)})},TA=function(a,b){a.a.push.apply(a.a,b)},LA=function(a,b,c,d){if(!(null===c||void 0===c||typeof c===_.k&&0===c||typeof c===_.eg&&0===c.length||Array.isArray(c)&&0===c.length))if(Array.isArray(c)){OA(a,b<<3|2);b=new KA;for(var e=0;e<c.length;e++)d(b,c[e]);MA(a,b.length());TA(a,b.end())}else OA(a,b<<3|0),d(a,c)},
5
- RA=function(a,b,c,d){if(!(null===c||void 0===c||typeof c===_.k&&0===c||typeof c===_.eg&&0===c.length||Array.isArray(c)&&0===c.length))if(Array.isArray(c))for(var e=0;e<c.length;e++){OA(a,b<<3|2);var f=new KA;d(f,c[e]);MA(a,f.length());TA(a,f.end())}else OA(a,b<<3|2),b=new KA,d(b,c),MA(a,b.length()),TA(a,b.end())},OA=function(a,b){for(;127<b;)a.a.push(b&127|128),b>>>=7;a.a.push(b)},PA=function(a,b,c){for(;0<c||127<b;)a.a.push(b&127|128),b=(b>>>7|c<<25)>>>0,c>>>=7;a.a.push(b)},WA=function(a,b,c,d){this.downloadId=
6
- a;this.h=b;this.duration=c;this.j=d;this.f=[]},XA=function(a,b){this.f=a;this.url=b;this.downloadId=null;this.headers=[];this.size=this.duration=null},YA=function(a,b){this.h=a;this.f=b},ZA=function(a){this.cause=a;this.f=this.message=this.severity=this.errorCode=null},$A=function(a,b){this.key=a;this.value=b},aB=function(){this.cause=this.severity=this.code=null},bB=function(){this.data=null},cB=function(){this.data=null;var a=new Uint8Array(16);crypto.getRandomValues(a);a[6]=a[6]&15|64;a[8]=a[8]&
7
- 63|128;this.data=a},dB=function(){this.headers=[]},eB=function(){},fB=function(a){this.j=a;this.f=this.h=this.time=this.sessionId=null},gB=function(){this.f=null;this.events=[]},hB=function(){this.f=this.h=null},iB=function(){this.f=this.h=null},jB=function(a){var b=new iB;b.h=Math.floor(a/1E3);b.f=a%1E3*1E6;return b},mB=function(a,b,c,d,e){var f=new Uint8Array([]),g=this;var h=void 0===h?2500:h;this.o=f;this.l=e;this.w=new cB;this.A=new cB;this.a=[];this.h=setInterval(function(){return kB(g)},h);
8
- this.f=null;this.j=!1;lB(this,a,b,c,d)},nB=function(a){return _.I(function(b){switch(b.a){case 1:a.h&&(clearInterval(a.h),a.h=null);if(!a.f){b.C(2);break}return _.x(b,a.f,2);case 2:if(!(0<a.a.length)){b.C(4);break}return _.x(b,kB(a),5);case 5:a.a=[];case 4:a.j=!0,_.z(b)}})},lB=function(a,b,c,d,e){var f=new dB;f.headers=[new $A("CL-BROWSER-NAME",b),new $A("CL-BROWSER-VERSION",c),new $A("CL-OS-FAMILY",d),new $A("CL-OS-VERSION",e),new $A("CL-SDK-NAME",HA),new $A("CL-SDK-NAME",HA),new $A("CL-SDK-VERSION",
9
- _.ia)];oB(a,f)},kB=function(a){var b,c,d,e;return _.I(function(f){if(1==f.a){if(a.j||a.f)return f["return"]();0===a.a.length&&oB(a,new eB);b=function(){};a.f=new Promise(function(g){b=g});_.uh(f);c=new gB;c.f=a.o;c.events.push.apply(c.events,_.hh(a.a));d=_.hh(a.a).concat();return _.x(f,fetch(a.l,{method:_.rb,headers:{"Content-Type":"application/proto"},body:new Uint8Array(c.a())}),4)}if(2!=f.a)if(e=f.f,e.ok)a.a=a.a.filter(function(g){return!d.includes(g)});else throw Error("An error occurred while sending telemetry events to the API, status\x3d'"+
10
- (e.status+"' statusText\x3d'"+e.statusText+"'"));_.vh(f);b();a.f=null;return _.wh(f)})},oB=function(a,b){if(!a.j){var c=new fB(a.w);c.sessionId=a.A;var d=Date.now(),e=new hB;e.h=Math.floor(d/1E3);e.f=d%1E3*1E6;c.time=e;c.h=b.getId();c.f=new Uint8Array(b.a());a.a.push(c)}},pB=function(){this.reason=this.currentState=this.previousState=null},qB=function(){this.m=null;this.f=this.l=!1;this.a=new _.gi;this.h=null;this.g=new _.K("clpp.sessions.SessionsPlugin");this.o=this.an.bind(this);this.j=this.$m.bind(this)},
11
- yB=function(a){switch(a){case _.Lq:return rB;case _.Xq:return sB;case _.Qq:return tB;case _.Zq:return uB;case _.Yq:return vB;case _.Sq:return wB;case _.Wq:return xB;default:return null}},GB=function(a,b){switch(a){case 1:return zB;case 2:return b===_.Jg?AB:b===_.Oc?BB:b===_.yj?CB:b===_.se?DB:EB;case 3:return FB;default:return EB}},HB=function(a){var b;_.I(function(c){if(1==c.a)return a.g.info("Destroy the session and stop sending events."),_.ji(a.a),a.f=!1,b=a.m.getNetworkEngine(),b.Bg(a.o),b.ue(a.j),
12
- IA(b,a.j),a.h?_.x(c,nB(a.h),3):c.C(0);a.h=null;_.z(c)})},IB=function(a,b){a.g.debug("Sending event",b);oB(a.h,b)},JB=function(){};KA.prototype.length=function(){return this.a.length};KA.prototype.end=function(){var a=this.a;this.a=[];return a};WA.prototype.a=function(){var a=new KA;UA(a,1,this.downloadId);NA(a,2,this.h);UA(a,3,this.duration);NA(a,4,this.j);UA(a,5,this.f);return a.end()};WA.prototype.getId=function(){return 4};XA.prototype.a=function(){var a=new KA;NA(a,1,this.f);UA(a,2,this.downloadId);SA(a,3,this.url);UA(a,4,this.headers);SA(a,5,null);UA(a,6,null);UA(a,7,this.duration);QA(a,8,this.size);return a.end()};XA.prototype.getId=function(){return 2};YA.prototype.a=function(){var a=new KA;NA(a,1,this.h);VA(a,2,this.f);return a.end()};ZA.prototype.a=function(){var a=new KA;NA(a,1,this.errorCode);NA(a,2,this.severity);SA(a,3,this.message);SA(a,4,this.f);UA(a,5,this.cause);return a.end()};ZA.prototype.getId=function(){return 7};$A.prototype.a=function(){var a=new KA;SA(a,1,this.key);SA(a,2,this.value);return a.end()};aB.prototype.a=function(){var a=new KA;NA(a,1,this.code);NA(a,2,this.severity);UA(a,3,this.cause);return a.end()};aB.prototype.getId=function(){return 12};bB.prototype.a=function(){var a=new KA;VA(a,1,this.data);return a.end()};_.w(cB,bB);cB.prototype.toString=function(){for(var a=[],b=0;256>b;++b)a.push((b+256).toString(16).slice(1));return a[this.data[0]]+a[this.data[1]]+a[this.data[2]]+a[this.data[3]]+"-"+a[this.data[4]]+a[this.data[5]]+"-"+a[this.data[6]]+a[this.data[7]]+"-"+a[this.data[8]]+a[this.data[9]]+"-"+a[this.data[10]]+a[this.data[11]]+a[this.data[12]]+a[this.data[13]]+a[this.data[14]]+a[this.data[15]]};dB.prototype.a=function(){var a=new KA;UA(a,1,this.headers);return a.end()};dB.prototype.getId=function(){return 1};eB.prototype.a=function(){return(new KA).end()};eB.prototype.getId=function(){return 6};fB.prototype.a=function(){var a=new KA;UA(a,1,this.j);UA(a,2,this.sessionId);UA(a,3,this.time);QA(a,4,null);SA(a,5,null);NA(a,6,this.h);VA(a,7,this.f);return a.end()};gB.prototype.a=function(){var a=new KA;VA(a,1,this.f);UA(a,2,this.events);return a.end()};hB.prototype.a=function(){var a=new KA;QA(a,1,this.h);NA(a,2,this.f);return a.end()};iB.prototype.a=function(){var a=new KA;QA(a,1,this.h);NA(a,2,this.f);return a.end()};pB.prototype.a=function(){var a=new KA;NA(a,1,this.previousState);NA(a,2,this.currentState);NA(a,3,this.reason);UA(a,4,null);UA(a,5,null);UA(a,6,null);return a.end()};pB.prototype.getId=function(){return 5};_.w(qB,_.Hv);_.r=qB.prototype;_.r.onPlayerCreated=function(a){this.m=a};
13
- _.r.onContentWillLoad=function(a){var b=a.getConfiguration().sessions;(b=!(!b||typeof b!==_.Re))||this.g.debug("Sessions plugin is loaded but not configured. Will do nothing.");if(this.l=b)b=a.getConfiguration().sessions,b.apiUrl?(this.g.debug(_.ya),this.g.info("Create a session and start sending events."),a=_.gl(),this.h=new mB(a.browser,a.browserVersion.name,a.os,a.osVersion.name,b.apiUrl),this.a.on(this.m,_.bg,this.Qk.bind(this)),this.a.on(this.m,_.Uf,this.Pk.bind(this)),this.a.on(this.m,_.Tf,
14
- this.Ok.bind(this)),this.a.on(this.m,_.he,this.Nk.bind(this)),a=this.m.getNetworkEngine(),a.Of(this.o),a.bd(this.j),a.l.push(this.j)):(this.g.warn(GA),a.onError(new _.O(1,9,15E3,GA)))};_.r.onPlayerWillRelease=function(){HB(this)};_.r.id=function(){return"sessions"};_.r.Qk=function(a){if(!this.f){a=a.detail;var b=a.currentState,c=new pB;c.previousState=yB(a.previousState);c.currentState=yB(b);IB(this,c)}};
15
- _.r.Pk=function(){if(!this.f){var a=new pB;a.previousState=yB(this.m.getState());a.currentState=KB;IB(this,a);this.f=!0}};_.r.Ok=function(){if(this.f){var a=new pB;a.previousState=KB;a.currentState=yB(this.m.getState());IB(this,a);this.f=!1}};_.r.Nk=function(a){a=a.detail;var b=new aB;b=new ZA(new YA(b.getId(),new Uint8Array(b.a())));b.errorCode=a.code;b.message=a.message;b.f=a.stack;b.severity=a.severity===_.Q?LB:MB;IB(this,b)};
16
- _.r.an=function(a){var b=new cB;a.downloadId=b;var c=new XA(GB(a.type,a.contentType),a.uris[0]);c.downloadId=b;c.headers=Object.keys(a.headers).map(function(d){return new $A(d,a.headers[d])});IB(this,c)};_.r.$m=function(a){var b=a.request.downloadId;b?(b=new WA(b,a.data.byteLength,jB(a.timeMs||0),a.status||-1),b.f=Object.keys(a.headers).map(function(c){return new $A(c,a.headers[c])}),IB(this,b)):this.g.warn("Download ID is missing on download completed event.")};JB.prototype.create=function(){return new qB};
17
- _.ru(new JB);var MB=1,LB=2;var rB=0,sB=2,xB=3,KB=5,tB=6,uB=8,vB=10,wB=11;var zB=0,AB=1,BB=2,CB=3,DB=4,FB=5,EB=9;};
18
- if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
19
- else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
20
- else{_=this.clpp._;(f.call(g,this));}
21
- })();
package/cl.sessions.js DELETED
@@ -1,10 +0,0 @@
1
- import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var wz="apiUrl config is missing",xz=function(a,b){a.l=a.l.filter(c=>c!==b)},yz=function(a){let b=0>a;a=Math.abs(a);let c=a>>>0;a=Math.floor((a-c)/4294967296);a>>>=0;b&&(a=~a>>>0,c=(~c>>>0)+1,4294967295<c&&(c=0,a++,4294967295<a&&(a=0)));return[c,a]},Dz=function(a,b,c,d){if(!(null===c||void 0===c||typeof c===_.r&&0===c||typeof c===_.Qf&&0===c.length||Array.isArray(c)&&0===c.length))if(Array.isArray(c)){zz(a,b<<3|2);b=new Az;for(let e=0;e<c.length;e++)d(b,c[e]);Bz(a,b.length());Cz(a,b.end())}else zz(a,
2
- b<<3|0),d(a,c)},Bz=function(a,b){if(0<=b)zz(a,b);else{for(let c=0;9>c;c++)a.a.push(b&127|128),b>>=7;a.a.push(1)}},Ez=function(a,b,c){Dz(a,b,c,(d,e)=>{Bz(d,e)})},zz=function(a,b){for(;127<b;)a.a.push(b&127|128),b>>>=7;a.a.push(b)},Gz=function(a,b,c){Dz(a,b,c,(d,e)=>{if(0<=e){{const [f,g]=yz(e);Fz(d,f,g)}}else{{const [f,g]=yz(e);Fz(d,f,g)}}})},Hz=function(a,b,c,d){if(!(null===c||void 0===c||typeof c===_.r&&0===c||typeof c===_.Qf&&0===c.length||Array.isArray(c)&&0===c.length))if(Array.isArray(c))for(let e=
3
- 0;e<c.length;e++){zz(a,b<<3|2);const f=new Az;d(f,c[e]);Bz(a,f.length());Cz(a,f.end())}else zz(a,b<<3|2),b=new Az,d(b,c),Bz(a,b.length()),Cz(a,b.end())},Iz=function(a,b,c){Hz(a,b,c,(d,e)=>{for(let f=0;f<e.length;f++){let g=e.charCodeAt(f);if(128>g)d.a.push(g);else if(2048>g)d.a.push(g>>6|192),d.a.push(g&63|128);else if(65536>g)if(55296<=g&&56319>=g&&f+1<e.length){let h=e.charCodeAt(f+1);56320<=h&&57343>=h&&(g=1024*(g-55296)+h-56320+65536,d.a.push(g>>18|240),d.a.push(g>>12&63|128),d.a.push(g>>6&63|
4
- 128),d.a.push(g&63|128),f++)}else d.a.push(g>>12|224),d.a.push(g>>6&63|128),d.a.push(g&63|128)}})},Cz=function(a,b){a.a.push.apply(a.a,b)},Jz=function(a,b,c){Hz(a,b,c,(d,e)=>{Cz(d,e.a())})},Kz=function(a,b,c){Hz(a,b,c,(d,e)=>{Cz(d,e)})},Fz=function(a,b,c){for(;0<c||127<b;)a.a.push(b&127|128),b=(b>>>7|c<<25)>>>0,c>>>=7;a.a.push(b)},Mz=function(a){const b=new Lz;b.h=Math.floor(a/1E3);b.f=a%1E3*1E6;return b},Qz=function(a){return _.w(function*(){if(!a.j&&!a.f){0===a.a.length&&Nz(a,new Oz);var b=()=>
5
- {};a.f=new Promise(c=>{b=c});try{const c=new Pz;c.f=a.o;c.events.push(...a.a);const d=[...a.a],e=yield fetch(a.l,{method:_.db,headers:{"Content-Type":"application/proto"},body:new Uint8Array(c.a())});if(e.ok)a.a=a.a.filter(f=>!d.includes(f));else throw Error("An error occurred while sending telemetry events to the API, "+`status='${e.status}' statusText='${e.statusText}'`);}finally{b(),a.f=null}}})},Tz=function(a,b,c,d,e,f,g){const h=new Rz;h.headers=[new Sz("CL-BROWSER-NAME",b),new Sz("CL-BROWSER-VERSION",
6
- c),new Sz("CL-OS-FAMILY",d),new Sz("CL-OS-VERSION",e),new Sz("CL-SDK-NAME",f),new Sz("CL-SDK-NAME",f),new Sz("CL-SDK-VERSION",g)];Nz(a,h)},Nz=function(a,b){if(!a.j){var c=new Uz(a.w);c.sessionId=a.A;{var d=Date.now();const e=new Vz;e.h=Math.floor(d/1E3);e.f=d%1E3*1E6;d=e}c.time=d;c.h=b.getId();c.f=new Uint8Array(b.a());a.a.push(c)}},Wz=function(a){return _.w(function*(){a.h&&(clearInterval(a.h),a.h=null);a.f&&(yield a.f);0<a.a.length&&(yield Qz(a),a.a=[]);a.j=!0})},Xz=function(a){_.w(function*(){a.g.info("Destroy the session and stop sending events.");
7
- _.Hh(a.a);a.Y=!1;const b=a.m.getNetworkEngine();b.Se(a.l);b.td(a.h);xz(b,a.h);a.f&&(yield Wz(a.f),a.f=null)})},eA=function(a){switch(a){case _.pp:return Yz;case _.qp:return Zz;case _.lp:return $z;case _.sp:return aA;case _.rp:return bA;case _.hp:return cA;case _.ip:return dA;default:return null}},fA=function(a,b){a.g.debug("Sending event",b);Nz(a.f,b)},nA=function(a,b){switch(a){case 1:return gA;case 2:return b===_.t?hA:b===_.q?iA:b===_.H?jA:b===_.ee?kA:lA;case 3:return mA;default:return lA}};var Az=class{constructor(){this.a=[]}length(){return this.a.length}end(){const a=this.a;this.a=[];return a}};var oA=class{constructor(a,b,c,d){this.downloadId=a;this.h=b;this.duration=c;this.j=d;this.f=[]}a(){const a=new Az;Jz(a,1,this.downloadId);Ez(a,2,this.h);Jz(a,3,this.duration);Ez(a,4,this.j);Jz(a,5,this.f);return a.end()}getId(){return 4}};var pA=class{constructor(a,b){this.f=a;this.url=b;this.downloadId=null;this.headers=[];this.size=this.duration=null}a(){const a=new Az;Ez(a,1,this.f);Jz(a,2,this.downloadId);Iz(a,3,this.url);Jz(a,4,this.headers);Iz(a,5,null);Jz(a,6,null);Jz(a,7,this.duration);Gz(a,8,this.size);return a.end()}getId(){return 2}};var qA=class{constructor(a,b){this.h=a;this.f=b}a(){const a=new Az;Ez(a,1,this.h);Kz(a,2,this.f);return a.end()}};var rA=class{constructor(a){this.cause=a;this.f=this.message=this.severity=this.errorCode=null}a(){const a=new Az;Ez(a,1,this.errorCode);Ez(a,2,this.severity);Iz(a,3,this.message);Iz(a,4,this.f);Jz(a,5,this.cause);return a.end()}getId(){return 7}};var Sz=class{constructor(a,b){this.key=a;this.value=b}a(){const a=new Az;Iz(a,1,this.key);Iz(a,2,this.value);return a.end()}};var sA=class{constructor(){this.cause=this.severity=this.code=null}a(){const a=new Az;Ez(a,1,this.code);Ez(a,2,this.severity);Jz(a,3,this.cause);return a.end()}getId(){return 12}};var tA=class{constructor(){this.data=null}a(){const a=new Az;Kz(a,1,this.data);return a.end()}};var uA=class extends tA{constructor(){super();var a=new Uint8Array(16);crypto.getRandomValues(a);a[6]=a[6]&15|64;a[8]=a[8]&63|128;this.data=a}toString(){const a=[];for(let b=0;256>b;++b)a.push((b+256).toString(16).slice(1));return a[this.data[0]]+a[this.data[1]]+a[this.data[2]]+a[this.data[3]]+"-"+a[this.data[4]]+a[this.data[5]]+"-"+a[this.data[6]]+a[this.data[7]]+"-"+a[this.data[8]]+a[this.data[9]]+"-"+a[this.data[10]]+a[this.data[11]]+a[this.data[12]]+a[this.data[13]]+a[this.data[14]]+a[this.data[15]]}};var Rz=class{constructor(){this.headers=[]}a(){const a=new Az;Jz(a,1,this.headers);return a.end()}getId(){return 1}};var Oz=class{constructor(){}a(){return(new Az).end()}getId(){return 6}};var Uz=class{constructor(a){this.j=a;this.f=this.h=this.time=this.sessionId=null}a(){const a=new Az;Jz(a,1,this.j);Jz(a,2,this.sessionId);Jz(a,3,this.time);Gz(a,4,null);Iz(a,5,null);Ez(a,6,this.h);Kz(a,7,this.f);return a.end()}};var Pz=class{constructor(){this.f=null;this.events=[]}a(){const a=new Az;Kz(a,1,this.f);Jz(a,2,this.events);return a.end()}};var Vz=class{constructor(){this.f=this.h=null}a(){const a=new Az;Gz(a,1,this.h);Ez(a,2,this.f);return a.end()}};var Lz=class{constructor(){this.f=this.h=null}a(){const a=new Az;Gz(a,1,this.h);Ez(a,2,this.f);return a.end()}};var vA=class{constructor(a,b,c,d,e,f,g,h,k){k=void 0===k?2500:k;this.o=a;this.l=h;this.w=new uA;this.A=new uA;this.a=[];this.h=setInterval(()=>Qz(this),k);this.f=null;this.j=!1;Tz(this,b,c,d,e,f,g)}};var wA=class{constructor(){this.reason=this.currentState=this.previousState=null}a(){const a=new Az;Ez(a,1,this.previousState);Ez(a,2,this.currentState);Ez(a,3,this.reason);Jz(a,4,null);Jz(a,5,null);Jz(a,6,null);return a.end()}getId(){return 5}};var AA=class extends _.Iv{constructor(){super();this.m=null;this.Y=this.j=!1;this.a=new _.Kt;this.f=null;this.g=new _.S("clpp.sessions.SessionsPlugin");this.l=this.F.bind(this);this.h=this.C.bind(this)}onPlayerCreated(a){this.m=a}onContentWillLoad(a){var b=a.getConfiguration().sessions;(b=!(!b||typeof b!==_.Fe))||this.g.debug("Sessions plugin is loaded but not configured. Will do nothing.");if(this.j=b)b=a.getConfiguration().sessions,b.apiUrl?(this.g.debug(_.sa),this.g.info("Create a session and start sending events."),
8
- a=_.ok(),this.f=new vA(new Uint8Array([]),a.browser,a.browserVersion.name,a.os,a.osVersion.name,"prestoplay-web",_.ea,b.apiUrl),this.a.on(this.m,_.Nf,this.B.bind(this)),this.a.on(this.m,_.Ff,this.A.bind(this)),this.a.on(this.m,_.Ef,this.w.bind(this)),this.a.on(this.m,_.Ud,this.o.bind(this)),a=this.m.getNetworkEngine(),a.me(this.l),a.Ac(this.h),a.l.push(this.h)):(this.g.warn(wz),a.onError(new _.I(1,9,15E3,wz)))}onPlayerWillRelease(){Xz(this)}id(){return"sessions"}B(a){if(!this.Y){a=a.detail;var b=
9
- a.currentState,c=new wA;c.previousState=eA(a.previousState);c.currentState=eA(b);fA(this,c)}}A(){if(!this.Y){var a=new wA;a.previousState=eA(this.m.getState());a.currentState=xA;fA(this,a);this.Y=!0}}w(){if(this.Y){var a=new wA;a.previousState=xA;a.currentState=eA(this.m.getState());fA(this,a);this.Y=!1}}o(a){a=a.detail;var b=new sA;b=new rA(new qA(b.getId(),new Uint8Array(b.a())));b.errorCode=a.code;b.message=a.message;b.f=a.stack;b.severity=a.severity===_.F?yA:zA;fA(this,b)}F(a){const b=new uA;
10
- a.downloadId=b;const c=new pA(nA(a.type,a.contentType),a.uris[0]);c.downloadId=b;c.headers=Object.keys(a.headers).map(d=>new Sz(d,a.headers[d]));fA(this,c)}C(a){var b=a.request.downloadId;b?(b=new oA(b,a.data.byteLength,Mz(a.timeMs||0),a.status||-1),b.f=Object.keys(a.headers).map(c=>new Sz(c,a.headers[c])),fA(this,b)):this.g.warn("Download ID is missing on download completed event.")}};_.fs(new class{create(){return new AA}});var zA=1,yA=2;var Yz=0,Zz=2,dA=3,xA=5,$z=6,aA=8,bA=10,cA=11;var gA=0,hA=1,iA=2,jA=3,kA=4,mA=5,lA=9;};f.call(g, window);