@castlabs/prestoplay 6.26.0 → 6.28.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 (68) hide show
  1. package/CHANGELOG.md +42 -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 +115 -113
  6. package/cjs/cl.conviva.js +32 -32
  7. package/cjs/cl.core.js +623 -623
  8. package/cjs/cl.crypto.js +9 -9
  9. package/cjs/cl.dash.js +89 -89
  10. package/cjs/cl.externs.js +112 -72
  11. package/cjs/cl.freewheel.js +25 -25
  12. package/cjs/cl.hls.js +78 -77
  13. package/cjs/cl.hlssmpte.js +6 -6
  14. package/cjs/cl.htmlcue.js +30 -30
  15. package/cjs/cl.ima.js +23 -24
  16. package/cjs/cl.mediatailor.js +3 -3
  17. package/cjs/cl.mse.js +353 -345
  18. package/cjs/cl.muxdata.js +14 -15
  19. package/cjs/cl.onboard.js +4 -3
  20. package/cjs/cl.persistent.js +15 -15
  21. package/cjs/cl.playlist.js +6 -6
  22. package/cjs/cl.simid.js +16 -17
  23. package/cjs/cl.smooth.js +72 -72
  24. package/cjs/cl.thumbnails.js +26 -26
  25. package/cjs/cl.tizen.js +73 -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 +38 -38
  33. package/cjs/polyfill.min.js +15 -3
  34. package/cl.adobe.js +3 -3
  35. package/cl.airplay.js +3 -3
  36. package/cl.broadpeak.js +6 -5
  37. package/cl.cast.js +93 -90
  38. package/cl.conviva.js +27 -27
  39. package/cl.core.js +506 -507
  40. package/cl.crypto.js +9 -9
  41. package/cl.dash.js +83 -82
  42. package/cl.externs.js +112 -72
  43. package/cl.freewheel.js +19 -19
  44. package/cl.hls.js +80 -79
  45. package/cl.hlssmpte.js +5 -5
  46. package/cl.htmlcue.js +26 -26
  47. package/cl.ima.js +17 -17
  48. package/cl.mediatailor.js +2 -3
  49. package/cl.mse.js +308 -305
  50. package/cl.muxdata.js +13 -13
  51. package/cl.onboard.js +4 -4
  52. package/cl.persistent.js +11 -11
  53. package/cl.playlist.js +5 -5
  54. package/cl.simid.js +14 -14
  55. package/cl.smooth.js +60 -60
  56. package/cl.thumbnails.js +19 -19
  57. package/cl.tizen.js +57 -57
  58. package/cl.ttml.js +22 -22
  59. package/cl.verimatrix.js +4 -4
  60. package/cl.vimond.js +8 -8
  61. package/cl.vr.js +15 -15
  62. package/cl.vtt.js +12 -12
  63. package/cl.yospace.js +3 -3
  64. package/cl.youbora.js +31 -29
  65. package/package.json +1 -1
  66. package/typings.d.ts +115 -63
  67. package/cjs/cl.sessions.js +0 -21
  68. package/cl.sessions.js +0 -10
package/typings.d.ts CHANGED
@@ -304,6 +304,59 @@ 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
+
321
+ /**
322
+ * Common Media Client Data (CMCD) configuration.
323
+ */
324
+ export type CmcdConfiguration = {
325
+ /**
326
+ * A unique string identifying the current content.
327
+ * Maximum length is 64 characters. This value is
328
+ * consistent across multiple different sessions and
329
+ * devices and is defined and updated at the
330
+ * discretion of the service provider.
331
+ */
332
+ contentId?: string;
333
+ /**
334
+ * Defines how CMCD data is transmitted. Use 'query' to send data via URL
335
+ * query parameter or 'headers' to send it via HTTP headers.
336
+ */
337
+ deliveryMode?: string;
338
+ /**
339
+ * If true, CMCD is enabled.
340
+ */
341
+ enabled?: boolean;
342
+ /**
343
+ * A coefficient which multiplies the value of rtp (requested maximum
344
+ * throughput) property. If rtpMultiplier=1 the value of rtp is calculated
345
+ * by the SDK as the min value needed to avoid buffering.
346
+ */
347
+ rtpMultiplier?: number;
348
+ /**
349
+ * Session ID to be sent in the CMCD headers. If undefined,
350
+ * the player will use its internal session ID.
351
+ */
352
+ sessionId?: string;
353
+ /**
354
+ * The only available version is 1. Changing this field
355
+ * will not change anything.
356
+ */
357
+ version?: number;
358
+ }
359
+
307
360
  /**
308
361
  * The purpose of companion SDK info is to be able to send info about
309
362
  * react-native SDK to our analytics
@@ -1102,6 +1155,10 @@ export namespace clpp {
1102
1155
  * The Playready path. Default is 'playready'.
1103
1156
  */
