@svta/cml-cmcd 1.0.1 → 2.0.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.
package/dist/index.d.ts CHANGED
@@ -1,423 +1,270 @@
1
- import { SfItem, SfToken } from "@svta/cml-structured-field-values";
2
- import { CmObjectType, CmStreamType, CmStreamingFormat } from "@svta/cml-cta";
3
- import { Request, ValueOf, ValueOrArray } from "@svta/cml-utils";
1
+ import { SfBareItem, SfItem, SfToken } from "@svta/cml-structured-field-values";
2
+ import { ExclusiveRecord, Request, ValueOf, ValueOrArray } from "@svta/cml-utils";
4
3
 
5
- //#region src/CmcdCustomKey.d.ts
4
+ //#region src/CmcdEventType.d.ts
6
5
 
7
6
  /**
8
- * A custom key for CMCD. Custom keys MUST carry a hyphenated prefix
9
- * to ensure that there will not be a namespace collision with future
10
- * revisions to this specification. Clients SHOULD use a reverse-DNS
11
- * syntax when defining their own prefix.
7
+ * CMCD event type for the 'br' key (bitrate change).
12
8
  *
9
+ * @public
10
+ */
11
+ declare const CMCD_EVENT_BITRATE_CHANGE: "br";
12
+ /**
13
+ * CMCD event type for the 'ps' key (play state change).
13
14
  *
14
- * @beta
15
+ * @public
15
16
  */
16
- type CmcdCustomKey = `${string}-${string}`;
17
- //#endregion
18
- //#region src/CmcdObjectType.d.ts
17
+ declare const CMCD_EVENT_PLAY_STATE: "ps";
19
18
  /**
20
- * Common Media Client Data Object Type
19
+ * CMCD event type for the 'e' key (error).
21
20
  *
21
+ * @public
22
+ */
23
+ declare const CMCD_EVENT_ERROR: "e";
24
+ /**
25
+ * CMCD event type for the 't' key (time interval).
22
26
  *
23
- * @beta
27
+ * @public
28
+ */
29
+ declare const CMCD_EVENT_TIME_INTERVAL: "t";
30
+ /**
31
+ * CMCD event type for the 'c' key (content ID).
24
32
  *
25
- * @enum
33
+ * @public
26
34
  */
27
- declare const CmcdObjectType: typeof CmObjectType;
35
+ declare const CMCD_EVENT_CONTENT_ID: "c";
28
36
  /**
29
- * @beta
37
+ * CMCD event type for the 'b' key (backgrounded mode).
38
+ *
39
+ * @public
30
40
  */
31
- type CmcdObjectType = CmObjectType;
32
- //#endregion
33
- //#region src/CmcdStreamType.d.ts
41
+ declare const CMCD_EVENT_BACKGROUNDED_MODE: "b";
34
42
  /**
35
- * Common Media Client Data Stream Type
43
+ * CMCD event type for the 'm' key (mute).
36
44
  *
45
+ * @public
46
+ */
47
+ declare const CMCD_EVENT_MUTE: "m";
48
+ /**
49
+ * CMCD event type for the 'um' key (unmute).
37
50
  *
38
- * @enum
51
+ * @public
52
+ */
53
+ declare const CMCD_EVENT_UNMUTE: "um";
54
+ /**
55
+ * CMCD event type for the 'pe' key (player expand).
39
56
  *
40
- * @beta
57
+ * @public
41
58
  */
42
- declare const CmcdStreamType: typeof CmStreamType;
59
+ declare const CMCD_EVENT_PLAYER_EXPAND: "pe";
43
60
  /**
44
- * @beta
61
+ * CMCD event type for the 'pc' key (player collapse).
62
+ *
63
+ * @public
45
64
  */
46
- type CmcdStreamType = CmStreamType;
47
- //#endregion
48
- //#region src/CmcdStreamingFormat.d.ts
65
+ declare const CMCD_EVENT_PLAYER_COLLAPSE: "pc";
49
66
  /**
50
- * Common Media Client Data Streaming Format
67
+ * CMCD event type for the 'rr' key (response received).
51
68
  *
69
+ * @public
70
+ */
71
+ declare const CMCD_EVENT_RESPONSE_RECEIVED: "rr";
72
+ /**
73
+ * CMCD event type for the 'as' key (ad start).
52
74
  *
53
- * @enum
75
+ * @public
76
+ */
77
+ declare const CMCD_EVENT_AD_START: "as";
78
+ /**
79
+ * CMCD event type for the 'ae' key (ad end).
54
80
  *
55
- * @beta
81
+ * @public
56
82
  */
57
- declare const CmcdStreamingFormat: typeof CmStreamingFormat;
83
+ declare const CMCD_EVENT_AD_END: "ae";
58
84
  /**
59
- * @beta
85
+ * CMCD event type for the 'abs' key (ad break start).
86
+ *
87
+ * @public
60
88
  */
61
- type CmcdStreamingFormat = CmStreamingFormat;
62
- //#endregion
63
- //#region src/CmcdValue.d.ts
89
+ declare const CMCD_EVENT_AD_BREAK_START: "abs";
64
90
  /**
65
- * CMCD Value
91
+ * CMCD event type for the 'abe' key (ad break end).
66
92
  *
93
+ * @public
94
+ */
95
+ declare const CMCD_EVENT_AD_BREAK_END: "abe";
96
+ /**
97
+ * CMCD event type for the 'sk' key (skip).
67
98
  *
68
- * @beta
99
+ * @public
69
100
  */
70
- type CmcdValue = CmcdObjectType | CmcdStreamingFormat | CmcdStreamType | string | string[] | number | number[] | boolean | symbol | SfToken | SfItem | SfItem[];
71
- //#endregion
72
- //#region src/Cmcd.d.ts
101
+ declare const CMCD_EVENT_SKIP: "sk";
73
102
  /**
74
- * Common Media Client Data (CMCD) is a standardized set of HTTP request header fields and query string parameters.
103
+ * CMCD event type for the 'ce' key (custom event).
75
104
  *
76
- * @see {@link https://cdn.cta.tech/cta/media/media/resources/standards/pdfs/cta-5004-final.pdf|CMCD Spec}
105
+ * @public
106
+ */
107
+ declare const CMCD_EVENT_CUSTOM_EVENT: "ce";
108
+ /**
109
+ * CMCD event types for the 'e' key (event mode).
77
110
  *
78
111
  *
79
- * @beta
112
+ * @enum
113
+ *
114
+ * @public
80
115
  */
81
- type Cmcd = {
82
- /**
83
- * Custom key names may be used, but they MUST carry a hyphenated prefix to ensure that there will not be a namespace collision
84
- * with future revisions to this specification. Clients SHOULD use a reverse-DNS syntax when defining their own prefix.
85
- */
86
- [index: CmcdCustomKey]: CmcdValue;
87
- /**
88
- * Encoded bitrate
89
- *
90
- * The encoded bitrate of the audio or video object being requested. This may not be known precisely by the player; however,
91
- * it MAY be estimated based upon playlist/manifest declarations. If the playlist declares both peak and average bitrate values,
92
- * the peak value should be transmitted.
93
- *
94
- * Integer kbps
95
- */
96
- br?: number;
97
- /**
98
- * Object duration
99
- *
100
- * The playback duration in milliseconds of the object being requested. If a partial segment is being requested, then this value
101
- * MUST indicate the playback duration of that part and not that of its parent segment. This value can be an approximation of the
102
- * estimated duration if the explicit value is not known.
103
- *
104
- * Integer milliseconds
105
- */
106
- d?: number;
107
- /**
108
- * Object type
109
- *
110
- * The media type of the current object being requested:
111
- * - `m` = text file, such as a manifest or playlist
112
- * - `a` = audio only
113
- * - `v` = video only
114
- * - `av` = muxed audio and video
115
- * - `i` = init segment
116
- * - `c` = caption or subtitle
117
- * - `tt` = ISOBMFF timed text track
118
- * - `k` = cryptographic key, license or certificate.
119
- * - `o` = other
120
- *
121
- * If the object type being requested is unknown, then this key MUST NOT be used.
122
- */
123
- ot?: CmcdObjectType;
116
+ declare const CmcdEventType: {
124
117
  /**
125
- * Top bitrate
126
- *
127
- * The highest bitrate rendition in the manifest or playlist that the client is allowed to play, given current codec, licensing and
128
- * sizing constraints.
129
- *
130
- * Integer Kbps
118
+ * A change in the bitrate.
131
119
  */
132
- tb?: number;
120
+ readonly BITRATE_CHANGE: typeof CMCD_EVENT_BITRATE_CHANGE;
133
121
  /**
134
- * Buffer length
135
- *
136
- * The buffer length associated with the media object being requested. This value MUST be rounded to the nearest 100 ms. This key SHOULD only be
137
- * sent with an object type of ‘a’, ‘v’ or ‘av’.
138
- *
139
- * Integer milliseconds
122
+ * A change in the player state.
140
123
  */
141
- bl?: number;
124
+ readonly PLAY_STATE: typeof CMCD_EVENT_PLAY_STATE;
142
125
  /**
143
- * Deadline
144
- *
145
- * Deadline from the request time until the first sample of this Segment/Object needs to be available in order to not create a buffer underrun or
146
- * any other playback problems. This value MUST be rounded to the nearest 100ms. For a playback rate of 1, this may be equivalent to the player’s
147
- * remaining buffer length.
148
- *
149
- * Integer milliseconds
126
+ * An error event.
150
127
  */
151
- dl?: number;
128
+ readonly ERROR: typeof CMCD_EVENT_ERROR;
152
129
  /**
153
- * Measured mtp CMCD throughput
154
- *
155
- * The throughput between client and server, as measured by the client and MUST be rounded to the nearest 100 kbps. This value, however derived,
156
- * SHOULD be the value that the client is using to make its next Adaptive Bitrate switching decision. If the client is connected to multiple
157
- * servers concurrently, it must take care to report only the throughput measured against the receiving server. If the client has multiple concurrent
158
- * connections to the server, then the intent is that this value communicates the aggregate throughput the client sees across all those connections.
159
- *
160
- * Integer kbps
130
+ * A periodic report sent on a time interval.
161
131
  */
162
- mtp?: number;
132
+ readonly TIME_INTERVAL: typeof CMCD_EVENT_TIME_INTERVAL;
163
133
  /**
164
- * Next object request
165
- *
166
- * Relative path of the next object to be requested. This can be used to trigger pre-fetching by the CDN. This MUST be a path relative to the current
167
- * request. This string MUST be URLEncoded. The client SHOULD NOT depend upon any pre-fetch action being taken - it is merely a request for such a
168
- * pre-fetch to take place.
169
- *
170
- * String
134
+ * A change of the content ID.
171
135
  */
172
- nor?: ValueOrArray<string | SfItem>;
136
+ readonly CONTENT_ID: typeof CMCD_EVENT_CONTENT_ID;
173
137
  /**
174
- * Next range request
175
- *
176
- * If the next request will be a partial object request, then this string denotes the byte range to be requested. If the ‘nor’ field is not set, then the
177
- * object is assumed to match the object currently being requested. The client SHOULD NOT depend upon any pre-fetch action being taken – it is merely a
178
- * request for such a pre-fetch to take place. Formatting is similar to the HTTP Range header, except that the unit MUST be ‘byte’, the ‘Range:’ prefix is
179
- * NOT required and specifying multiple ranges is NOT allowed. Valid combinations are:
180
- *
181
- * - `"\<range-start\>-"`
182
- * - `"\<range-start\>-\<range-end\>"`
183
- * - `"-\<suffix-length\>"`
184
- *
185
- * String
138
+ * A change in the application's backgrounded state.
186
139
  */
187
- nrr?: string;
140
+ readonly BACKGROUNDED_MODE: typeof CMCD_EVENT_BACKGROUNDED_MODE;
188
141
  /**
189
- * Startup
190
- *
191
- * Key is included without a value if the object is needed urgently due to startup, seeking or recovery after a buffer-empty event. The media SHOULD not be
192
- * rendering when this request is made. This key MUST not be sent if it is FALSE.
193
- *
194
- * Boolean
142
+ * The player was muted.
195
143
  */
196
- su?: boolean;
144
+ readonly MUTE: typeof CMCD_EVENT_MUTE;
197
145
  /**
198
- * Content ID
199
- *
200
- * A unique string identifying the current content. Maximum length is 64 characters. This value is consistent across multiple different
201
- * sessions and devices and is defined and updated at the discretion of the service provider.
202
- *
203
- * String
146
+ * Player unmuted.
204
147
  */
205
- cid?: string;
148
+ readonly UNMUTE: typeof CMCD_EVENT_UNMUTE;
206
149
  /**
207
- * Playback rate
208
- *
209
- * `1` if real-time, `2` if double speed, `0` if not playing. SHOULD only be sent if not equal to `1`.
210
- *
211
- * Decimal
150
+ * The player view was expanded.
212
151
  */
213
- pr?: number;
152
+ readonly PLAYER_EXPAND: typeof CMCD_EVENT_PLAYER_EXPAND;
214
153
  /**
215
- * Streaming format
216
- *
217
- * The streaming format that defines the current request.
218
- *
219
- * - `d` = MPEG DASH
220
- * - `h` = HTTP Live Streaming (HLS)
221
- * - `s` = Smooth Streaming
222
- * - `o` = other
223
- *
224
- * If the streaming format being requested is unknown, then this key MUST NOT be used.
154
+ * The player view was collapsed.
225
155
  */
226
- sf?: CmcdStreamingFormat;
156
+ readonly PLAYER_COLLAPSE: typeof CMCD_EVENT_PLAYER_COLLAPSE;
227
157
  /**
228
- * Session ID
229
- *
230
- * A GUID identifying the current playback session. A playback session typically ties together segments belonging to a single media asset.
231
- * Maximum length is 64 characters. It is RECOMMENDED to conform to the UUID specification.
232
- *
233
- * String
158
+ * The receipt of a response.
234
159
  */
235
- sid?: string;
160
+ readonly RESPONSE_RECEIVED: typeof CMCD_EVENT_RESPONSE_RECEIVED;
236
161
  /**
237
- * Stream type
238
- * - `v` = all segments are available – e.g., VOD
239
- * - `l` = segments become available over time – e.g., LIVE
162
+ * The start of an ad.
240
163
  */
241
- st?: CmcdStreamType;
164
+ readonly AD_START: typeof CMCD_EVENT_AD_START;
242
165
  /**
243
- * CMCD version
244
- *
245
- * The version of this specification used for interpreting the defined key names and values. If this key is omitted, the client and server MUST
246
- * interpret the values as being defined by version 1. Client SHOULD omit this field if the version is 1.
247
- *
248
- * Integer
166
+ * The end of an ad.
249
167
  */
250
- v?: number;
168
+ readonly AD_END: typeof CMCD_EVENT_AD_END;
251
169
  /**
252
- * Buffer starvation
253
- *
254
- * Key is included without a value if the buffer was starved at some point between the prior request and this object request,
255
- * resulting in the player being in a rebuffering state and the video or audio playback being stalled. This key MUST NOT be
256
- * sent if the buffer was not starved since the prior request.
257
- *
258
- * If the object type `ot` key is sent along with this key, then the `bs` key refers to the buffer associated with the particular
259
- * object type. If no object type is communicated, then the buffer state applies to the current session.
260
- *
261
- * Boolean
170
+ * The start of an ad break.
262
171
  */
263
- bs?: boolean;
172
+ readonly AD_BREAK_START: typeof CMCD_EVENT_AD_BREAK_START;
264
173
  /**
265
- * Requested maximum throughput
266
- *
267
- * The requested maximum throughput that the client considers sufficient for delivery of the asset. Values MUST be rounded to the
268
- * nearest 100kbps. For example, a client would indicate that the current segment, encoded at 2Mbps, is to be delivered at no more
269
- * than 10Mbps, by using rtp=10000.
270
- *
271
- * Note: This can benefit clients by preventing buffer saturation through over-delivery and can also deliver a community benefit
272
- * through fair-share delivery. The concept is that each client receives the throughput necessary for great performance, but no more.
273
- * The CDN may not support the rtp feature.
274
- *
275
- * Integer kbps
174
+ * The end of an ad break.
276
175
  */
277
- rtp?: number;
278
- };
279
- //#endregion
280
- //#region src/CMCD_EVENT_MODE.d.ts
281
- /**
282
- * CMCD event mode variable name.
283
- *
284
- *
285
- * @beta
286
- */
287
- declare const CMCD_EVENT_MODE = "event";
288
- //#endregion
289
- //#region src/CMCD_REQUEST_MODE.d.ts
290
- /**
291
- * CMCD request mode variable name.
292
- *
293
- *
294
- * @beta
295
- */
296
- declare const CMCD_REQUEST_MODE = "request";
297
- //#endregion
298
- //#region src/CmcdReportingMode.d.ts
299
- /**
300
- * CMCD reporting mode types.
301
- *
302
- *
303
- * @enum
304
- *
305
- * @beta
306
- */
307
- declare const CmcdReportingMode: {
176
+ readonly AD_BREAK_END: typeof CMCD_EVENT_AD_BREAK_END;
308
177
  /**
309
- * Request mode
178
+ * The user skipped an ad.
310
179
  */
311
- readonly REQUEST: typeof CMCD_REQUEST_MODE;
180
+ readonly SKIP: typeof CMCD_EVENT_SKIP;
312
181
  /**
313
- * Event mode
182
+ * A custom event.
314
183
  */
315
- readonly EVENT: typeof CMCD_EVENT_MODE;
184
+ readonly CUSTOM_EVENT: typeof CMCD_EVENT_CUSTOM_EVENT;
316
185
  };
317
186
  /**
318
- * @beta
319
- */
320
- type CmcdReportingMode = ValueOf<typeof CmcdReportingMode>;
321
- //#endregion
322
- //#region src/CmcdFormatterOptions.d.ts
323
- /**
324
- * Options for formatting CMCD data values.
325
- *
326
- *
327
- * @beta
187
+ * @public
328
188
  */
329
- type CmcdFormatterOptions = {
330
- /**
331
- * The version of the CMCD specification to use.
332
- */
333
- version: number;
334
- /**
335
- * The reporting mode to use.
336
- */
337
- reportingMode: CmcdReportingMode;
338
- /**
339
- * The base URL to use for relative URLs.
340
- */
341
- baseUrl?: string;
342
- };
189
+ type CmcdEventType = ValueOf<typeof CmcdEventType>;
343
190
  //#endregion
344
- //#region src/CmcdFormatter.d.ts
191
+ //#region src/CmcdCustomKey.d.ts
345
192
  /**
346
- * A formatter for CMCD values.
347
- *
348
- * @param value - The value to format.
349
- *
350
- * @returns The formatted value.
351
- *
193
+ * A custom key for CMCD. Custom keys MUST carry a hyphenated prefix
194
+ * to ensure that there will not be a namespace collision with future
195
+ * revisions to this specification. Clients SHOULD use a reverse-DNS
196
+ * syntax when defining their own prefix.
352
197
  *
353
- * @beta
198
+ * @public
354
199
  */
355
- type CmcdFormatter = (value: CmcdValue, options: CmcdFormatterOptions) => number | ValueOrArray<string> | ValueOrArray<SfItem>;
200
+ type CmcdCustomKey = `${string}-${string}`;
356
201
  //#endregion
357
- //#region src/CmcdEventExcludedKeys.d.ts
202
+ //#region src/CmcdCustomValue.d.ts
358
203
  /**
359
- * Keys that are excluded from CMCD event mode.
204
+ * A value type for custom CMCD keys.
360
205
  *
361
- *
362
- * @beta
206
+ * @public
363
207
  */
364
- type CmcdEventExcludedKeys = "bsd" | "d" | "dl" | "nor" | "ot" | "rtp" | "sid" | "su";
208
+ type CmcdCustomValue = string | SfItem<string> | (string | SfItem<string>)[] | number | SfItem<number> | (number | SfItem<number>)[] | boolean | SfItem<boolean> | (boolean | SfItem<boolean>)[] | symbol | SfItem<symbol> | (symbol | SfItem<symbol>)[] | SfToken | SfItem<SfToken> | (SfToken | SfItem<SfToken>)[];
365
209
  //#endregion
366
- //#region src/CmcdEventType.d.ts
210
+ //#region src/CmcdObjectType.d.ts
367
211
  /**
368
- * CMCD event types for the 'e' key (event mode).
212
+ * Common Media Client Data Object Type
369
213
  *
214
+ * @public
370
215
  *
371
216
  * @enum
372
- *
373
- * @beta
374
217
  */
375
- declare const CmcdEventType: {
376
- /**
377
- * A change in the player state.
378
- */
379
- readonly PLAY_STATE: "ps";
218
+ declare const CmcdObjectType: {
380
219
  /**
381
- * An error event.
220
+ * text file, such as a manifest or playlist
382
221
  */
383
- readonly ERROR: "e";
222
+ readonly MANIFEST: "m";
384
223
  /**
385
- * A periodic report sent on a time interval.
224
+ * audio only
386
225
  */
387
- readonly TIME_INTERVAL: "t";
226
+ readonly AUDIO: "a";
388
227
  /**
389
- * A change of the content ID.
228
+ * video only
390
229
  */
391
- readonly CONTENT_ID: "c";
230
+ readonly VIDEO: "v";
392
231
  /**
393
- * A change in the application's backgrounded state.
232
+ * muxed audio and video
394
233
  */
395
- readonly BACKGROUNDED_MODE: "b";
234
+ readonly MUXED: "av";
396
235
  /**
397
- * The player was muted.
236
+ * init segment
398
237
  */
399
- readonly MUTE: "m";
238
+ readonly INIT: "i";
400
239
  /**
401
- * Player unmuted.
240
+ * caption or subtitle
402
241
  */
403
- readonly UNMUTE: "um";
242
+ readonly CAPTION: "c";
404
243
  /**
405
- * The player view was expanded.
244
+ * ISOBMFF timed text track
406
245
  */
407
- readonly PLAYER_EXPAND: "pe";
246
+ readonly TIMED_TEXT: "tt";
408
247
  /**
409
- * The player view was collapsed.
248
+ * cryptographic key, license or certificate.
410
249
  */
411
- readonly PLAYER_COLLAPSE: "pc";
250
+ readonly KEY: "k";
412
251
  /**
413
- * The receipt of a response.
252
+ * other
414
253
  */
415
- readonly RESPONSE_RECEIVED: "rr";
254
+ readonly OTHER: "o";
416
255
  };
417
256
  /**
418
- * @beta
257
+ * @public
419
258
  */
420
- type CmcdEventType = ValueOf<typeof CmcdEventType>;
259
+ type CmcdObjectType = ValueOf<typeof CmcdObjectType>;
260
+ //#endregion
261
+ //#region src/CmcdObjectTypeList.d.ts
262
+ /**
263
+ * A numeric list with an optional object type boolean flag.
264
+ *
265
+ * @public
266
+ */
267
+ type CmcdObjectTypeList = (number | SfItem<number, ExclusiveRecord<CmcdObjectType, boolean>>)[];
421
268
  //#endregion
422
269
  //#region src/CmcdPlayerState.d.ts
423
270
  /**
@@ -426,7 +273,7 @@ type CmcdEventType = ValueOf<typeof CmcdEventType>;
426
273
  *
427
274
  * @enum
428
275
  *
429
- * @beta
276
+ * @public
430
277
  */
431
278
  declare const CmcdPlayerState: {
432
279
  /**
@@ -471,433 +318,862 @@ declare const CmcdPlayerState: {
471
318
  readonly PRELOADING: "d";
472
319
  };
473
320
  /**
474
- * @beta
321
+ * @public
475
322
  */
476
323
  type CmcdPlayerState = ValueOf<typeof CmcdPlayerState>;
477
324
  //#endregion
325
+ //#region src/CmcdStreamType.d.ts
326
+ /**
327
+ * Common Media Client Data Stream Type
328
+ *
329
+ *
330
+ * @enum
331
+ *
332
+ * @public
333
+ */
334
+ declare const CmcdStreamType: {
335
+ /**
336
+ * All segments are available – e.g., VOD
337
+ */
338
+ readonly VOD: "v";
339
+ /**
340
+ * Segments become available over time – e.g., LIVE
341
+ */
342
+ readonly LIVE: "l";
343
+ /**
344
+ * Low latency stream
345
+ */
346
+ readonly LOW_LATENCY: "ll";
347
+ };
348
+ /**
349
+ * @public
350
+ */
351
+ type CmcdStreamType = ValueOf<typeof CmcdStreamType>;
352
+ //#endregion
353
+ //#region src/CmcdStreamingFormat.d.ts
354
+ /**
355
+ * Common Media Client Data Streaming Format
356
+ *
357
+ *
358
+ * @enum
359
+ *
360
+ * @public
361
+ */
362
+ declare const CmcdStreamingFormat: {
363
+ /**
364
+ * MPEG DASH
365
+ */
366
+ readonly DASH: "d";
367
+ /**
368
+ * HTTP Live Streaming (HLS)
369
+ */
370
+ readonly HLS: "h";
371
+ /**
372
+ * Smooth Streaming
373
+ */
374
+ readonly SMOOTH: "s";
375
+ /**
376
+ * Other
377
+ */
378
+ readonly OTHER: "o";
379
+ };
380
+ /**
381
+ * @public
382
+ */
383
+ type CmcdStreamingFormat = ValueOf<typeof CmcdStreamingFormat>;
384
+ //#endregion
478
385
  //#region src/CmcdRequest.d.ts
479
386
  /**
480
- * Common Media Client Data (CMCD) is a standardized set of HTTP request header fields and query string parameters.
387
+ * Common Media Client Data (CMCD) version 2 - Request Mode.
388
+ *
389
+ * A standardized set of HTTP request header fields and query string parameters
390
+ * for communicating media playback metrics in request mode.
481
391
  *
392
+ * @see {@link https://cdn.cta.tech/cta/media/media/resources/standards/pdfs/cta-5004-final.pdf|CMCD v1 Spec}
482
393
  *
483
- * @beta
394
+ * @public
484
395
  */
485
- type CmcdRequest = Omit<Cmcd, "nrr"> & {
396
+ type CmcdRequest = {
397
+ /**
398
+ * Custom key names may be used, but they MUST carry a hyphenated prefix to ensure that there will not be a namespace collision
399
+ * with future revisions to this specification. Clients SHOULD use a reverse-DNS syntax when defining their own prefix.
400
+ */
401
+ [index: CmcdCustomKey]: CmcdCustomValue | undefined;
486
402
  /**
487
403
  * Aggregate encoded bitrate
488
404
  *
489
- * The aggregate encoded bitrate of the complete media object including all object types. This SHOULD be derived from
490
- * playlist/manifest declarations, or it MAY be estimated by the player. If the playlist declares both peak and average bitrate values,
491
- * the peak value MUST be transmitted. This value MUST NOT be sent for objects which do not have an object type of 'a', 'v', 'av' or 'o'.
492
- * This value MUST NOT be sent if the encoded bitrate is known.
405
+ * The aggregate encoded bitrate across a playable combination of tracks. This metric SHOULD NOT be used when the individual bitrates
406
+ * of the tracks are known. This value SHOULD be derived from a playlist/manifest declaration, or it MAY be estimated by the player.
407
+ * If the playlist declares both peak and average bitrate values, the peak value MUST be transmitted. This value MUST NOT be sent if
408
+ * the encoded bitrate is known.
409
+ *
410
+ * Inner list of integer kbps with token identifiers
411
+ */
412
+ ab?: CmcdObjectTypeList;
413
+ /**
414
+ * Backgrounded
415
+ *
416
+ * All players in a session are currently in a state that is not visible to the user due to a user interaction. This key SHOULD only
417
+ * be sent if it is TRUE. If the visibility state of the player is not known this key SHOULD NOT be reported.
418
+ *
419
+ * Boolean
420
+ */
421
+ bg?: boolean;
422
+ /**
423
+ * Buffer length
424
+ *
425
+ * The buffer length associated with the media object being requested. This value SHOULD be rounded to the nearest 100 ms.
426
+ *
427
+ * Inner list of integer milliseconds with token identifiers
428
+ */
429
+ bl?: CmcdObjectTypeList;
430
+ /**
431
+ * Encoded bitrate
432
+ *
433
+ * The encoded bitrate. In request mode, this refers to the encoded bitrate of the requested representation.
434
+ * In event mode this refers to the encoded bitrate of the currently selected representation.
435
+ * This SHOULD be derived from playlist/manifest declarations, or it MAY be estimated by the player.
436
+ * If the playlist declares both peak and average bitrate values, the peak value MUST be transmitted.
437
+ *
438
+ * Inner list of integer kbps with token identifiers
439
+ */
440
+ br?: CmcdObjectTypeList;
441
+ /**
442
+ * Buffer starvation
443
+ *
444
+ * TRUE if the player buffer was starved at some point between the prior report and this report per reporting destination, resulting in
445
+ * the player entering a rebuffering state or remaining in a rebuffering state. Note that if the player begins requesting data from a
446
+ * new CDN, then this key might initially report buffering caused by the prior CDN. This key SHOULD NOT be reported if it is FALSE.
447
+ *
448
+ * Boolean
449
+ */
450
+ bs?: boolean;
451
+ /**
452
+ * Buffer Starvation Absolute
453
+ *
454
+ * An absolute count of buffer starvation events since session initiation. A buffer starvation event occurs when the state changes
455
+ * to rebuffering. Token identifier MAY be omitted if the cause of the rebuffering is unknown.
456
+ *
457
+ * Inner list of integers with optional token identifiers
458
+ */
459
+ bsa?: CmcdObjectTypeList;
460
+ /**
461
+ * Buffer Starvation Duration
462
+ *
463
+ * A list of durations of each buffer starvation period reported once the rebuffering has completed. This value MUST only be reported
464
+ * once per reporting mode and report destination. Token identifier MAY be omitted if the cause of the rebuffering is unknown.
465
+ *
466
+ * Inner list of integer milliseconds with optional token identifiers
467
+ */
468
+ bsd?: CmcdObjectTypeList;
469
+ /**
470
+ * Buffer Starvation Duration Absolute
471
+ *
472
+ * An absolute count of buffer starvation duration since session initiation. Token identifier MAY be omitted if the cause of the
473
+ * rebuffering is unknown.
474
+ *
475
+ * Inner list of integer milliseconds with optional token identifiers
476
+ */
477
+ bsda?: CmcdObjectTypeList;
478
+ /**
479
+ * CDN ID
480
+ *
481
+ * A string identifying the current delivery network from which the player is retrieving content. Maximum length is 128 characters.
482
+ *
483
+ * String
484
+ */
485
+ cdn?: string;
486
+ /**
487
+ * Content ID
488
+ *
489
+ * A unique string identifying the current content. The maximum length is 128 characters. This value is consistent across multiple different
490
+ * sessions and devices and is defined and updated at the discretion of the service provider.
491
+ *
492
+ * String
493
+ */
494
+ cid?: string;
495
+ /**
496
+ * Content Signature
497
+ *
498
+ * A string representing a signature of the content being played. This field SHOULD vary with content ID and be bound by some mechanism
499
+ * to the content. For example, this field may be used to transmit the C2PA signature associated with the content being viewed.
493
500
  *
494
- * Integer kbps
501
+ * String
495
502
  */
496
- ab?: number;
503
+ cs?: string;
497
504
  /**
498
- * Target buffer length (ms)
505
+ * Object duration
499
506
  *
500
- * The target buffer length associated with the media object being requested at the time of the request.
501
- * This value SHOULD be rounded to the nearest 100 ms. This value MUST NOT be sent for objects which do not have an object
502
- * type of 'a', 'v', 'av', 'tt', 'c', or 'o'
507
+ * The playback duration in milliseconds of the object being requested. If a partial segment is being requested,
508
+ * then this value MUST indicate the playback duration of that part and not that of its parent segment.
509
+ * This value can be an approximation of the estimated duration if the explicit value is not known.
510
+ * This value MUST NOT be sent for objects which do not have an object type of 'a', 'v', 'av', 'tt', 'c', or 'o'.
503
511
  *
504
512
  * Integer milliseconds
505
513
  */
506
- tbl?: number;
514
+ d?: number;
507
515
  /**
508
- * CDN ID (string, max 128 chars)
516
+ * Dropped Frames Absolute
509
517
  *
510
- * A string identifying the current delivery network from which the player is retrieving content. Maximum length is 128 characters
518
+ * An absolute count of dropped frames since session initiation. This key SHOULD only be sent for content types of 'v', 'av' or 'o'.
519
+ * Note that this value will be driven by the content being rendered rather than the content being retrieved, therefore it is
520
+ * beneficial if accompanied by the playhead time 'pt' key to allow for correct interpretation.
511
521
  *
512
- * String
522
+ * Integer
513
523
  */
514
- cdn?: string;
524
+ dfa?: number;
515
525
  /**
516
- * Live stream latency (ms)
526
+ * Deadline
517
527
  *
518
- * The time delta between when a given media timestamp was made available at the origin and when it was rendered by the client.
519
- * The accuracy of this estimate is dependent on synchronization between the packager and the player clocks.
528
+ * Deadline from the request time until the first sample of this Segment/Object needs to be available in order to not create a buffer underrun
529
+ * or any other playback problems. This value MUST be rounded to the nearest 100ms. For a playback rate of 1, this may be equivalent to the
530
+ * player's remaining buffer length.
520
531
  *
521
- * Integer Milliseconds
532
+ * Integer milliseconds
522
533
  */
523
- ltc?: number;
534
+ dl?: number;
524
535
  /**
525
- * Backgrounded (all players in session not visible, boolean)
536
+ * Player Error Code
537
+ *
538
+ * A string defining an error code produced by the player. The namespace and formatting of this error code is left to the application.
526
539
  *
527
- * All players in a session are currently in a state that is not visible to the user.
528
- * This key SHOULD only be sent if it is TRUE.
529
- * If the visibility state of the player is not known this key SHOULD NOT be reported
540
+ * Even if only one error code is being specified, the list notation MUST still be used.
530
541
  *
531
- * Bool
542
+ * Inner list of strings
532
543
  */
533
- bg?: boolean;
544
+ ec?: string[];
534
545
  /**
535
- * State (player state, e.g. "s", "p", etc.)
546
+ * Lowest aggregated encoded bitrate
536
547
  *
537
- * A token describing the current playback state of the player as perceived by the end user, one of:
538
- * s - starting: the player has been instructed to play media for a given session, either by a user interaction or by an autoplay action.
539
- * p - playing : Media is being rendered.
540
- * k - seeking : The start of the user initiated action of moving the playhead position.
541
- * r - rebuffering : Media has stopped being rendered due to an insufficient buffer. This state is not reported during startup or seeking.
542
- * a - paused : Playback has been intentionally paused by the user.
543
- * w - waiting : Playback has been paused by the player.
544
- * e - ended : Rendering has ended due to completion of the media asset playback.
545
- * f - fatal error : Rendering has ended due to an irrecoverable error.
546
- * q - quit : User initiated end of playback before media asset completion.
547
- * d - preloading : the player is loading assets ahead of starting in order to provide a fast startup. The expectation is that playback will commence at a future time.
548
- *
549
- * Note: if used with Request Mode or Response Mode, then this key represents a snapshot of the state at request time, which may obscure prior state changes since the last request.
550
- * For most accurate state tracking in players, use State-Interval mode.
551
- * The addition of a timestamp in Request Mode might be useful in correctly placing the state change on a timeline.
552
- *
553
- * Token - one of [s,p,k,r,a,w,e,f,q,d]
548
+ * The lowest aggregated bitrate rendition in the manifest or playlist. This SHOULD be derived from playlist/manifest declarations,
549
+ * or it MAY be estimated by the player. If the playlist declares both peak and average bitrate values, the peak value MUST be
550
+ * transmitted. The aggregate encoded bitrate is of the complete media object including all object types. This value MUST NOT be
551
+ * sent if the lowest encoded bitrate is known.
552
+ *
553
+ * Inner list of integer kbps with token identifiers
554
554
  */
555
- sta?: CmcdPlayerState;
555
+ lab?: CmcdObjectTypeList;
556
556
  /**
557
- * The encoded bitrate of the audio or video object being shown to the end user.
557
+ * Lowest encoded bitrate
558
558
  *
559
- * Integer Kbps
559
+ * The lowest bitrate rendition in the manifest or playlist. This SHOULD be derived from playlist/manifest declarations, or it MAY be
560
+ * estimated by the player. If the playlist declares both peak and average bitrate values, the peak value MUST be transmitted. This
561
+ * lowest bitrate MUST apply to the object type being requested. Requests for video objects MUST specify the lowest video bitrate and
562
+ * requests for audio objects MUST specify the lowest audio bitrate.
563
+ *
564
+ * Inner list of integer kbps with token identifiers
560
565
  */
561
- pb?: number;
566
+ lb?: CmcdObjectTypeList;
562
567
  /**
563
- * Timestamp (ms since UNIX epoch, required for event mode)
568
+ * Live stream latency
564
569
  *
565
- * The timestamp at which the associated event occurred, expressed as milliseconds since the UNIX epoch.
566
- * When the event is a request for a media object the time SHOULD reference when the request was first initiated.
567
- * When used with Response Mode, the timestamp should indicate the time at which the object was first requested and not when it was received.
570
+ * The time delta between when a given media timestamp was made available at the origin and when it was rendered by the player. The
571
+ * accuracy of this estimate is dependent on synchronization between the packager and the player clocks.
568
572
  *
569
573
  * Integer milliseconds
570
574
  */
571
- ts?: number;
575
+ ltc?: number;
572
576
  /**
573
- * Top playable bitrate (kbps)
577
+ * Media Start Delay
574
578
  *
575
- * The highest bitrate rendition that the player is currently capable of playing for reasons other than bandwidth limitations.
576
- * This key captures the cases in which, for example, screen resolution, DRM, or performance constraints limit the player's topmost choice of bitrate.
577
- * These constraints are intentionally obfuscated for privacy reasons.
578
- * This key can increase the fingerprinting surface exposed by CMCD transmission and SHOULD NOT be transmitted in a default player configuration.
579
+ * Measures the initial delay in wall-clock time from when a player is instructed to play media for a given session to when any media
580
+ * begins playback, whether it be primary content or interstitial content. This value SHOULD be the time difference between the
581
+ * "starting" and "playing" states.
579
582
  *
580
- * If the playlist declares both peak and average bitrate values, the peak value MUST be transmitted.
581
- * This top playable bitrate MUST apply to the object type being requested.
582
- * Requests for video objects MUST specify the top playable video bitrate and requests for audio objects MUST specify the top playable audio bitrate.
583
- * This value MUST NOT be sent for objects which do not have an object type of 'a', 'v', 'av' or 'c'.
583
+ * This key MUST only be sent once per Session ID and MUST be sent for each reporting mode which is active within the player.
584
584
  *
585
- * Integer Kbps
585
+ * Integer milliseconds
586
586
  */
587
- tpb?: number;
587
+ msd?: number;
588
588
  /**
589
- * Lowest encoded bitrate (kbps)
589
+ * Measured throughput
590
590
  *
591
- * The lowest bitrate rendition in the manifest or playlist.
592
- * This SHOULD be derived from playlist/manifest declarations, or it MAY be estimated by the player.
593
- * If the playlist declares both peak and average bitrate values, the peak value MUST be transmitted.
594
- * This lowest bitrate MUST apply to the object type being requested.
595
- * Requests for video objects MUST specify the lowest video bitrate and requests for audio objects MUST specify the lowest audio bitrate.
596
- * This value MUST NOT be sent for objects which do not have an object type of 'a', 'v', 'av' or 'c'.
591
+ * The throughput between player and server, as measured by the player. Throughput MUST be rounded to the nearest 100 kbps. This value, however
592
+ * derived, SHOULD be the value that the player is using to make its next Adaptive Bitrate switching decision. If the player is requesting
593
+ * different object types from different providers then it SHOULD take care to match the throughput measured against that provider with each
594
+ * object type request. It is acceptable to report aggregate information if objects of the same type are requested from different providers.
595
+ * If the player has multiple concurrent connections to the provider, then the intent is that this value communicates the aggregate throughput
596
+ * the player sees across all those connections. If this key is sent on an interval report, the value transmitted should be the last throughput
597
+ * estimate made by the player prior to making the report. There is no requirement for the player to calculate the average measured throughput
598
+ * since the prior interval report.
597
599
  *
598
- * Integer Kbps
600
+ * Inner list of integer kbps with token identifiers
599
601
  */
600
- lb?: number;
602
+ mtp?: CmcdObjectTypeList;
601
603
  /**
602
- * Top aggregated encoded bitrate (kbps)
604
+ * Next object request
603
605
  *
604
- * The highest aggregated bitrate rendition in the manifest or playlist.
605
- * This SHOULD be derived from playlist/manifest declarations, or it MAY be estimated by the player.
606
- * If the playlist declares both peak and average bitrate values,the peak value MUST be transmitted.
607
- * The aggregate encoded bitrate is of the complete media object including all object types.
608
- * This value MUST NOT be sent for objects which do not have an object type of 'a', 'v', 'av' or 'c'.
609
- * This value MUST NOT be sent if the top encoded bitrate is known
606
+ * The relative path, as defined by RFC 3986, to one or more objects which can reasonably be expected to be requested by the player making
607
+ * the current request. Each object SHOULD be fetched in its entirety unless there is a range associated with the future request. Even if
608
+ * only one object is being specified, the list notation MUST still be used. If there is a range associated with the future request, then
609
+ * the range is communicated as the parameter 'r' with a String value. The formatting of the String value is similar to the HTTP Range
610
+ * header, except that the unit MUST be 'byte', the 'Range:' prefix is NOT permitted, specifying multiple ranges is NOT allowed and the
611
+ * only valid combinations are:
610
612
  *
611
- * Integer Kbps
613
+ * - `"<range-start>-"`
614
+ * - `"<range-start>-<range-end>"`
615
+ * - `"-<suffix-length>"`
616
+ *
617
+ * The player SHOULD NOT depend upon any pre-fetch action being taken - it is merely a request for such a pre-fetch to take place.
618
+ *
619
+ * Inner list of strings
612
620
  */
613
- tab?: number;
621
+ nor?: (string | SfItem<string, {
622
+ r: string;
623
+ }>)[];
614
624
  /**
615
- * Lowest aggregated encoded bitrate (kbps)
625
+ * Non rendered
616
626
  *
617
- * The lowest aggregated bitrate rendition in the manifest or playlist.
618
- * This SHOULD be derived from playlist/manifest declarations, or it MAY be estimated by the player.
619
- * If the playlist declares both peak and average bitrate values, the peak value MUST be transmitted.
620
- * The aggregate encoded bitrate is of the complete media object including all object types.
621
- * This value MUST NOT be sent for objects which do not have an object type of 'a', 'v', 'av' or 'c'.
622
- * This value MUST NOT be sent if the lowest encoded bitrate is known.
627
+ * True when the content being retrieved by a player is not rendered as audio or video. The key SHOULD only be sent when it is TRUE.
623
628
  *
624
- * Integer Kbps
629
+ * Boolean
630
+ */
631
+ nr?: boolean;
632
+ /**
633
+ * Object type
634
+ *
635
+ * The media type of the current object being requested:
636
+ * - `m` = text file, such as a manifest or playlist
637
+ * - `a` = audio only
638
+ * - `v` = video only
639
+ * - `av` = muxed audio and video
640
+ * - `i` = init segment
641
+ * - `c` = caption or subtitle
642
+ * - `tt` = ISOBMFF timed text track
643
+ * - `k` = cryptographic key, license or certificate.
644
+ * - `o` = other
645
+ *
646
+ * If the object type being requested is unknown, then this key MUST NOT be used.
647
+ *
648
+ * This key is also used as a token parameter for other keys.
649
+ *
650
+ * Token
651
+ */
652
+ ot?: CmcdObjectType;
653
+ /**
654
+ * Playhead bitrate
655
+ *
656
+ * The encoded bitrate of the media object(s) being shown to the end user.
657
+ *
658
+ * Inner list of integer kbps with token identifiers
659
+ */
660
+ pb?: CmcdObjectTypeList;
661
+ /**
662
+ * Playback rate
663
+ *
664
+ * 1.0 if real-time, 2.0 if double speed, 0 if not playing. SHOULD only be sent if not equal to 1.0.
665
+ *
666
+ * Decimal
625
667
  */
626
- lab?: number;
668
+ pr?: number;
627
669
  /**
628
- * Playhead time (ms)
670
+ * Playhead time
629
671
  *
630
672
  * The playhead time, expressed in milliseconds, which is being rendered to the viewer when the report is made.
631
- * For Response and State-Interval modes, this corresponds to the playhead time that was rendered at the wallclock time reported by the timestamp field.
632
673
  *
633
674
  * Integer milliseconds
634
675
  */
635
676
  pt?: number;
636
677
  /**
637
- * Error code(s), application-defined
678
+ * Requested maximum throughput
638
679
  *
639
- * A string defining an error code produced by the player.
640
- * The namespace and formatting of this error code is left to the application.
641
- * Use of standardized error codes is recommended.
642
- * Errors should be buffered per report destination as they occur and reported along with the next CMCD report.
643
- * With Event mode there is the option to report errors as they occur.
680
+ * The requested maximum throughput that the player considers sufficient for delivery of the asset. Values MUST be rounded to the
681
+ * nearest 100kbps.
644
682
  *
645
- * An Inner List of Strings
683
+ * Integer kbps
646
684
  */
647
- ec?: string | string[];
685
+ rtp?: number;
648
686
  /**
649
- * Media Start Delay (ms)
687
+ * Streaming format
650
688
  *
651
- * Measures the initial delay in wall-clock time from when a player is instructed to play media for a given session to when any media begins playback,
652
- * whether it be primary content or interstitial content.
653
- * This value SHOULD be the time difference between the "starting" and "playing" states.
654
- * This key MUST only be sent once per Session ID and MUST be sent for each reporting mode which is active within the player.
655
- * For request and response reporting modes, this key SHOULD be sent on the next media object request following successful startup.
689
+ * The streaming format that defines the current request.
656
690
  *
657
- * Integer milliseconds
691
+ * - `d` = MPEG DASH
692
+ * - `h` = HTTP Live Streaming (HLS)
693
+ * - `e` = HESP
694
+ * - `s` = Smooth Streaming
695
+ * - `o` = other
696
+ *
697
+ * Token
658
698
  */
659
- msd?: number;
699
+ sf?: CmcdStreamingFormat;
700
+ /**
701
+ * Session ID
702
+ *
703
+ * A GUID identifying the current playback session. A playback session typically consists of the playback of a single media asset along
704
+ * with accompanying content such as advertisements. This session may comprise the playback of primary content combined with interstitial
705
+ * content. This session is being played on a single device. The maximum length is 64 characters. It is RECOMMENDED to conform to the
706
+ * UUID specification.
707
+ *
708
+ * String
709
+ */
710
+ sid?: string;
660
711
  /**
661
712
  * Sequence Number
662
713
  *
663
- * A monotonically increasing integer to identify the sequence of a CMCD report to a target within a session. This MUST be reset to zero on the start of
664
- * a new session-id. Sequence numbers increase independently per each combination of mode and target.
714
+ * A monotonically increasing integer to identify the sequence of a CMCD report to a target within a session. This MUST be reset to
715
+ * zero on the start of a new session-id. Sequence numbers increase independently per each combination of mode and target.
665
716
  *
666
717
  * Integer
667
718
  */
668
719
  sn?: number;
669
720
  /**
670
- * Buffer starvation duration
721
+ * Stream type
722
+ *
723
+ * - `v` = all segments are available - e.g., VOD
724
+ * - `l` = segments become available over time - e.g., LIVE
725
+ * - `ll` = low latency LIVE
726
+ *
727
+ * Token
728
+ */
729
+ st?: CmcdStreamType;
730
+ /**
731
+ * State
671
732
  *
672
- * Duration of the latest rebuffering period reported once the rebuffering has completed. This value MUST only be reported once per rebuffering incident, per object type.
733
+ * A token describing the current playback state of the player as perceived by the end user, one of:
673
734
  *
674
- * If the object type 'ot' key is sent along with this key, then the 'bsd' key refers to the buffer associated with the particular object type. If no object type is communicated, then the buffer state applies to the current session.
735
+ * - `s` - starting: the player has been instructed to play media for a given session, either by a user interaction or by an autoplay action.
736
+ * - `p` - playing: Media is being rendered.
737
+ * - `k` - seeking: The start of the action of moving the playhead position after starting.
738
+ * - `r` - rebuffering: Media has stopped being rendered due to an insufficient buffer. This state is not reported during startup or seeking.
739
+ * - `a` - paused: Playback has been intentionally paused by either the user or the player.
740
+ * - `e` - ended: Rendering has ended due to completion of the media asset playback.
741
+ * - `f` - fatal error: Rendering has ended due to an irrecoverable error.
742
+ * - `q` - quit: User initiated end of playback before media asset completion.
743
+ * - `d` - preloading: the player is loading, or has loaded, assets ahead of starting in order to provide a fast startup. The expectation is that playback will commence at a future time.
675
744
  *
676
- * Integer milliseconds
745
+ * Token - one of [s,p,k,r,a,e,f,q,d]
677
746
  */
678
- bsd?: number;
747
+ sta?: CmcdPlayerState;
679
748
  /**
680
- * Dropped Frames
749
+ * Startup
681
750
  *
682
- * An absolute count of dropped frames since session initiation. This key should only be sent for content types of 'v','av' or 'o'.
683
- * Note that this value will be driven by the content being rendered rather than the content being retrieved, therefore it is beneficial if accompanied by the playhead time 'pt' key to allow for correct interpretation.
751
+ * Key is included without a value if the object is needed urgently due to startup, seeking or recovery after a buffer-empty event. The player
752
+ * reports this key as true until its buffer first reaches the target buffer for stable playback.
684
753
  *
685
- * Integer
754
+ * Boolean
686
755
  */
687
- df?: number;
756
+ su?: boolean;
688
757
  /**
689
- * Content Signature
758
+ * Top aggregated encoded bitrate
759
+ *
760
+ * The highest aggregated bitrate rendition in the manifest or playlist. This SHOULD be derived from playlist/manifest declarations,
761
+ * or it MAY be estimated by the player. If the playlist declares both peak and average bitrate values, the peak value MUST be
762
+ * transmitted. The aggregate encoded bitrate is of the complete media object including all object types. This value MUST NOT be
763
+ * sent if the top encoded bitrate is known.
764
+ *
765
+ * Inner list of integer kbps with token identifiers
766
+ */
767
+ tab?: CmcdObjectTypeList;
768
+ /**
769
+ * Top encoded bitrate
770
+ *
771
+ * The highest bitrate rendition in the manifest or playlist. This SHOULD be derived from playlist/manifest declarations,
772
+ * or it MAY be estimated by the player. If the playlist declares both peak and average bitrate values, the peak value
773
+ * MUST be transmitted. This top bitrate MUST apply to the object type being requested. Requests for video objects MUST
774
+ * specify the top video bitrate and requests for audio objects MUST specify the top audio bitrate.
775
+ *
776
+ * Inner list of integer kbps with token identifiers
777
+ */
778
+ tb?: CmcdObjectTypeList;
779
+ /**
780
+ * Target Buffer length
781
+ *
782
+ * The target buffer length associated with the media object being requested at the time of the request. This value SHOULD be rounded
783
+ * to the nearest 100 ms.
784
+ *
785
+ * Inner list of integer milliseconds with token identifiers
786
+ */
787
+ tbl?: CmcdObjectTypeList;
788
+ /**
789
+ * Top playable bitrate
790
+ *
791
+ * The highest bitrate rendition that the player is currently capable of playing for reasons other than bandwidth limitations. This
792
+ * key captures the cases in which, for example, screen resolution, DRM, or performance constraints limit the player's topmost choice
793
+ * of bitrate. These constraints are intentionally obfuscated for privacy reasons.
794
+ *
795
+ * This key can increase the fingerprinting surface exposed by CMCD transmission and SHOULD NOT be transmitted in a default player
796
+ * configuration.
797
+ *
798
+ * If the playlist declares both peak and average bitrate values, the peak value MUST be transmitted. This top playable bitrate MUST
799
+ * apply to the object type being requested. Requests for video objects MUST specify the top playable video bitrate and requests for
800
+ * audio objects MUST specify the top playable audio bitrate. This value MUST NOT be sent for objects which do not have an object type
801
+ * of 'a', 'v', 'av' or 'c'.
802
+ *
803
+ * Inner list of integer kbps with token identifiers
804
+ */
805
+ tpb?: CmcdObjectTypeList;
806
+ /**
807
+ * Version
690
808
  *
691
- * A string representing a signature of the content being played. This field SHOULD vary with content ID and be bound by some mechanism to the content.
692
- * For example, this field may be used to transmit the C2PA signature associated with the content being viewed.
809
+ * The version of this specification used for interpreting the defined key names and values. If this key is omitted, the player and server
810
+ * MUST interpret the values as being defined by version 1. Player SHOULD omit this field if the version is 1 and MUST include this field
811
+ * if the version is not 1.
693
812
  *
694
- * Integer bytes
813
+ * Integer
695
814
  */
696
- cs?: number;
815
+ v?: number;
697
816
  };
698
817
  //#endregion
699
818
  //#region src/CmcdEvent.d.ts
700
819
  /**
701
- * CMCD v2 - Event Mode.
702
- *
703
- * Represents the event and keys for CMCD v2.
704
- *
705
- * This type is used to structure the data for reporting events according to the
706
- * Common Media Client Data (CMCD) version 2 specification. It encapsulates
707
- * the reporting event token.
820
+ * Common Media Client Data (CMCD) version 2 - Event Mode.
708
821
  *
822
+ * Extends {@link CmcdRequest} with event-specific keys for reporting events
823
+ * according to the CMCD version 2 specification.
709
824
  *
710
- * @beta
825
+ * @public
711
826
  */
712
- type CmcdEvent = Omit<CmcdRequest, CmcdEventExcludedKeys> & {
827
+ type CmcdEvent = CmcdRequest & {
713
828
  /**
714
- * Event (event mode; e.g. "e", "t", "ps")
715
- *
716
- * This key MUST only be used in Event mode.
717
- *
718
- * ps - play state change. This token MUST be accompanied by a 'sta' key carrying the new state.
719
- *
720
- * e - the player has experienced an error. This token MUST be accompanied by a 'ec' key defining the player error code.
721
- *
722
- * t - time interval. The interval at which these reports are made is application-defined. A default interval of 30 seconds SHOULD
723
- * be used if no explicit application interval is provided. Short form content may wish to use a shorter interval.
724
- * An application-defined interval of zero should be interpreted as turning off interval event reporting.
725
- * This event MUST be supported by all players that support Event mode.
829
+ * Custom Event Name
726
830
  *
727
- * c - content ID has changed. This token MUST be accompanied by a 'cid' key defining the new content ID.
831
+ * Used to define a custom event name. A maximum length of 64 characters is allowed. This key MUST be sent when the event type is
832
+ * 'ce' (custom event) and MUST NOT be sent when the event type is any other value. A custom key-value pair MAY be used to transfer
833
+ * a custom value associated with this event. The names chosen SHOULD associate the custom event name with the custom key name.
728
834
  *
729
- * b - the player has entered backgrounded mode if this event is accompanied by the ‘bg’ key and exited backgrounded mode if not.
835
+ * String
836
+ */
837
+ cen?: string;
838
+ /**
839
+ * Event
840
+ *
841
+ * This key MUST only be used in Event mode and MUST be present on all reports. The minimum recommended set of supported events
842
+ * are: `ps`, `e`, `t`, and `rr`.
843
+ *
844
+ * - `abs` - ad break start
845
+ * - `abe` - ad break end
846
+ * - `ae` - ad end
847
+ * - `as` - ad start
848
+ * - `b` - backgrounded mode
849
+ * - `bc` - bitrate change
850
+ * - `c` - content ID changed
851
+ * - `ce` - custom event
852
+ * - `e` - error
853
+ * - `h` - hostname changed
854
+ * - `m` - mute
855
+ * - `pc` - player collapse
856
+ * - `pe` - player expand
857
+ * - `pr` - playback rate change
858
+ * - `ps` - play state change
859
+ * - `rr` - response received
860
+ * - `sk` - skip
861
+ * - `t` - time interval
862
+ * - `um` - unmute
863
+ *
864
+ * Token
865
+ */
866
+ e?: CmcdEventType;
867
+ /**
868
+ * Hostname
730
869
  *
731
- * m - mute. The user activated the mute control or set the volume to zero.
870
+ * A string identifying the current hostname from which the player is retrieving content. Maximum length is 128 characters.
732
871
  *
733
- * um - unmute. The user deactivated the mute control or raised the volume above zero if it was previously set to zero.
872
+ * String
873
+ */
874
+ h?: string;
875
+ /**
876
+ * Timestamp
734
877
  *
735
- * pe - playerExpand. The user activated a control to extend the player to a larger size. The definition of this event is intended to be
736
- * compliant with the VAST [VAST] Player Operation Metrics.
878
+ * The timestamp at which the associated event occurred, expressed as the number of milliseconds that have elapsed since the Unix
879
+ * Epoch (January 1, 1970, at 00:00:00 UTC), excluding leap seconds. When the event is a request for a media object the time SHOULD
880
+ * reference when the request was first initiated.
737
881
  *
738
- * c - playerCollapse: the user activated a control to reduce the player to a smaller size. The definition of this event is intended to be
739
- * compliant with the VAST [VAST] Player Operation Metrics.
882
+ * This key MUST be included with all Event reports.
740
883
  *
741
- * Token - one of [ps,e,t,c,b,m,u m, abs, abe, as, ae]
884
+ * Integer milliseconds
742
885
  */
743
- e?: CmcdEventType;
886
+ ts?: number;
744
887
  };
745
888
  //#endregion
746
889
  //#region src/CmcdResponse.d.ts
747
890
  /**
748
- * CMCD Response Mode.
749
- *
750
- * Defines the keys for the CMCD (Common Media Client Data) v2 Response group.
891
+ * Common Media Client Data (CMCD) version 2 - Response Mode.
751
892
  *
893
+ * Extends {@link CmcdRequest} with response-specific keys for reporting
894
+ * response data according to the CMCD version 2 specification.
752
895
  *
753
- * @beta
896
+ * @public
754
897
  */
755
898
  type CmcdResponse = CmcdRequest & {
756
899
  /**
757
- * Response code for object request (response mode)
900
+ * CMSD Dynamic Header
901
+ *
902
+ * Holds a Base64 encoded copy of the CMSD data received on the CMSD-Dynamic response header. This key MUST only be reported on
903
+ * events of type `rr` (response received).
904
+ *
905
+ * String
906
+ */
907
+ cmsdd?: string;
908
+ /**
909
+ * CMSD Static Header
910
+ *
911
+ * Holds a Base64 encoded copy of the CMSD data received on the CMSD-Static response header. This key MUST only be reported on
912
+ * events of type `rr` (response received).
913
+ *
914
+ * String
915
+ */
916
+ cmsds?: string;
917
+ /**
918
+ * Response code
758
919
  *
759
920
  * The response code received when requesting a media object. In a redirect scenario, this would be the final response code received.
760
921
  * A value of 0 SHOULD be used to indicate that a response was not received.
761
922
  *
923
+ * This key MUST only be reported on events of type `rr` (response received).
924
+ *
762
925
  * Integer
763
926
  */
764
927
  rc?: number;
765
928
  /**
766
- * Time to first byte (ms; response mode)
929
+ * SMRT-Data Header
930
+ *
931
+ * Holds a Base64 encoded copy of the streaming media response tracing data received on the Request Tracing header. This key MUST
932
+ * only be reported on events of type `rr` (response received).
933
+ *
934
+ * String
935
+ */
936
+ smrt?: string;
937
+ /**
938
+ * Time to first byte
767
939
  *
768
- * The elapsed time between when the request was first initiated (captured in ts) and the time when the first byte of the response was received.
769
- * This value should only be reported if it is known. Absence of this key does not indicate that the response was not received.
940
+ * The elapsed time between when the request was first initiated (captured in ts) and the time when the first byte of the response
941
+ * was received. This key MUST only be reported on events of type `rr` (response received).
770
942
  *
771
943
  * Integer milliseconds
772
944
  */
773
945
  ttfb?: number;
774
946
  /**
775
- * Time to first body byte (ms; response mode)
947
+ * Time to first body byte
948
+ *
949
+ * The elapsed time between when the request was first initiated (captured in ts) and the time the first bytes of the response body
950
+ * are received. This key MUST only be reported on events of type `rr` (response received).
951
+ *
952
+ * Integer milliseconds
953
+ */
954
+ ttfbb?: number;
955
+ /**
956
+ * Time to last byte
957
+ *
958
+ * The elapsed time between when the request was first initiated (captured in ts) and the time the response body is fully received.
959
+ * This key MUST only be reported on events of type `rr` (response received).
960
+ *
961
+ * Integer milliseconds
962
+ */
963
+ ttlb?: number;
964
+ /**
965
+ * Request URL
966
+ *
967
+ * The URL used to request the media object. If the request is redirected, this key MUST report the initial requested URL. This key
968
+ * MUST be reported on events of type `rr` (response received).
969
+ *
970
+ * String
971
+ */
972
+ url?: string;
973
+ };
974
+ //#endregion
975
+ //#region src/Cmcd.d.ts
976
+ /**
977
+ * Common Media Client Data (CMCD) version 2.
978
+ *
979
+ * A standardized set of HTTP request header fields, query string parameters,
980
+ * and event reporting fields for communicating media playback metrics.
981
+ *
982
+ * This type is the intersection of {@link CmcdRequest}, {@link CmcdResponse},
983
+ * and {@link CmcdEvent}, combining all keys from all reporting modes.
984
+ *
985
+ * @see {@link https://cdn.cta.tech/cta/media/media/resources/standards/pdfs/cta-5004-final.pdf|CMCD v1 Spec}
986
+ *
987
+ * @public
988
+ */
989
+ type Cmcd = CmcdRequest & CmcdResponse & CmcdEvent;
990
+ //#endregion
991
+ //#region src/CmcdReportingMode.d.ts
992
+ /**
993
+ * CMCD event mode variable name.
994
+ *
995
+ * @public
996
+ */
997
+ declare const CMCD_EVENT_MODE: "event";
998
+ /**
999
+ * CMCD request mode variable name.
1000
+ *
1001
+ * @public
1002
+ */
1003
+ declare const CMCD_REQUEST_MODE: "request";
1004
+ /**
1005
+ * CMCD reporting mode types.
1006
+ *
1007
+ * @enum
1008
+ *
1009
+ * @public
1010
+ */
1011
+ declare const CmcdReportingMode: {
1012
+ /**
1013
+ * Request mode
1014
+ */
1015
+ readonly REQUEST: typeof CMCD_REQUEST_MODE;
1016
+ /**
1017
+ * Event mode
1018
+ */
1019
+ readonly EVENT: typeof CMCD_EVENT_MODE;
1020
+ };
1021
+ /**
1022
+ * @public
1023
+ */
1024
+ type CmcdReportingMode = ValueOf<typeof CmcdReportingMode>;
1025
+ //#endregion
1026
+ //#region src/CmcdFormatterOptions.d.ts
1027
+ /**
1028
+ * Options for formatting CMCD data values.
1029
+ *
1030
+ * @public
1031
+ */
1032
+ type CmcdFormatterOptions = {
1033
+ /**
1034
+ * The version of the CMCD specification to use.
1035
+ */
1036
+ version: number;
1037
+ /**
1038
+ * The reporting mode to use.
1039
+ */
1040
+ reportingMode: CmcdReportingMode;
1041
+ /**
1042
+ * The base URL to use for relative URLs.
1043
+ */
1044
+ baseUrl?: string;
1045
+ };
1046
+ //#endregion
1047
+ //#region src/CmcdValue.d.ts
1048
+ /**
1049
+ * CMCD Value
1050
+ *
1051
+ * @public
1052
+ */
1053
+ type CmcdValue = ValueOf<Cmcd>;
1054
+ //#endregion
1055
+ //#region src/CmcdFormatter.d.ts
1056
+ /**
1057
+ * A formatter for CMCD values.
1058
+ *
1059
+ * @param value - The value to format.
1060
+ *
1061
+ * @returns The formatted value.
1062
+ *
1063
+ * @public
1064
+ */
1065
+ type CmcdFormatter = (value: CmcdValue, options: CmcdFormatterOptions) => ValueOrArray<number | SfItem<number>> | ValueOrArray<string | SfItem<string>>;
1066
+ //#endregion
1067
+ //#region src/CmcdV1.d.ts
1068
+ /**
1069
+ * CMCD Version 1
1070
+ *
1071
+ * @public
1072
+ */
1073
+ type CmcdV1 = {
1074
+ /**
1075
+ * Buffer length
776
1076
  *
777
- * The elapsed time between when the request was first initiated (captured in ts) and the time the first bytes of the response body are received.
778
- * This value should only be reported if it is known. Absence of this key does not indicate that the body was not received.
1077
+ * The buffer length associated with the media object being requested. This value MUST be rounded to the nearest 100 ms. This key SHOULD only be
1078
+ * sent with an object type of ‘a’, ‘v’ or ‘av’.
779
1079
  *
780
1080
  * Integer milliseconds
781
1081
  */
782
- ttfbb?: number;
1082
+ bl?: number;
783
1083
  /**
784
- * Time to last byte (ms; response mode)
785
- *
786
- * The elapsed time between when the request was first initiated (captured in ts) and the time the response body is fully received.
787
- * This value should only be reported if it is known.
788
- * Absence of this key does not indicate that the response was not fully received
1084
+ * Bitrate
789
1085
  *
790
- * Integer milliseconds
1086
+ * Integer
791
1087
  */
792
- ttlb?: number;
1088
+ br?: number;
793
1089
  /**
794
- * Requested URL (string; response mode)
1090
+ * Measured mtp CMCD throughput
795
1091
  *
796
- * The URL used to request the media object.
797
- * This key MUST NOT be used with reporting mode #1.
798
- * If the request is redirected, this key MUST report the initial requested URL.
1092
+ * The throughput between client and server, as measured by the client and MUST be rounded to the nearest 100 kbps. This value, however derived,
1093
+ * SHOULD be the value that the client is using to make its next Adaptive Bitrate switching decision. If the client is connected to multiple
1094
+ * servers concurrently, it must take care to report only the throughput measured against the receiving server. If the client has multiple concurrent
1095
+ * connections to the server, then the intent is that this value communicates the aggregate throughput the client sees across all those connections.
799
1096
  *
800
- * String
1097
+ * Integer kbps
801
1098
  */
802
- url?: string;
1099
+ mtp?: number;
803
1100
  /**
804
- * CMSD Dynamic Header (response mode)
1101
+ * Next object request
805
1102
  *
806
- * Holds a Base64 [base64] encoded copy of the CMSD data received on the CMSD-Dynamic response header.
807
- * This key MUST only be used in RESPONSE mode.
1103
+ * Relative path of the next object to be requested. This can be used to trigger pre-fetching by the CDN. This MUST be a path relative to the current
1104
+ * request. This string MUST be URLEncoded. The client SHOULD NOT depend upon any pre-fetch action being taken - it is merely a request for such a
1105
+ * pre-fetch to take place.
808
1106
  *
809
1107
  * String
810
1108
  */
811
- cmsdd?: string;
1109
+ nor?: string;
812
1110
  /**
813
- * CMSD Static Header (response mode)
1111
+ * Next range request
814
1112
  *
815
- * Holds a Base64 [base64] encoded copy of the CMSD data received on the CMSD-Static response header.
816
- * This key MUST only be used in RESPONSE mode.
1113
+ * @deprecated Use 'nor' with the 'r' parameter instead.
817
1114
  *
818
1115
  * String
819
1116
  */
820
- cmsds?: string;
1117
+ nrr?: string;
821
1118
  /**
822
- * SMRT Header
823
-
824
- * Holds a Base64 [base64] encoded copy of the streaming media response tracing data received on the SMRT-Data header.
825
- * This key MUST only be used in RESPONSE mode.
1119
+ * Top bitrate
1120
+ *
1121
+ * The highest bitrate rendition in the manifest or playlist that the client is allowed to play, given current codec, licensing and
1122
+ * sizing constraints.
1123
+ *
1124
+ * Integer Kbps
826
1125
  */
827
- smrt?: number;
1126
+ tb?: number;
828
1127
  };
829
1128
  //#endregion
830
- //#region src/CmcdData.d.ts
831
- /**
832
- * All CMCD data types combined.
833
- *
834
- *
835
- * @beta
836
- */
837
- type CmcdData = Cmcd & CmcdRequest & CmcdEvent & CmcdResponse;
838
- //#endregion
839
1129
  //#region src/CmcdKey.d.ts
840
1130
  /**
841
- * A CMCD key.
1131
+ * A CMCD key including V1-only keys.
842
1132
  *
843
- *
844
- * @beta
1133
+ * @public
845
1134
  */
846
- type CmcdKey = keyof CmcdData;
1135
+ type CmcdKey = keyof Cmcd | keyof CmcdV1;
847
1136
  //#endregion
848
1137
  //#region src/CmcdFormatterMap.d.ts
849
1138
  /**
850
1139
  * A map of CMCD keys to format functions.
851
1140
  *
852
- *
853
- * @beta
1141
+ * @public
854
1142
  */
855
1143
  type CmcdFormatterMap = Record<CmcdKey, CmcdFormatter>;
856
1144
  //#endregion
857
- //#region src/CMCD_OBJECT.d.ts
1145
+ //#region src/CmcdHeaderField.d.ts
858
1146
  /**
859
1147
  * CMCD object header name.
860
1148
  *
861
- *
862
- * @beta
1149
+ * @public
863
1150
  */
864
- declare const CMCD_OBJECT = "CMCD-Object";
865
- //#endregion
866
- //#region src/CMCD_REQUEST.d.ts
1151
+ declare const CMCD_OBJECT: "CMCD-Object";
867
1152
  /**
868
1153
  * CMCD request header name.
869
1154
  *
870
- *
871
- * @beta
1155
+ * @public
872
1156
  */
873
- declare const CMCD_REQUEST = "CMCD-Request";
874
- //#endregion
875
- //#region src/CMCD_SESSION.d.ts
1157
+ declare const CMCD_REQUEST: "CMCD-Request";
876
1158
  /**
877
1159
  * CMCD session header name.
878
1160
  *
879
- *
880
- * @beta
1161
+ * @public
881
1162
  */
882
- declare const CMCD_SESSION = "CMCD-Session";
883
- //#endregion
884
- //#region src/CMCD_STATUS.d.ts
1163
+ declare const CMCD_SESSION: "CMCD-Session";
885
1164
  /**
886
1165
  * CMCD status header name.
887
1166
  *
888
- *
889
- * @beta
1167
+ * @public
890
1168
  */
891
- declare const CMCD_STATUS = "CMCD-Status";
892
- //#endregion
893
- //#region src/CmcdHeaderField.d.ts
1169
+ declare const CMCD_STATUS: "CMCD-Status";
894
1170
  /**
895
1171
  * CMCD header fields.
896
1172
  *
897
1173
  *
898
1174
  * @enum
899
1175
  *
900
- * @beta
1176
+ * @public
901
1177
  */
902
1178
  declare const CmcdHeaderField: {
903
1179
  /**
@@ -918,7 +1194,7 @@ declare const CmcdHeaderField: {
918
1194
  readonly STATUS: typeof CMCD_STATUS;
919
1195
  };
920
1196
  /**
921
- * @beta
1197
+ * @public
922
1198
  */
923
1199
  type CmcdHeaderField = ValueOf<typeof CmcdHeaderField>;
924
1200
  //#endregion
@@ -926,8 +1202,7 @@ type CmcdHeaderField = ValueOf<typeof CmcdHeaderField>;
926
1202
  /**
927
1203
  * A map of CMCD header fields to CMCD keys.
928
1204
  *
929
- *
930
- * @beta
1205
+ * @public
931
1206
  */
932
1207
  type CmcdHeaderMap = Record<CmcdHeaderField, CmcdKey[]>;
933
1208
  //#endregion
@@ -935,8 +1210,7 @@ type CmcdHeaderMap = Record<CmcdHeaderField, CmcdKey[]>;
935
1210
  /**
936
1211
  * Options for encoding CMCD values.
937
1212
  *
938
- *
939
- * @beta
1213
+ * @public
940
1214
  */
941
1215
  type CmcdEncodeOptions = {
942
1216
  /**
@@ -987,8 +1261,7 @@ type CmcdEncodeOptions = {
987
1261
  *
988
1262
  * @returns The headers with the CMCD header shards appended.
989
1263
  *
990
- *
991
- * @beta
1264
+ * @public
992
1265
  *
993
1266
  * @example
994
1267
  * {@includeCode ../test/appendCmcdHeaders.test.ts#example}
@@ -1005,29 +1278,18 @@ declare function appendCmcdHeaders(headers: Record<string, string>, cmcd: Cmcd,
1005
1278
  *
1006
1279
  * @returns The URL with the CMCD query args appended.
1007
1280
  *
1008
- *
1009
- * @beta
1281
+ * @public
1010
1282
  *
1011
1283
  * @example
1012
1284
  * {@includeCode ../test/appendCmcdQuery.test.ts#example}
1013
1285
  */
1014
1286
  declare function appendCmcdQuery(url: string, cmcd: Cmcd, options?: CmcdEncodeOptions): string;
1015
1287
  //#endregion
1016
- //#region src/CMCD_COMMON_KEYS.d.ts
1017
- /**
1018
- * Defines the common keys for CMCD (Common Media Client Data) version 2.
1019
- *
1020
- *
1021
- * @beta
1022
- */
1023
- declare const CMCD_COMMON_KEYS: readonly ["ab", "bg", "bl", "br", "bs", "bsd", "cdn", "cid", "cs", "df", "ec", "lab", "lb", "ltc", "msd", "mtp", "pb", "pr", "pt", "sf", "sid", "sn", "st", "sta", "tab", "tb", "tbl", "tpb", "ts", "v"];
1024
- //#endregion
1025
1288
  //#region src/CMCD_DEFAULT_TIME_INTERVAL.d.ts
1026
1289
  /**
1027
- * The default time interval in secondswhen using using event mode
1028
- *
1290
+ * The default time interval in seconds when using using event mode
1029
1291
  *
1030
- * @beta
1292
+ * @public
1031
1293
  */
1032
1294
  declare const CMCD_DEFAULT_TIME_INTERVAL = 30;
1033
1295
  //#endregion
@@ -1035,129 +1297,206 @@ declare const CMCD_DEFAULT_TIME_INTERVAL = 30;
1035
1297
  /**
1036
1298
  * Defines the event-specific keys for CMCD (Common Media Client Data) version 2.
1037
1299
  *
1038
- *
1039
- * @beta
1300
+ * @public
1040
1301
  */
1041
- declare const CMCD_EVENT_KEYS: readonly ["e"];
1302
+ declare const CMCD_EVENT_KEYS: readonly ["cen", "e", "h", "ts"];
1042
1303
  //#endregion
1043
1304
  //#region src/CMCD_FORMATTER_MAP.d.ts
1044
1305
  /**
1045
1306
  * The default formatters for CMCD values.
1046
1307
  *
1047
- *
1048
- * @beta
1308
+ * @public
1049
1309
  */
1050
1310
  declare const CMCD_FORMATTER_MAP: Record<string, CmcdFormatter>;
1051
1311
  //#endregion
1052
- //#region src/CMCD_HEADERS.d.ts
1312
+ //#region src/CMCD_KEYS.d.ts
1053
1313
  /**
1054
- * CMCD `headers` transmission mode.
1055
- *
1314
+ * A list of all CMCD keys.
1056
1315
  *
1057
- * @beta
1316
+ * @public
1058
1317
  */
1059
- declare const CMCD_HEADERS = "headers";
1318
+ declare const CMCD_KEYS: CmcdKey[];
1060
1319
  //#endregion
1061
- //#region src/CMCD_JSON.d.ts
1320
+ //#region src/CMCD_PARAM.d.ts
1062
1321
  /**
1063
- * CMCD `json` transmission mode.
1064
- *
1065
- *
1066
- * @beta
1322
+ * CMCD parameter name.
1067
1323
  *
1068
- * @deprecated JSON transmission mode is deprecated and will be removed in future versions.
1324
+ * @public
1069
1325
  */
1070
- declare const CMCD_JSON = "json";
1326
+ declare const CMCD_PARAM = "CMCD";
1071
1327
  //#endregion
1072
- //#region src/CMCD_KEYS.d.ts
1328
+ //#region src/CMCD_REQUEST_KEYS.d.ts
1073
1329
  /**
1074
- * A list of all CMCD keys.
1075
- *
1330
+ * Defines the request-specific keys for CMCD (Common Media Client Data) version 2.
1076
1331
  *
1077
- * @beta
1332
+ * @public
1078
1333
  */
1079
- declare const CMCD_KEYS: CmcdKey[];
1334
+ declare const CMCD_REQUEST_KEYS: readonly ["ab", "bg", "bl", "br", "bs", "bsa", "bsd", "bsda", "cdn", "cid", "cs", "d", "dfa", "dl", "ec", "lab", "lb", "ltc", "msd", "mtp", "nor", "nr", "ot", "pb", "pr", "pt", "rtp", "sf", "sid", "sn", "st", "sta", "su", "tab", "tb", "tbl", "tpb", "v"];
1080
1335
  //#endregion
1081
- //#region src/CMCD_PARAM.d.ts
1336
+ //#region src/CMCD_RESPONSE_KEYS.d.ts
1082
1337
  /**
1083
- * CMCD parameter name.
1084
- *
1338
+ * CMCD v2 - Response-only and timing keys.
1085
1339
  *
1086
- * @beta
1340
+ * @public
1087
1341
  */
1088
- declare const CMCD_PARAM = "CMCD";
1342
+ declare const CMCD_RESPONSE_KEYS: readonly ["cmsdd", "cmsds", "rc", "smrt", "ttfb", "ttfbb", "ttlb", "url"];
1089
1343
  //#endregion
1090
- //#region src/CMCD_QUERY.d.ts
1344
+ //#region src/CMCD_V1.d.ts
1091
1345
  /**
1092
- * CMCD `query` transmission mode.
1346
+ * CMCD Version 1
1093
1347
  *
1348
+ * @public
1349
+ */
1350
+ declare const CMCD_V1: 1;
1351
+ //#endregion
1352
+ //#region src/CMCD_V1_KEYS.d.ts
1353
+ /**
1354
+ * Defines the keys for CMCD (Common Media Client Data) version 1.
1094
1355
  *
1095
- * @beta
1356
+ * @public
1096
1357
  */
1097
- declare const CMCD_QUERY = "query";
1358
+ declare const CMCD_V1_KEYS: readonly ["bl", "br", "bs", "cid", "d", "dl", "mtp", "nor", "nrr", "ot", "pr", "rtp", "sf", "sid", "st", "su", "tb", "v"];
1098
1359
  //#endregion
1099
- //#region src/CMCD_REQUEST_KEYS.d.ts
1360
+ //#region src/CMCD_V2.d.ts
1100
1361
  /**
1101
- * Defines the request-specific keys for CMCD (Common Media Client Data) version 2.
1362
+ * CMCD Version 2
1102
1363
  *
1364
+ * @public
1365
+ */
1366
+ declare const CMCD_V2: 2;
1367
+ //#endregion
1368
+ //#region src/CmcdVersion.d.ts
1369
+ /**
1370
+ * The version of the CMCD specification.
1103
1371
  *
1104
- * @beta
1372
+ * @public
1105
1373
  */
1106
- declare const CMCD_REQUEST_KEYS: readonly ["d", "dl", "nor", "ot", "rtp", "su"];
1374
+ type CmcdVersion = typeof CMCD_V1 | typeof CMCD_V2;
1107
1375
  //#endregion
1108
- //#region src/CMCD_RESPONSE_KEYS.d.ts
1376
+ //#region src/CmcdReportConfig.d.ts
1109
1377
  /**
1110
- * CMCD v2 - Response-only and timing keys.
1378
+ * Configuration for a CMCD report.
1111
1379
  *
1380
+ * @public
1381
+ */
1382
+ type CmcdReportConfig = {
1383
+ /**
1384
+ * The version of the CMCD specification to use.
1385
+ *
1386
+ * @defaultValue `CMCD_V2`
1387
+ */
1388
+ version?: CmcdVersion;
1389
+ /**
1390
+ * The list of CMCD keys to include in the report. If not provided,
1391
+ * no keys will be reported, unless there are other configuration
1392
+ * options that require keys to be reported, specifically in event mode.
1393
+ *
1394
+ * @defaultValue `undefined`
1395
+ */
1396
+ enabledKeys?: CmcdKey[];
1397
+ };
1398
+ //#endregion
1399
+ //#region src/CmcdEventReportConfig.d.ts
1400
+ /**
1401
+ * Configuration for a CMCD event report.
1112
1402
  *
1113
- * @beta
1403
+ * @public
1114
1404
  */
1115
- declare const CMCD_RESPONSE_KEYS: readonly ["cmsdd", "cmsds", "rc", "smrt", "ttfb", "ttfbb", "ttlb", "url"];
1405
+ type CmcdEventReportConfig = CmcdReportConfig & {
1406
+ /**
1407
+ * The version of the CMCD protocol to use. Must be
1408
+ * version 2 or higher for event reporting.
1409
+ *
1410
+ * @defaultValue `CMCD_V2`
1411
+ */
1412
+ version?: typeof CMCD_V2;
1413
+ /**
1414
+ * The URL to which the CMCD event should be sent.
1415
+ */
1416
+ url: string;
1417
+ /**
1418
+ * The events to report. If no events are provided,
1419
+ * the event target will be effectively disabled.
1420
+ *
1421
+ * @defaultValue `undefined`
1422
+ */
1423
+ events?: CmcdEventType[];
1424
+ /**
1425
+ * When the time interval event is sent, the interval at which the
1426
+ * events should be reported as a number of seconds.
1427
+ *
1428
+ * @defaultValue `CMCD_DEFAULT_TIME_INTERVAL`
1429
+ *
1430
+ * @see {@link CMCD_DEFAULT_TIME_INTERVAL}
1431
+ */
1432
+ interval?: number;
1433
+ /**
1434
+ * The number of events to batch before sending the report.
1435
+ *
1436
+ * @defaultValue `1`
1437
+ */
1438
+ batchSize?: number;
1439
+ };
1116
1440
  //#endregion
1117
- //#region src/CMCD_RESPONSE_MODE.d.ts
1441
+ //#region src/CmcdRequestKey.d.ts
1118
1442
  /**
1119
- * CMCD response mode variable name.
1443
+ * A CMCD request key.
1120
1444
  *
1445
+ * @public
1446
+ */
1447
+ type CmcdRequestKey = keyof CmcdRequest | "nrr";
1448
+ //#endregion
1449
+ //#region src/CMCD_HEADER_MAP.d.ts
1450
+ /**
1451
+ * The map of CMCD keys to their appropriate header shard.
1121
1452
  *
1122
- * @beta
1453
+ * @internal
1123
1454
  */
1124
- declare const CMCD_RESPONSE_MODE = "response";
1455
+ declare const CMCD_HEADER_MAP: Record<CmcdRequestKey | "nrr", CmcdHeaderField>;
1125
1456
  //#endregion
1126
- //#region src/CMCD_V1.d.ts
1457
+ //#region src/CmcdHeaderKey.d.ts
1127
1458
  /**
1128
- * CMCD Version 1
1459
+ * A CMCD header key.
1129
1460
  *
1461
+ * @public
1462
+ */
1463
+ type CmcdHeaderKey = keyof typeof CMCD_HEADER_MAP;
1464
+ //#endregion
1465
+ //#region src/CmcdHeaderValue.d.ts
1466
+ /**
1467
+ * CMCD header value
1130
1468
  *
1131
- * @beta
1469
+ * @public
1132
1470
  */
1133
- declare const CMCD_V1 = 1;
1471
+ type CmcdHeaderValue = CmcdRequest | CmcdV1;
1134
1472
  //#endregion
1135
- //#region src/CMCD_V1_KEYS.d.ts
1473
+ //#region src/CmcdTransmissionMode.d.ts
1136
1474
  /**
1137
- * Defines the keys for CMCD (Common Media Client Data) version 1.
1475
+ * CMCD `query` transmission mode.
1138
1476
  *
1477
+ * @public
1478
+ */
1479
+ declare const CMCD_QUERY: "query";
1480
+ /**
1481
+ * CMCD `headers` transmission mode.
1139
1482
  *
1140
- * @beta
1483
+ * @public
1141
1484
  */
1142
- declare const CMCD_V1_KEYS: readonly ["bl", "br", "bs", "cid", "d", "dl", "mtp", "nor", "nrr", "ot", "pr", "rtp", "sf", "sid", "st", "su", "tb", "v"];
1143
- //#endregion
1144
- //#region src/CMCD_V2.d.ts
1485
+ declare const CMCD_HEADERS: "headers";
1145
1486
  /**
1146
- * CMCD Version 2
1487
+ * CMCD `json` transmission mode.
1147
1488
  *
1489
+ * @public
1148
1490
  *
1149
- * @beta
1491
+ * @deprecated JSON transmission mode is deprecated and will be removed in future versions.
1150
1492
  */
1151
- declare const CMCD_V2 = 2;
1152
- //#endregion
1153
- //#region src/CmcdTransmissionMode.d.ts
1493
+ declare const CMCD_JSON: "json";
1154
1494
  /**
1155
1495
  * CMCD transmission modes.
1156
1496
  *
1157
- *
1158
1497
  * @enum
1159
1498
  *
1160
- * @beta
1499
+ * @public
1161
1500
  */
1162
1501
  declare const CmcdTransmissionMode: {
1163
1502
  /**
@@ -1176,92 +1515,131 @@ declare const CmcdTransmissionMode: {
1176
1515
  readonly HEADERS: typeof CMCD_HEADERS;
1177
1516
  };
1178
1517
  /**
1179
- * @beta
1518
+ * @public
1180
1519
  */
1181
1520
  type CmcdTransmissionMode = ValueOf<typeof CmcdTransmissionMode>;
1182
1521
  //#endregion
1183
- //#region src/CmcdEncoding.d.ts
1184
- /**
1185
- * CMCD encoding types.
1186
- *
1187
- *
1188
- * @enum
1189
- *
1190
- * @beta
1191
- *
1192
- * @deprecated Use {@link CmcdTransmissionMode} instead.
1193
- *
1194
- * @see {@link CmcdTransmissionMode}
1195
- */
1196
- declare const CmcdEncoding: typeof CmcdTransmissionMode;
1197
- /**
1198
- * @beta
1199
- */
1200
- type CmcdEncoding = ValueOf<typeof CmcdEncoding>;
1201
- //#endregion
1202
- //#region src/CmcdFormatters.d.ts
1522
+ //#region src/CmcdRequestReportConfig.d.ts
1203
1523
  /**
1204
- * The default formatters for CMCD values.
1205
- *
1206
- *
1207
- * @beta
1524
+ * Configuration for a CMCD request report.
1208
1525
  *
1209
- * @deprecated Use `CMCD_FORMATTER_MAP` instead.
1526
+ * @public
1210
1527
  */
1211
- declare const CmcdFormatters: Record<string, CmcdFormatter>;
1528
+ type CmcdRequestReportConfig = CmcdReportConfig & {
1529
+ /**
1530
+ * The transmission mode to use.
1531
+ *
1532
+ * @defaultValue `CmcdTransmissionMode.QUERY`
1533
+ */
1534
+ transmissionMode?: CmcdTransmissionMode;
1535
+ };
1212
1536
  //#endregion
1213
- //#region src/CmcdHeadersMap.d.ts
1537
+ //#region src/CmcdReporterConfig.d.ts
1214
1538
  /**
1215
- * A map of CMCD header fields to CMCD keys.
1216
- *
1539
+ * Configuration for a CMCD reporting component.
1217
1540
  *
1218
- * @beta
1219
- *
1220
- * @deprecated Use `CmcdHeaderMap` instead.
1541
+ * @public
1221
1542
  */
1222
- type CmcdHeadersMap = Record<CmcdHeaderField, CmcdKey[]>;
1543
+ type CmcdReporterConfig = CmcdRequestReportConfig & {
1544
+ /**
1545
+ * The session ID. If not provided, a new random session ID will be generated.
1546
+ *
1547
+ * @defaultValue `undefined`
1548
+ */
1549
+ sid?: string;
1550
+ /**
1551
+ * The content ID.
1552
+ *
1553
+ * @defaultValue `undefined`
1554
+ */
1555
+ cid?: string;
1556
+ /**
1557
+ * The event configurations. If not provided, no events will be reported.
1558
+ *
1559
+ * @defaultValue `undefined`
1560
+ */
1561
+ eventTargets?: CmcdEventReportConfig[];
1562
+ };
1223
1563
  //#endregion
1224
- //#region src/CmcdReportTarget.d.ts
1564
+ //#region src/CmcdReporter.d.ts
1225
1565
  /**
1226
- * A CMCD report target configuration.
1227
- *
1566
+ * The CMCD reporter.
1228
1567
  *
1229
- * @beta
1568
+ * @public
1230
1569
  */
1231
- type CmcdReportTarget = {
1570
+ declare class CmcdReporter {
1571
+ private data;
1572
+ private config;
1573
+ private requestEncodingOptions;
1574
+ private msd;
1575
+ private eventTargets;
1576
+ private requestTarget;
1577
+ private requester;
1232
1578
  /**
1233
- * The URL to which the CMCD report should be sent.
1579
+ * Creates a new CMCD reporter.
1580
+ *
1581
+ * @param config - The configuration for the CMCD reporter.
1582
+ * @param requester - The function to use to send the request.
1583
+ * The default is a simple wrapper around the
1584
+ * native `fetch` API.
1234
1585
  */
1235
- url: string;
1586
+ constructor(config: Partial<CmcdReporterConfig>, requester?: (request: Request) => Promise<{
1587
+ status: number;
1588
+ }>);
1236
1589
  /**
1237
- * The reporting mode for the CMCD report.
1590
+ * Starts the CMCD reporter. Called by the player when the reporter is enabled.
1591
+ */
1592
+ start(): void;
1593
+ /**
1594
+ * Stops the CMCD reporter. Called by the player when the reporter is disabled.
1595
+ */
1596
+ stop(): void;
1597
+ /**
1598
+ * Forces the sending of all event reports, regardless of the batch size or interval.
1599
+ * Useful for sending outstanding reports when the player is destroyed or a playback
1600
+ * session ends.
1601
+ */
1602
+ flush(): void;
1603
+ /**
1604
+ * Updates the CMCD data. Called by the player when the data changes.
1238
1605
  *
1239
- * @defaultValue `CmcdReportingMode.REQUEST`
1606
+ * @param data - The data to update.
1240
1607
  */
1241
- reportingMode?: CmcdReportingMode;
1608
+ update(data: Partial<Cmcd>): void;
1242
1609
  /**
1243
- * The HTTP method to use for the CMCD report.
1610
+ * Records an event. Called by the player when an event occurs.
1244
1611
  *
1245
- * @defaultValue `'GET'`
1612
+ * @param type - The type of event to record.
1613
+ * @param data - Additional data to record with the event. This is
1614
+ * the same as calling `update()` with the same data.
1246
1615
  */
1247
- method?: "GET" | "POST";
1616
+ recordEvent(type: CmcdEventType, data?: Partial<Cmcd>): void;
1248
1617
  /**
1249
- * The version of the CMCD report.
1618
+ * Applies the CMCD request report data to the request. Called by the player
1619
+ * before sending the request.
1250
1620
  *
1251
- * @defaultValue `1`
1621
+ * @param req - The request to apply the CMCD request report to.
1622
+ * @returns The request with the CMCD request report applied.
1252
1623
  */
1253
- version?: number;
1624
+ applyRequestReport(req: Request): Request;
1254
1625
  /**
1255
- * The transmission mode for the CMCD report.
1626
+ * Processes the event targets. Called by the reporter when an event occurs.
1256
1627
  *
1257
- * @defaultValue `CmcdTransmissionMode.QUERY`
1628
+ * @param flush - Whether to flush the event targets.
1258
1629
  */
1259
- transmissionMode?: CmcdTransmissionMode;
1630
+ private processEventTargets;
1260
1631
  /**
1261
- * The list of CMCD keys to include in the report.
1632
+ * Sends an event report. Called by the reporter when a batch is ready to be sent.
1633
+ *
1634
+ * @param target - The target to send the event report to.
1635
+ * @param data - The data to send in the event report.
1262
1636
  */
1263
- enabledKeys?: CmcdKey[];
1264
- };
1637
+ private sendEventReport;
1638
+ /**
1639
+ * Resets the session related data. Called when the session ID changes.
1640
+ */
1641
+ private resetSession;
1642
+ }
1265
1643
  //#endregion
1266
1644
  //#region src/decodeCmcd.d.ts
1267
1645
  /**
@@ -1271,13 +1649,12 @@ type CmcdReportTarget = {
1271
1649
  *
1272
1650
  * @returns The decoded CMCD object.
1273
1651
  *
1274
- *
1275
- * @beta
1652
+ * @public
1276
1653
  *
1277
1654
  * @example
1278
1655
  * {@includeCode ../test/decodeCmcd.test.ts#example}
1279
1656
  */
1280
- declare function decodeCmcd<T extends CmcdData = CmcdData>(cmcd: string): T;
1657
+ declare function decodeCmcd<T extends Cmcd = Cmcd>(cmcd: string): T;
1281
1658
  //#endregion
1282
1659
  //#region src/encodeCmcd.d.ts
1283
1660
  /**
@@ -1288,13 +1665,12 @@ declare function decodeCmcd<T extends CmcdData = CmcdData>(cmcd: string): T;
1288
1665
  *
1289
1666
  * @returns The encoded CMCD string.
1290
1667
  *
1291
- *
1292
- * @beta
1668
+ * @public
1293
1669
  *
1294
1670
  * @example
1295
1671
  * {@includeCode ../test/encodeCmcd.test.ts#example}
1296
1672
  */
1297
- declare function encodeCmcd(cmcd: CmcdData, options?: CmcdEncodeOptions): string;
1673
+ declare function encodeCmcd(cmcd: Cmcd, options?: CmcdEncodeOptions): string;
1298
1674
  //#endregion
1299
1675
  //#region src/fromCmcdHeaders.d.ts
1300
1676
  /**
@@ -1304,13 +1680,12 @@ declare function encodeCmcd(cmcd: CmcdData, options?: CmcdEncodeOptions): string
1304
1680
  *
1305
1681
  * @returns The decoded CMCD data.
1306
1682
  *
1307
- *
1308
- * @beta
1683
+ * @public
1309
1684
  *
1310
1685
  * @example
1311
1686
  * {@includeCode ../test/fromCmcdHeaders.test.ts#example}
1312
1687
  */
1313
- declare function fromCmcdHeaders(headers: Record<string, string> | Headers): CmcdData;
1688
+ declare function fromCmcdHeaders(headers: Record<string, string> | Headers): Cmcd;
1314
1689
  //#endregion
1315
1690
  //#region src/fromCmcdQuery.d.ts
1316
1691
  /**
@@ -1320,8 +1695,7 @@ declare function fromCmcdHeaders(headers: Record<string, string> | Headers): Cmc
1320
1695
  *
1321
1696
  * @returns The decoded CMCD data.
1322
1697
  *
1323
- *
1324
- * @beta
1698
+ * @public
1325
1699
  *
1326
1700
  * @example
1327
1701
  * {@includeCode ../test/fromCmcdQuery.test.ts#example}
@@ -1336,8 +1710,7 @@ declare function fromCmcdQuery(query: string | URLSearchParams): Cmcd;
1336
1710
  *
1337
1711
  * @returns The decoded CMCD data.
1338
1712
  *
1339
- *
1340
- * @beta
1713
+ * @public
1341
1714
  *
1342
1715
  * @example
1343
1716
  * {@includeCode ../test/fromCmcdUrl.test.ts#example}
@@ -1353,10 +1726,9 @@ declare function fromCmcdUrl(url: string): Cmcd;
1353
1726
  *
1354
1727
  * @returns The CMCD header shards.
1355
1728
  *
1356
- *
1357
- * @beta
1729
+ * @public
1358
1730
  */
1359
- declare function groupCmcdHeaders(cmcd: CmcdData, customHeaderMap?: Partial<CmcdHeaderMap>): Record<CmcdHeaderField, CmcdData>;
1731
+ declare function groupCmcdHeaders(cmcd: Cmcd, customHeaderMap?: Partial<CmcdHeaderMap>): Record<CmcdHeaderField, CmcdHeaderValue>;
1360
1732
  //#endregion
1361
1733
  //#region src/isCmcdCustomKey.d.ts
1362
1734
  /**
@@ -1366,8 +1738,7 @@ declare function groupCmcdHeaders(cmcd: CmcdData, customHeaderMap?: Partial<Cmcd
1366
1738
  *
1367
1739
  * @returns `true` if the key is a custom key, `false` otherwise.
1368
1740
  *
1369
- *
1370
- * @beta
1741
+ * @public
1371
1742
  */
1372
1743
  declare function isCmcdCustomKey(key: CmcdKey): boolean;
1373
1744
  //#endregion
@@ -1379,13 +1750,12 @@ declare function isCmcdCustomKey(key: CmcdKey): boolean;
1379
1750
  *
1380
1751
  * @returns `true` if the key is a valid CMCD event key, `false` otherwise.
1381
1752
  *
1382
- *
1383
- * @beta
1753
+ * @public
1384
1754
  *
1385
1755
  * @example
1386
1756
  * {@includeCode ../test/isCmcdEventKey.test.ts#example}
1387
1757
  */
1388
- declare function isCmcdEventKey(key: string): key is keyof CmcdEvent;
1758
+ declare function isCmcdEventKey(key: string): key is keyof Cmcd;
1389
1759
  //#endregion
1390
1760
  //#region src/isCmcdRequestKey.d.ts
1391
1761
  /**
@@ -1395,13 +1765,12 @@ declare function isCmcdEventKey(key: string): key is keyof CmcdEvent;
1395
1765
  *
1396
1766
  * @returns `true` if the key is a valid CMCD request key, `false` otherwise.
1397
1767
  *
1398
- *
1399
- * @beta
1768
+ * @public
1400
1769
  *
1401
1770
  * @example
1402
1771
  * {@includeCode ../test/isCmcdRequestKey.test.ts#example}
1403
1772
  */
1404
- declare function isCmcdRequestKey(key: string): key is keyof CmcdRequest;
1773
+ declare function isCmcdRequestKey(key: string): key is keyof Cmcd;
1405
1774
  //#endregion
1406
1775
  //#region src/isCmcdResponseReceivedKey.d.ts
1407
1776
  /**
@@ -1411,14 +1780,12 @@ declare function isCmcdRequestKey(key: string): key is keyof CmcdRequest;
1411
1780
  *
1412
1781
  * @returns `true` if the key is a valid CMCD request key, `false` otherwise.
1413
1782
  *
1414
- * @group CMCD
1415
- *
1416
- * @beta
1783
+ * @public
1417
1784
  *
1418
1785
  * @example
1419
- * {@includeCode ../../test/cmcd/isCmcdResponseReceivedKey.test.ts#example}
1786
+ * {@includeCode ../test/isCmcdResponseReceivedKey.test.ts#example}
1420
1787
  */
1421
- declare function isCmcdResponseReceivedKey(key: string): key is keyof CmcdResponse;
1788
+ declare function isCmcdResponseReceivedKey(key: string): key is keyof Cmcd;
1422
1789
  //#endregion
1423
1790
  //#region src/isCmcdV1Key.d.ts
1424
1791
  /**
@@ -1428,13 +1795,12 @@ declare function isCmcdResponseReceivedKey(key: string): key is keyof CmcdRespon
1428
1795
  *
1429
1796
  * @returns `true` if the key should be included, `false` otherwise.
1430
1797
  *
1431
- *
1432
- * @beta
1798
+ * @public
1433
1799
  *
1434
1800
  * @example
1435
1801
  * {@includeCode ../test/isCmcdV1Key.test.ts#example}
1436
1802
  */
1437
- declare function isCmcdV1Key(key: string): key is keyof Cmcd;
1803
+ declare function isCmcdV1Key(key: string): key is CmcdKey;
1438
1804
  //#endregion
1439
1805
  //#region src/prepareCmcdData.d.ts
1440
1806
  /**
@@ -1443,10 +1809,9 @@ declare function isCmcdV1Key(key: string): key is keyof Cmcd;
1443
1809
  * @param obj - The CMCD object to process.
1444
1810
  * @param options - Options for encoding.
1445
1811
  *
1446
- *
1447
- * @beta
1812
+ * @public
1448
1813
  */
1449
- declare function prepareCmcdData(obj: Record<string, any>, options?: CmcdEncodeOptions): CmcdData;
1814
+ declare function prepareCmcdData(obj: Record<string, any>, options?: CmcdEncodeOptions): Cmcd;
1450
1815
  //#endregion
1451
1816
  //#region src/toCmcdHeaders.d.ts
1452
1817
  /**
@@ -1457,29 +1822,12 @@ declare function prepareCmcdData(obj: Record<string, any>, options?: CmcdEncodeO
1457
1822
  *
1458
1823
  * @returns The CMCD header shards.
1459
1824
  *
1460
- *
1461
- * @beta
1825
+ * @public
1462
1826
  *
1463
1827
  * @example
1464
1828
  * {@includeCode ../test/toCmcdHeaders.test.ts#example}
1465
1829
  */
1466
- declare function toCmcdHeaders(cmcd: CmcdData, options?: CmcdEncodeOptions): Record<CmcdHeaderField, string>;
1467
- //#endregion
1468
- //#region src/toCmcdJson.d.ts
1469
- /**
1470
- * Convert a CMCD data object to JSON.
1471
- *
1472
- * @param cmcd - The CMCD object to convert.
1473
- * @param options - Options for encoding the CMCD object.
1474
- *
1475
- * @returns The CMCD JSON.
1476
- *
1477
- *
1478
- * @beta
1479
- *
1480
- * @deprecated Sending CMCD as JSON objects is deprecated. Use `toCmcdUrl` to create an array of url strings instead.
1481
- */
1482
- declare function toCmcdJson(cmcd: Cmcd, options?: CmcdEncodeOptions): string;
1830
+ declare function toCmcdHeaders(cmcd: Cmcd, options?: CmcdEncodeOptions): Record<CmcdHeaderField, string>;
1483
1831
  //#endregion
1484
1832
  //#region src/toCmcdQuery.d.ts
1485
1833
  /**
@@ -1490,33 +1838,13 @@ declare function toCmcdJson(cmcd: Cmcd, options?: CmcdEncodeOptions): string;
1490
1838
  *
1491
1839
  * @returns The CMCD query arg.
1492
1840
  *
1493
- *
1494
- * @beta
1841
+ * @public
1495
1842
  *
1496
1843
  * @example
1497
1844
  * {@includeCode ../test/toCmcdQuery.test.ts#example}
1498
1845
  */
1499
1846
  declare function toCmcdQuery(cmcd: Cmcd, options?: CmcdEncodeOptions): string;
1500
1847
  //#endregion
1501
- //#region src/toCmcdReport.d.ts
1502
- /**
1503
- * Converts CMCD data into a report format.
1504
- *
1505
- * @param data - The CMCD data to be transformed into a report
1506
- * @param target - The target configuration for the CMCD report
1507
- *
1508
- * @return A CMCD report object
1509
- *
1510
- *
1511
- * @beta
1512
- *
1513
- * @example
1514
- * {@includeCode ../test/toCmcdReport.test.ts#example}
1515
- */
1516
- declare function toCmcdReport(data: CmcdData, target: CmcdReportTarget): Request<{
1517
- cmcd: Cmcd;
1518
- }> | null;
1519
- //#endregion
1520
1848
  //#region src/toCmcdUrl.d.ts
1521
1849
  /**
1522
1850
  * Convert a CMCD data object to a URL encoded string.
@@ -1526,10 +1854,21 @@ declare function toCmcdReport(data: CmcdData, target: CmcdReportTarget): Request
1526
1854
  *
1527
1855
  * @returns The URL encoded CMCD data.
1528
1856
  *
1529
- *
1530
- * @beta
1857
+ * @public
1531
1858
  */
1532
1859
  declare function toCmcdUrl(cmcd: Cmcd, options?: CmcdEncodeOptions): string;
1533
1860
  //#endregion
1534
- export { CMCD_COMMON_KEYS, CMCD_DEFAULT_TIME_INTERVAL, CMCD_EVENT_KEYS, CMCD_EVENT_MODE, CMCD_FORMATTER_MAP, CMCD_HEADERS, CMCD_JSON, CMCD_KEYS, CMCD_OBJECT, CMCD_PARAM, CMCD_QUERY, CMCD_REQUEST, CMCD_REQUEST_KEYS, CMCD_REQUEST_MODE, CMCD_RESPONSE_KEYS, CMCD_RESPONSE_MODE, CMCD_SESSION, CMCD_STATUS, CMCD_V1, CMCD_V1_KEYS, CMCD_V2, Cmcd, CmcdCustomKey, CmcdData, CmcdEncodeOptions, CmcdEncoding, CmcdEvent, CmcdEventExcludedKeys, CmcdEventType, CmcdFormatter, CmcdFormatterMap, CmcdFormatterOptions, CmcdFormatters, CmcdHeaderField, CmcdHeaderMap, CmcdHeadersMap, CmcdKey, CmcdObjectType, CmcdPlayerState, CmcdReportTarget, CmcdReportingMode, CmcdRequest, CmcdResponse, CmcdStreamType, CmcdStreamingFormat, CmcdTransmissionMode, CmcdValue, appendCmcdHeaders, appendCmcdQuery, decodeCmcd, encodeCmcd, fromCmcdHeaders, fromCmcdQuery, fromCmcdUrl, groupCmcdHeaders, isCmcdCustomKey, isCmcdEventKey, isCmcdRequestKey, isCmcdResponseReceivedKey, isCmcdV1Key, prepareCmcdData, toCmcdHeaders, toCmcdJson, toCmcdQuery, toCmcdReport, toCmcdUrl };
1861
+ //#region src/toCmcdValue.d.ts
1862
+ /**
1863
+ * Convert a value to a CMCD value.
1864
+ *
1865
+ * @param value - The value to convert to a CMCD value.
1866
+ * @param params - The parameters to convert to a CMCD value.
1867
+ * @returns The CMCD value.
1868
+ *
1869
+ * @public
1870
+ */
1871
+ declare function toCmcdValue<V extends SfBareItem, P>(value: V, params?: P): SfItem<V, P>;
1872
+ //#endregion
1873
+ export { CMCD_DEFAULT_TIME_INTERVAL, CMCD_EVENT_AD_BREAK_END, CMCD_EVENT_AD_BREAK_START, CMCD_EVENT_AD_END, CMCD_EVENT_AD_START, CMCD_EVENT_BACKGROUNDED_MODE, CMCD_EVENT_BITRATE_CHANGE, CMCD_EVENT_CONTENT_ID, CMCD_EVENT_CUSTOM_EVENT, CMCD_EVENT_ERROR, CMCD_EVENT_KEYS, CMCD_EVENT_MODE, CMCD_EVENT_MUTE, CMCD_EVENT_PLAYER_COLLAPSE, CMCD_EVENT_PLAYER_EXPAND, CMCD_EVENT_PLAY_STATE, CMCD_EVENT_RESPONSE_RECEIVED, CMCD_EVENT_SKIP, CMCD_EVENT_TIME_INTERVAL, CMCD_EVENT_UNMUTE, CMCD_FORMATTER_MAP, CMCD_HEADERS, CMCD_JSON, CMCD_KEYS, CMCD_OBJECT, CMCD_PARAM, CMCD_QUERY, CMCD_REQUEST, CMCD_REQUEST_KEYS, CMCD_REQUEST_MODE, CMCD_RESPONSE_KEYS, CMCD_SESSION, CMCD_STATUS, CMCD_V1, CMCD_V1_KEYS, CMCD_V2, Cmcd, CmcdCustomKey, CmcdCustomValue, CmcdEncodeOptions, CmcdEvent, CmcdEventReportConfig, CmcdEventType, CmcdFormatter, CmcdFormatterMap, CmcdFormatterOptions, CmcdHeaderField, CmcdHeaderKey, CmcdHeaderMap, CmcdHeaderValue, CmcdKey, CmcdObjectType, CmcdObjectTypeList, CmcdPlayerState, CmcdReportConfig, CmcdReporter, CmcdReporterConfig, CmcdReportingMode, CmcdRequest, CmcdRequestKey, CmcdRequestReportConfig, CmcdResponse, CmcdStreamType, CmcdStreamingFormat, CmcdTransmissionMode, CmcdV1, CmcdValue, appendCmcdHeaders, appendCmcdQuery, decodeCmcd, encodeCmcd, fromCmcdHeaders, fromCmcdQuery, fromCmcdUrl, groupCmcdHeaders, isCmcdCustomKey, isCmcdEventKey, isCmcdRequestKey, isCmcdResponseReceivedKey, isCmcdV1Key, prepareCmcdData, toCmcdHeaders, toCmcdQuery, toCmcdUrl, toCmcdValue };
1535
1874
  //# sourceMappingURL=index.d.ts.map