1104
1157
  playreadyUrl: string;
1158
+ /**
1159
+ * Widevine server certificate.
1160
+ */
1161
+ serverCertificate?: string|Uint8Array|null;
1105
1162
  /**
1106
1163
  * The Widevine path. Default is 'widevine'.
1107
1164
  */
@@ -1231,6 +1288,10 @@ export namespace clpp {
1231
1288
  * Broadpeak plugin configuration.
1232
1289
  */
1233
1290
  broadpeak?: Partial<clpp.BroadpeakConfiguration>;
1291
+ /**
1292
+ * Chromecast configuration.
1293
+ */
1294
+ chromecast?: Partial<clpp.ChromecastConfiguration>;
1234
1295
  /**
1235
1296
  * Connectivity check configuration is used to determine network connection.
1236
1297
  * If not configured, connectivity check will be disabled.
@@ -1421,10 +1482,6 @@ export namespace clpp {
1421
1482
  * Safari-related configuration.
1422
1483
  */
1423
1484
  safari?: Partial<clpp.SafariConfiguration>;
1424
- /**
1425
- * Sessions plugin configuration.
1426
- */
1427
- sessions?: Partial<clpp.SessionsConfiguration>;
1428
1485
  /**
1429
1486
  * SIMID plugin configuration.
1430
1487
  */
@@ -1844,16 +1901,6 @@ export namespace clpp {
1844
1901
  ldlDelay: number;
1845
1902
  }
1846
1903
 
1847
- /**
1848
- * Configuration section for PRESTOplay Sessions.
1849
- */
1850
- export type SessionsConfiguration = {
1851
- /**
1852
- * The event injection API URL.
1853
- */
1854
- apiUrl: string;
1855
- }
1856
-
1857
1904
  /**
1858
1905
  * Configuration container for SIMID
1859
1906
  */
@@ -3196,8 +3243,7 @@ export namespace clpp {
3196
3243
  */
3197
3244
  TRACKS_ADDED = "tracksadded",
3198
3245
  /**
3199
- * Triggered when the players load method is called and the
3200
- * player started to loaded the sources
3246
+ * Triggered when the player started to load the source.
3201
3247
  */
3202
3248
  LOAD_START = "loadstart",
3203
3249
  /**
@@ -4564,12 +4610,6 @@ export namespace clpp {
4564
4610
  * following properties:
4565
4611
  */
4566
4612
  MALFORMED_DATA_URI = 1004,
4567
- /**
4568
- * A network request was made with a data URI using an unknown encoding.
4569
- * The {@link clpp.Error#data|data} property contains an object with the
4570
- * following properties:
4571
- */
4572
- UNKNOWN_DATA_URI_ENCODING = 1005,
4573
4613
  /**
4574
4614
  * A request modifier threw an error. The {@link clpp.Error#cause|cause}
4575
4615
  * contains the original error.
@@ -4586,15 +4626,11 @@ export namespace clpp {
4586
4626
  */
4587
4627
  MALFORMED_TEST_URI = 1008,
4588
4628
  /**
4589
- * An unexpected network request was made to the FakeNetworkingEngine.
4590
- * This error is only used by unit and integration tests.
4591
- */
4592
- UNEXPECTED_TEST_REQUEST = 1009,
4593
- /**
4594
- * The number of retry attempts have run out.
4595
- * This is an internal error and shouldn't be propagated.
4629
+ * A network request was made with a malformed URL.
4630
+ * The {@link clpp.Error#data|data} property contains an object with the
4631
+ * following properties:
4596
4632
  */
4597
- ATTEMPTS_EXHAUSTED = 1010,
4633
+ MALFORMED_URL = 1011,
4598
4634
  /**
4599
4635
  * The text parser failed to parse a text stream due to an invalid header.
4600
4636
  */
@@ -4603,15 +4639,6 @@ export namespace clpp {
4603
4639
  * The text parser failed to parse a text stream due to an invalid cue.
4604
4640
  */
4605
4641
  INVALID_TEXT_CUE = 2001,
4606
- /**
4607
- * Was unable to detect the encoding of the response text. Suggest adding
4608
- * byte-order-markings to the response data.
4609
- */
4610
- UNABLE_TO_DETECT_ENCODING = 2003,
4611
- /**
4612
- * The response data contains invalid Unicode character encoding.
4613
- */
4614
- BAD_ENCODING = 2004,
4615
4642
  /**
4616
4643
  * The XML parser failed to parse an xml stream, or the XML lacks mandatory
4617
4644
  * elements for TTML.
@@ -4627,13 +4654,6 @@ export namespace clpp {
4627
4654
  * MP4 segment does not contain VTT.
4628
4655
  */
4629
4656
  INVALID_MP4_VTT = 2008,
4630
- /**
4631
- * When examining media in advance, we were unable to extract the cue time.
4632
- * This should only be possible with HLS, where we do not have explicit
4633
- * segment start times. The {@link clpp.Error#cause|cause}
4634
- * is the underlying exception or Error object.
4635
- */
4636
- UNABLE_TO_EXTRACT_CUE_START_TIME = 2009,
4637
4657
  /**
4638
4658
  * An error occurred while fetching or appending a text stream.
4639
4659
  * The {@link clpp.Error#data|data} is the underlying exception
@@ -4776,19 +4796,11 @@ export namespace clpp {
4776
4796
  * must be one of {@link clpp.Track.Type}.
4777
4797
  */
4778
4798
  INVALID_TRACK_TYPE = 3101,
4779
- /**
4780
- * An error raised when the requested track is unknown.
4781
- */
4782
- UNKNOWN_TRACK = 3102,
4783
4799
  /**
4784
4800
  * A media segment could not be decrypted. This can happen e.g for
4785
4801
  * HLS + AES-128 content.
4786
4802
  */
4787
4803
  MEDIA_DECRYPTION_ERROR = 3103,
4788
- /**
4789
- * An error raised when the play is not allowed.
4790
- */
4791
- PLAY_NOT_ALLOWED = 3200,
4792
4804
  /**
4793
4805
  * An error raised when the player fails to be paused.
4794
4806
  */
@@ -5041,15 +5053,16 @@ export namespace clpp {
5041
5053
  * only certain simple playlists are supported.
5042
5054
  */
5043
5055
  HLS_DISCONTINUITY_NOT_SUPPORTED = 4045,
5044
- /**
5045
- * Encountered a feature of HLS which is not currently supported.
5046
- */
5047
- HLS_UNSUPPORTED_FEATURE = 4046,
5048
5056
  /**
5049
5057
  * The content of the media playlist is incompatible with new content
5050
5058
  * after an update.
5051
5059
  */
5052
5060
  HLS_INCOMPATIBLE_PLAYLIST_UPDATE = 4047,
5061
+ /**
5062
+ * Media playlists for selected tracks in live represent disjoint time ranges
5063
+ * and therefore cannot be played together.
5064
+ */
5065
+ HLS_DISJOINT_PLAYLISTS = 4048,
5053
5066
  /**
5054
5067
  * The StreamingEngine called onChooseStreams() but the callback receiver
5055
5068
  * did not return the correct number or type of Streams.
@@ -5225,11 +5238,6 @@ export namespace clpp {
5225
5238
  * another load call has been executed.
5226
5239
  */
5227
5240
  OPERATION_ABORTED = 7001,
5228
- /**
5229
- * The call to Player.load() failed because the Player does not have a video
5230
- * element. The video element must be provided to the constructor.
5231
- */
5232
- NO_VIDEO_ELEMENT = 7002,
5233
5241
  /**
5234
5242
  * The player could not load the configured {@link clpp.Source}.
5235
5243
  * Either the player is missing some capabilities (e.g. from one or more
@@ -5811,6 +5819,10 @@ export namespace clpp {
5811
5819
  }
5812
5820
 
5813
5821
  namespace cast {
5822
+ /**
5823
+ * Returns instance of Queue.
5824
+ */
5825
+ function createCastQueue(): clpp.cast.Queue;
5814
5826
  export class CastProxy {
5815
5827
  /**
5816
5828
  * @param player player instance to use. This instance will be
@@ -5871,6 +5883,20 @@ export namespace clpp {
5871
5883
  * Checks if we are currently casting.
5872
5884
  */
5873
5885
  isCasting(): boolean;
5886
+ /**
5887
+ * Add items to the receiver queue.
5888
+ *
5889
+ * @param items queue items
5890
+ */
5891
+ queueAddItems(items: Array<any>): Promise<void>;
5892
+ /**
5893
+ * Requests the receiver to advance to the next queue item.
5894
+ */
5895
+ queueNextItem(): Promise<void>;
5896
+ /**
5897
+ * Requests the receiver to move to the previous queue item.
5898
+ */
5899
+ queuePreviousItem(): Promise<void>;
5874
5900
  /**
5875
5901
  * Remove message listener to 'urn:x-cast:castlabs' namespace.
5876
5902
  */
@@ -5938,6 +5964,10 @@ export namespace clpp {
5938
5964
 
5939
5965
  }
5940
5966
 
5967
+ export class Queue {
5968
+
5969
+ }
5970
+
5941
5971
  export class Receiver {
5942
5972
  /**
5943
5973
  * Add custom message listener to 'urn:x-cast:castlabs' namespace.
@@ -5954,6 +5984,11 @@ export namespace clpp {
5954
5984
  * Returns singleton instance of cast receiver.
5955
5985
  */
5956
5986
  static getInstance(): clpp.cast.Receiver;
5987
+ /**
5988
+ * Returns the Cast queue manager which exposes queue manipulation APIs for
5989
+ * the active receiver session.
5990
+ */
5991
+ getQueueManager(): any|undefined;
5957
5992
  /**
5958
5993
  * Binds instance of player to cast receiver. Ideally this should be called
5959
5994
  * before invoking `start()`.
@@ -6062,6 +6097,12 @@ export namespace clpp {
6062
6097
  * });
6063
6098
  */
6064
6099
  setPlayerConfigInterceptor(interceptor: clpp.cast.utils.PlayerConfigInterceptor|null): void;
6100
+ /**
6101
+ * Sets the queue instance.
6102
+ *
6103
+ * @param queue queue instance
6104
+ */
6105
+ setQueue(queue: any): void;
6065
6106
  /**
6066
6107
  * Starts receiver application.
6067
6108
  */
@@ -6393,6 +6434,10 @@ export namespace clpp {
6393
6434
  setDrmSystem(identifier: clpp.drm.KeySystem, config: clpp.PlayreadyDrmSystem|clpp.FairplayDrmSystem|clpp.WidevineDrmSystem): void;
6394
6435
  }
6395
6436
 
6437
+ export class DrmToday {
6438
+
6439
+ }
6440
+
6396
6441
  export class HeaderDrm {
6397
6442
  /**
6398
6443
  * @param wvLicenseUrl The Widevine License URL
@@ -8870,6 +8915,13 @@ export namespace clpp {
8870
8915
  }
8871
8916
 
8872
8917
  export class PlayerConfiguration {
8918
+ /**
8919
+ * Builds player configuration object including defaults to be serialized.
8920
+ *
8921
+ * @param configs Partial config objects to merge
8922
+ * @param options
8923
+ */
8924
+ static build(configs: Array<any>, options?: Record<string, any>): clpp.PlayerConfiguration;
8873
8925
  /**
8874
8926
  * Creates a configuration out of the data object and the
8875
8927
  * default configuration.
@@ -1,21 +0,0 @@
1
- (function(){var g={}; var _ = _ || {}
2
- var f=function(window){var RA="apiUrl config is missing",SA="prestoplay-web",TA=function(a,b){a.l=a.l.filter(function(c){return c!==b})},UA=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]},VA=function(){this.a=[]},YA=function(a,b,c){WA(a,b,c,function(d,e){XA(d,e)})},XA=function(a,b){if(0<=b)ZA(a,b);else{for(var c=b,d=0;9>d;d++)a.a.push(c&127|128),c>>=7;a.a.push(1)}},aB=function(a,b,c){WA(a,b,c,function(d,
3
- e){if(0<=e){var f=_.v(UA(e)),g=f.next().value;f=f.next().value;$A(d,g,f)}else f=_.v(UA(e)),g=f.next().value,f=f.next().value,$A(d,g,f)})},cB=function(a,b,c){bB(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)}})},eB=function(a,b,c){bB(a,b,c,function(d,e){dB(d,e.a())})},fB=function(a,b,c){bB(a,b,c,function(d,e){dB(d,e)})},dB=function(a,b){a.a.push.apply(a.a,b)},WA=function(a,b,c,d){if(!(null===c||void 0===c||typeof c===_.k&&0===c||typeof c===_.fg&&0===c.length||Array.isArray(c)&&0===c.length))if(Array.isArray(c)){ZA(a,b<<3|2);b=new VA;for(var e=0;e<c.length;e++)d(b,c[e]);XA(a,b.length());dB(a,b.end())}else ZA(a,b<<3|0),d(a,c)},
5
- bB=function(a,b,c,d){if(!(null===c||void 0===c||typeof c===_.k&&0===c||typeof c===_.fg&&0===c.length||Array.isArray(c)&&0===c.length))if(Array.isArray(c))for(var e=0;e<c.length;e++){ZA(a,b<<3|2);var f=new VA;d(f,c[e]);XA(a,f.length());dB(a,f.end())}else ZA(a,b<<3|2),b=new VA,d(b,c),XA(a,b.length()),dB(a,b.end())},ZA=function(a,b){for(;127<b;)a.a.push(b&127|128),b>>>=7;a.a.push(b)},$A=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)},gB=function(a,b,c,d){this.downloadId=
6
- a;this.h=b;this.duration=c;this.j=d;this.f=[]},hB=function(a,b){this.f=a;this.url=b;this.downloadId=null;this.headers=[];this.size=this.duration=null},iB=function(a,b){this.h=a;this.f=b},jB=function(a){this.cause=a;this.f=this.message=this.severity=this.errorCode=null},kB=function(a,b){this.key=a;this.value=b},lB=function(){this.cause=this.severity=this.code=null},mB=function(){this.data=null},nB=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},oB=function(){this.headers=[]},pB=function(){},qB=function(a){this.j=a;this.f=this.h=this.time=this.sessionId=null},rB=function(){this.f=null;this.events=[]},sB=function(){this.f=this.h=null},tB=function(){this.f=this.h=null},uB=function(a){var b=new tB;b.h=Math.floor(a/1E3);b.f=a%1E3*1E6;return b},xB=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 nB;this.A=new nB;this.a=[];this.h=setInterval(function(){return vB(g)},h);
8
- this.f=null;this.j=!1;wB(this,a,b,c,d)},yB=function(a){return _.H(function(b){switch(b.a){case 1:a.h&&(clearInterval(a.h),a.h=null);if(!a.f){b.D(2);break}return _.x(b,a.f,2);case 2:if(!(0<a.a.length)){b.D(4);break}return _.x(b,vB(a),5);case 5:a.a=[];case 4:a.j=!0,_.z(b)}})},wB=function(a,b,c,d,e){var f=new oB;f.headers=[new kB("CL-BROWSER-NAME",b),new kB("CL-BROWSER-VERSION",c),new kB("CL-OS-FAMILY",d),new kB("CL-OS-VERSION",e),new kB("CL-SDK-NAME",SA),new kB("CL-SDK-NAME",SA),new kB("CL-SDK-VERSION",
9
- _.ia)];zB(a,f)},vB=function(a){var b,c,d,e;return _.H(function(f){if(1==f.a){if(a.j||a.f)return f["return"]();0===a.a.length&&zB(a,new pB);b=function(){};a.f=new Promise(function(g){b=g});_.uh(f);c=new rB;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:_.sb,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+"'"));_.wh(f);b();a.f=null;return _.xh(f)})},zB=function(a,b){if(!a.j){var c=new qB(a.w);c.sessionId=a.A;var d=Date.now(),e=new sB;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)}},AB=function(){this.reason=this.currentState=this.previousState=null},BB=function(){this.m=null;this.f=this.l=!1;this.a=new _.hi;this.h=null;this.g=new _.J("clpp.sessions.SessionsPlugin");this.o=this.ln.bind(this);this.j=this.kn.bind(this)},
11
- JB=function(a){switch(a){case _.wq:return CB;case _.Iq:return DB;case _.Bq:return EB;case _.Kq:return FB;case _.Jq:return GB;case _.Dq:return HB;case _.Hq:return IB;default:return null}},RB=function(a,b){switch(a){case 1:return KB;case 2:return b===_.Jg?LB:b===_.Pc?MB:b===_.qj?NB:b===_.te?OB:PB;case 3:return QB;default:return PB}},SB=function(a){var b;_.H(function(c){if(1==c.a)return a.g.info("Destroy the session and stop sending events."),_.li(a.a),a.f=!1,b=a.m.getNetworkEngine(),b.Kg(a.o),b.Ce(a.j),
12
- TA(b,a.j),a.h?_.x(c,yB(a.h),3):c.D(0);a.h=null;_.z(c)})},TB=function(a,b){a.g.debug("Sending event",b);zB(a.h,b)},UB=function(){};VA.prototype.length=function(){return this.a.length};VA.prototype.end=function(){var a=this.a;this.a=[];return a};gB.prototype.a=function(){var a=new VA;eB(a,1,this.downloadId);YA(a,2,this.h);eB(a,3,this.duration);YA(a,4,this.j);eB(a,5,this.f);return a.end()};gB.prototype.getId=function(){return 4};hB.prototype.a=function(){var a=new VA;YA(a,1,this.f);eB(a,2,this.downloadId);cB(a,3,this.url);eB(a,4,this.headers);cB(a,5,null);eB(a,6,null);eB(a,7,this.duration);aB(a,8,this.size);return a.end()};hB.prototype.getId=function(){return 2};iB.prototype.a=function(){var a=new VA;YA(a,1,this.h);fB(a,2,this.f);return a.end()};jB.prototype.a=function(){var a=new VA;YA(a,1,this.errorCode);YA(a,2,this.severity);cB(a,3,this.message);cB(a,4,this.f);eB(a,5,this.cause);return a.end()};jB.prototype.getId=function(){return 7};kB.prototype.a=function(){var a=new VA;cB(a,1,this.key);cB(a,2,this.value);return a.end()};lB.prototype.a=function(){var a=new VA;YA(a,1,this.code);YA(a,2,this.severity);eB(a,3,this.cause);return a.end()};lB.prototype.getId=function(){return 12};mB.prototype.a=function(){var a=new VA;fB(a,1,this.data);return a.end()};_.w(nB,mB);nB.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]]};oB.prototype.a=function(){var a=new VA;eB(a,1,this.headers);return a.end()};oB.prototype.getId=function(){return 1};pB.prototype.a=function(){return(new VA).end()};pB.prototype.getId=function(){return 6};qB.prototype.a=function(){var a=new VA;eB(a,1,this.j);eB(a,2,this.sessionId);eB(a,3,this.time);aB(a,4,null);cB(a,5,null);YA(a,6,this.h);fB(a,7,this.f);return a.end()};rB.prototype.a=function(){var a=new VA;fB(a,1,this.f);eB(a,2,this.events);return a.end()};sB.prototype.a=function(){var a=new VA;aB(a,1,this.h);YA(a,2,this.f);return a.end()};tB.prototype.a=function(){var a=new VA;aB(a,1,this.h);YA(a,2,this.f);return a.end()};AB.prototype.a=function(){var a=new VA;YA(a,1,this.previousState);YA(a,2,this.currentState);YA(a,3,this.reason);eB(a,4,null);eB(a,5,null);eB(a,6,null);return a.end()};AB.prototype.getId=function(){return 5};_.w(BB,_.ew);_.r=BB.prototype;_.r.onPlayerCreated=function(a){this.m=a};
13
- _.r.onContentWillLoad=function(a){var b=a.getConfiguration().sessions;(b=!(!b||typeof b!==_.Se))||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=_.yk(),this.h=new xB(a.browser,a.browserVersion.name,a.os,a.osVersion.name,b.apiUrl),this.a.on(this.m,_.cg,this.Yk.bind(this)),this.a.on(this.m,_.Vf,this.Xk.bind(this)),this.a.on(this.m,_.Uf,
14
- this.Wk.bind(this)),this.a.on(this.m,_.ie,this.Vk.bind(this)),a=this.m.getNetworkEngine(),a.Wf(this.o),a.gd(this.j),a.l.push(this.j)):(this.g.warn(RA),a.onError(new _.N(1,9,15E3,RA)))};_.r.onPlayerWillRelease=function(){SB(this)};_.r.id=function(){return"sessions"};_.r.Yk=function(a){if(!this.f){a=a.detail;var b=a.currentState,c=new AB;c.previousState=JB(a.previousState);c.currentState=JB(b);TB(this,c)}};
15
- _.r.Xk=function(){if(!this.f){var a=new AB;a.previousState=JB(this.m.getState());a.currentState=VB;TB(this,a);this.f=!0}};_.r.Wk=function(){if(this.f){var a=new AB;a.previousState=VB;a.currentState=JB(this.m.getState());TB(this,a);this.f=!1}};_.r.Vk=function(a){a=a.detail;var b=new lB;b=new jB(new iB(b.getId(),new Uint8Array(b.a())));b.errorCode=a.code;b.message=a.message;b.f=a.stack;b.severity=a.severity===_.O?WB:XB;TB(this,b)};
16
- _.r.ln=function(a){var b=new nB;a.downloadId=b;var c=new hB(RB(a.type,a.contentType),a.uris[0]);c.downloadId=b;c.headers=Object.keys(a.headers).map(function(d){return new kB(d,a.headers[d])});TB(this,c)};_.r.kn=function(a){var b=a.request.downloadId;b?(b=new gB(b,a.data.byteLength,uB(a.timeMs||0),a.status||-1),b.f=Object.keys(a.headers).map(function(c){return new kB(c,a.headers[c])}),TB(this,b)):this.g.warn("Download ID is missing on download completed event.")};UB.prototype.create=function(){return new BB};
17
- _.bu(new UB);var XB=1,WB=2;var CB=0,DB=2,IB=3,VB=5,EB=6,FB=8,GB=10,HB=11;var KB=0,LB=1,MB=2,NB=3,OB=4,QB=5,PB=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 Gz="apiUrl config is missing",Hz=function(a,b){a.l=a.l.filter(c=>c!==b)},Iz=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]},Nz=function(a,b,c,d){if(!(null===c||void 0===c||typeof c===_.t&&0===c||typeof c===_.Pf&&0===c.length||Array.isArray(c)&&0===c.length))if(Array.isArray(c)){Jz(a,b<<3|2);b=new Kz;for(let e=0;e<c.length;e++)d(b,c[e]);Lz(a,b.length());Mz(a,b.end())}else Jz(a,
2
- b<<3|0),d(a,c)},Lz=function(a,b){if(0<=b)Jz(a,b);else{for(let c=0;9>c;c++)a.a.push(b&127|128),b>>=7;a.a.push(1)}},Oz=function(a,b,c){Nz(a,b,c,(d,e)=>{Lz(d,e)})},Jz=function(a,b){for(;127<b;)a.a.push(b&127|128),b>>>=7;a.a.push(b)},Qz=function(a,b,c){Nz(a,b,c,(d,e)=>{if(0<=e){{const [f,g]=Iz(e);Pz(d,f,g)}}else{{const [f,g]=Iz(e);Pz(d,f,g)}}})},Rz=function(a,b,c,d){if(!(null===c||void 0===c||typeof c===_.t&&0===c||typeof c===_.Pf&&0===c.length||Array.isArray(c)&&0===c.length))if(Array.isArray(c))for(let e=
3
- 0;e<c.length;e++){Jz(a,b<<3|2);const f=new Kz;d(f,c[e]);Lz(a,f.length());Mz(a,f.end())}else Jz(a,b<<3|2),b=new Kz,d(b,c),Lz(a,b.length()),Mz(a,b.end())},Sz=function(a,b,c){Rz(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)}})},Mz=function(a,b){a.a.push.apply(a.a,b)},Tz=function(a,b,c){Rz(a,b,c,(d,e)=>{Mz(d,e.a())})},Uz=function(a,b,c){Rz(a,b,c,(d,e)=>{Mz(d,e)})},Pz=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)},Wz=function(a){const b=new Vz;b.h=Math.floor(a/1E3);b.f=a%1E3*1E6;return b},$z=function(a){return _.x(function*(){if(!a.j&&!a.f){0===a.a.length&&Xz(a,new Yz);var b=()=>
5
- {};a.f=new Promise(c=>{b=c});try{const c=new Zz;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}}})},cA=function(a,b,c,d,e,f,g){const h=new aA;h.headers=[new bA("CL-BROWSER-NAME",b),new bA("CL-BROWSER-VERSION",
6
- c),new bA("CL-OS-FAMILY",d),new bA("CL-OS-VERSION",e),new bA("CL-SDK-NAME",f),new bA("CL-SDK-NAME",f),new bA("CL-SDK-VERSION",g)];Xz(a,h)},Xz=function(a,b){if(!a.j){var c=new dA(a.w);c.sessionId=a.A;{var d=Date.now();const e=new eA;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)}},fA=function(a){return _.x(function*(){a.h&&(clearInterval(a.h),a.h=null);a.f&&(yield a.f);0<a.a.length&&(yield $z(a),a.a=[]);a.j=!0})},gA=function(a){_.x(function*(){a.g.info("Destroy the session and stop sending events.");
7
- _.Fh(a.a);a.Z=!1;const b=a.m.getNetworkEngine();b.af(a.l);b.Cd(a.h);Hz(b,a.h);a.f&&(yield fA(a.f),a.f=null)})},oA=function(a){switch(a){case _.Wo:return hA;case _.Xo:return iA;case _.So:return jA;case _.Zo:return kA;case _.Yo:return lA;case _.Oo:return mA;case _.Po:return nA;default:return null}},pA=function(a,b){a.g.debug("Sending event",b);Xz(a.f,b)},xA=function(a,b){switch(a){case 1:return qA;case 2:return b===_.w?rA:b===_.p?sA:b===_.H?tA:b===_.ce?uA:vA;case 3:return wA;default:return vA}};var Kz=class{constructor(){this.a=[]}length(){return this.a.length}end(){const a=this.a;this.a=[];return a}};var yA=class{constructor(a,b,c,d){this.downloadId=a;this.h=b;this.duration=c;this.j=d;this.f=[]}a(){const a=new Kz;Tz(a,1,this.downloadId);Oz(a,2,this.h);Tz(a,3,this.duration);Oz(a,4,this.j);Tz(a,5,this.f);return a.end()}getId(){return 4}};var zA=class{constructor(a,b){this.f=a;this.url=b;this.downloadId=null;this.headers=[];this.size=this.duration=null}a(){const a=new Kz;Oz(a,1,this.f);Tz(a,2,this.downloadId);Sz(a,3,this.url);Tz(a,4,this.headers);Sz(a,5,null);Tz(a,6,null);Tz(a,7,this.duration);Qz(a,8,this.size);return a.end()}getId(){return 2}};var AA=class{constructor(a,b){this.h=a;this.f=b}a(){const a=new Kz;Oz(a,1,this.h);Uz(a,2,this.f);return a.end()}};var BA=class{constructor(a){this.cause=a;this.f=this.message=this.severity=this.errorCode=null}a(){const a=new Kz;Oz(a,1,this.errorCode);Oz(a,2,this.severity);Sz(a,3,this.message);Sz(a,4,this.f);Tz(a,5,this.cause);return a.end()}getId(){return 7}};var bA=class{constructor(a,b){this.key=a;this.value=b}a(){const a=new Kz;Sz(a,1,this.key);Sz(a,2,this.value);return a.end()}};var CA=class{constructor(){this.cause=this.severity=this.code=null}a(){const a=new Kz;Oz(a,1,this.code);Oz(a,2,this.severity);Tz(a,3,this.cause);return a.end()}getId(){return 12}};var DA=class{constructor(){this.data=null}a(){const a=new Kz;Uz(a,1,this.data);return a.end()}};var EA=class extends DA{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 aA=class{constructor(){this.headers=[]}a(){const a=new Kz;Tz(a,1,this.headers);return a.end()}getId(){return 1}};var Yz=class{constructor(){}a(){return(new Kz).end()}getId(){return 6}};var dA=class{constructor(a){this.j=a;this.f=this.h=this.time=this.sessionId=null}a(){const a=new Kz;Tz(a,1,this.j);Tz(a,2,this.sessionId);Tz(a,3,this.time);Qz(a,4,null);Sz(a,5,null);Oz(a,6,this.h);Uz(a,7,this.f);return a.end()}};var Zz=class{constructor(){this.f=null;this.events=[]}a(){const a=new Kz;Uz(a,1,this.f);Tz(a,2,this.events);return a.end()}};var eA=class{constructor(){this.f=this.h=null}a(){const a=new Kz;Qz(a,1,this.h);Oz(a,2,this.f);return a.end()}};var Vz=class{constructor(){this.f=this.h=null}a(){const a=new Kz;Qz(a,1,this.h);Oz(a,2,this.f);return a.end()}};var FA=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 EA;this.A=new EA;this.a=[];this.h=setInterval(()=>$z(this),k);this.f=null;this.j=!1;cA(this,b,c,d,e,f,g)}};var GA=class{constructor(){this.reason=this.currentState=this.previousState=null}a(){const a=new Kz;Oz(a,1,this.previousState);Oz(a,2,this.currentState);Oz(a,3,this.reason);Tz(a,4,null);Tz(a,5,null);Tz(a,6,null);return a.end()}getId(){return 5}};var KA=class extends _.Sv{constructor(){super();this.m=null;this.Z=this.j=!1;this.a=new _.Rt;this.f=null;this.g=new _.T("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!==_.Ee))||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=_.Yk(),this.f=new FA(new Uint8Array([]),a.browser,a.browserVersion.name,a.os,a.osVersion.name,"prestoplay-web",_.ea,b.apiUrl),this.a.on(this.m,_.Mf,this.B.bind(this)),this.a.on(this.m,_.Ef,this.A.bind(this)),this.a.on(this.m,_.Df,this.w.bind(this)),this.a.on(this.m,_.r,this.o.bind(this)),a=this.m.getNetworkEngine(),a.ue(this.l),a.Gc(this.h),a.l.push(this.h)):(this.g.warn(Gz),a.onError(new _.I(1,9,15E3,Gz)))}onPlayerWillRelease(){gA(this)}id(){return"sessions"}B(a){if(!this.Z){a=a.detail;var b=a.currentState,
9
- c=new GA;c.previousState=oA(a.previousState);c.currentState=oA(b);pA(this,c)}}A(){if(!this.Z){var a=new GA;a.previousState=oA(this.m.getState());a.currentState=HA;pA(this,a);this.Z=!0}}w(){if(this.Z){var a=new GA;a.previousState=HA;a.currentState=oA(this.m.getState());pA(this,a);this.Z=!1}}o(a){a=a.detail;var b=new CA;b=new BA(new AA(b.getId(),new Uint8Array(b.a())));b.errorCode=a.code;b.message=a.message;b.f=a.stack;b.severity=a.severity===_.G?IA:JA;pA(this,b)}F(a){const b=new EA;a.downloadId=b;
10
- const c=new zA(xA(a.type,a.contentType),a.uris[0]);c.downloadId=b;c.headers=Object.keys(a.headers).map(d=>new bA(d,a.headers[d]));pA(this,c)}C(a){var b=a.request.downloadId;b?(b=new yA(b,a.data.byteLength,Wz(a.timeMs||0),a.status||-1),b.f=Object.keys(a.headers).map(c=>new bA(c,a.headers[c])),pA(this,b)):this.g.warn("Download ID is missing on download completed event.")}};_.Mr(new class{create(){return new KA}});var JA=1,IA=2;var hA=0,iA=2,nA=3,HA=5,jA=6,kA=8,lA=10,mA=11;var qA=0,rA=1,sA=2,tA=3,uA=4,wA=5,vA=9;};f.call(g, window);