import { SfBareItem, SfItem, SfToken } from "@svta/cml-structured-field-values"; import { ExclusiveRecord, HttpRequest, HttpResponse, ValueOf, ValueOrArray } from "@svta/cml-utils"; //#region src/CmcdEventType.d.ts /** * CMCD event type for the 'bc' key (bitrate change). * * @public */ declare const CMCD_EVENT_BITRATE_CHANGE: "bc"; /** * CMCD event type for the 'ps' key (play state change). * * @public */ declare const CMCD_EVENT_PLAY_STATE: "ps"; /** * CMCD event type for the 'pr' key (playback rate change). * * @public */ declare const CMCD_EVENT_PLAYBACK_RATE: "pr"; /** * CMCD event type for the 'e' key (error). * * @public */ declare const CMCD_EVENT_ERROR: "e"; /** * CMCD event type for the 't' key (time interval). * * @public */ declare const CMCD_EVENT_TIME_INTERVAL: "t"; /** * CMCD event type for the 'c' key (content ID). * * @public */ declare const CMCD_EVENT_CONTENT_ID: "c"; /** * CMCD event type for the 'b' key (backgrounded mode). * * @public */ declare const CMCD_EVENT_BACKGROUNDED_MODE: "b"; /** * CMCD event type for the 'm' key (mute). * * @public */ declare const CMCD_EVENT_MUTE: "m"; /** * CMCD event type for the 'um' key (unmute). * * @public */ declare const CMCD_EVENT_UNMUTE: "um"; /** * CMCD event type for the 'pe' key (player expand). * * @public */ declare const CMCD_EVENT_PLAYER_EXPAND: "pe"; /** * CMCD event type for the 'pc' key (player collapse). * * @public */ declare const CMCD_EVENT_PLAYER_COLLAPSE: "pc"; /** * CMCD event type for the 'rr' key (response received). * * @public */ declare const CMCD_EVENT_RESPONSE_RECEIVED: "rr"; /** * CMCD event type for the 'as' key (ad start). * * @public */ declare const CMCD_EVENT_AD_START: "as"; /** * CMCD event type for the 'ae' key (ad end). * * @public */ declare const CMCD_EVENT_AD_END: "ae"; /** * CMCD event type for the 'abs' key (ad break start). * * @public */ declare const CMCD_EVENT_AD_BREAK_START: "abs"; /** * CMCD event type for the 'abe' key (ad break end). * * @public */ declare const CMCD_EVENT_AD_BREAK_END: "abe"; /** * CMCD event type for the 'sk' key (skip). * * @public */ declare const CMCD_EVENT_SKIP: "sk"; /** * CMCD event type for the 'ce' key (custom event). * * @public */ declare const CMCD_EVENT_CUSTOM_EVENT: "ce"; /** * CMCD event types for the 'e' key (event mode). * * @enum * * @see {@link https://cta-wave.github.io/Resources/common-media-client-data--cta-5004-b.html#event | CTA-5004-B Event} * * @public */ declare const CmcdEventType: { /** * A change in the bitrate. */ readonly BITRATE_CHANGE: typeof CMCD_EVENT_BITRATE_CHANGE; /** * A change in the player state. */ readonly PLAY_STATE: typeof CMCD_EVENT_PLAY_STATE; /** * A change in the playback rate. */ readonly PLAYBACK_RATE: typeof CMCD_EVENT_PLAYBACK_RATE; /** * An error event. */ readonly ERROR: typeof CMCD_EVENT_ERROR; /** * A periodic report sent on a time interval. */ readonly TIME_INTERVAL: typeof CMCD_EVENT_TIME_INTERVAL; /** * A change of the content ID. */ readonly CONTENT_ID: typeof CMCD_EVENT_CONTENT_ID; /** * A change in the application's backgrounded state. */ readonly BACKGROUNDED_MODE: typeof CMCD_EVENT_BACKGROUNDED_MODE; /** * The player was muted. */ readonly MUTE: typeof CMCD_EVENT_MUTE; /** * Player unmuted. */ readonly UNMUTE: typeof CMCD_EVENT_UNMUTE; /** * The player view was expanded. */ readonly PLAYER_EXPAND: typeof CMCD_EVENT_PLAYER_EXPAND; /** * The player view was collapsed. */ readonly PLAYER_COLLAPSE: typeof CMCD_EVENT_PLAYER_COLLAPSE; /** * The receipt of a response. */ readonly RESPONSE_RECEIVED: typeof CMCD_EVENT_RESPONSE_RECEIVED; /** * The start of an ad. */ readonly AD_START: typeof CMCD_EVENT_AD_START; /** * The end of an ad. */ readonly AD_END: typeof CMCD_EVENT_AD_END; /** * The start of an ad break. */ readonly AD_BREAK_START: typeof CMCD_EVENT_AD_BREAK_START; /** * The end of an ad break. */ readonly AD_BREAK_END: typeof CMCD_EVENT_AD_BREAK_END; /** * The user skipped an ad. */ readonly SKIP: typeof CMCD_EVENT_SKIP; /** * A custom event. */ readonly CUSTOM_EVENT: typeof CMCD_EVENT_CUSTOM_EVENT; }; /** * @public */ type CmcdEventType = ValueOf; //#endregion //#region src/CmcdCustomKey.d.ts /** * A custom key for CMCD. Custom keys MUST carry a hyphenated prefix * to ensure that there will not be a namespace collision with future * revisions to this specification. Clients SHOULD use a reverse-DNS * syntax when defining their own prefix. * * @public */ type CmcdCustomKey = `${string}-${string}`; //#endregion //#region src/CmcdCustomValue.d.ts /** * A value type for custom CMCD keys. * * @public */ type CmcdCustomValue = string | SfItem | (string | SfItem)[] | number | SfItem | (number | SfItem)[] | boolean | SfItem | (boolean | SfItem)[] | symbol | SfItem | (symbol | SfItem)[] | SfToken | SfItem | (SfToken | SfItem)[]; //#endregion //#region src/CmcdObjectType.d.ts /** * Common Media Client Data Object Type * * @public * * @enum * * @see {@link https://cta-wave.github.io/Resources/common-media-client-data--cta-5004-b.html#object-type | CTA-5004-B Object Type} */ declare const CmcdObjectType: { /** * text file, such as a manifest or playlist */ readonly MANIFEST: "m"; /** * audio only */ readonly AUDIO: "a"; /** * video only */ readonly VIDEO: "v"; /** * muxed audio and video */ readonly MUXED: "av"; /** * init segment */ readonly INIT: "i"; /** * caption or subtitle */ readonly CAPTION: "c"; /** * ISOBMFF timed text track */ readonly TIMED_TEXT: "tt"; /** * cryptographic key, license or certificate. */ readonly KEY: "k"; /** * other */ readonly OTHER: "o"; }; /** * @public */ type CmcdObjectType = ValueOf; //#endregion //#region src/CmcdObjectTypeList.d.ts /** * A numeric list with an optional object type boolean flag. * * @public */ type CmcdObjectTypeList = (number | SfItem>)[]; //#endregion //#region src/CmcdPlayerState.d.ts /** * CMCD v2 player states for the 'sta' key. * * * @enum * * @public * * @see {@link https://cta-wave.github.io/Resources/common-media-client-data--cta-5004-b.html#state | CTA-5004-B State} */ declare const CmcdPlayerState: { /** * Starting: Initial startup of the player. */ readonly STARTING: "s"; /** * Playing: The player is actively rendering content. */ readonly PLAYING: "p"; /** * Seeking: The player is seeking to a new position. */ readonly SEEKING: "k"; /** * Rebuffering: The player is buffering data during playback. */ readonly REBUFFERING: "r"; /** * Paused: The player is paused. */ readonly PAUSED: "a"; /** * Waiting: The player is waiting for a user action or another event. */ readonly WAITING: "w"; /** * Ended: The media has finished playing. */ readonly ENDED: "e"; /** * Fatal Error: The player has encountered a fatal error. */ readonly FATAL_ERROR: "f"; /** * Quit: User initiated end of playback before media asset completion. */ readonly QUIT: "q"; /** * 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. */ readonly PRELOADING: "d"; }; /** * @public */ type CmcdPlayerState = ValueOf; //#endregion //#region src/CmcdStreamType.d.ts /** * Common Media Client Data Stream Type * * @enum * * @see {@link https://cta-wave.github.io/Resources/common-media-client-data--cta-5004-b.html#stream-type | CTA-5004-B Stream Type} * * @public */ declare const CmcdStreamType: { /** * All segments are available – e.g., VOD */ readonly VOD: "v"; /** * Segments become available over time – e.g., LIVE */ readonly LIVE: "l"; /** * Low latency stream */ readonly LOW_LATENCY: "ll"; }; /** * @public */ type CmcdStreamType = ValueOf; //#endregion //#region src/CmcdStreamingFormat.d.ts /** * Common Media Client Data Streaming Format * * @enum * * @see {@link https://cta-wave.github.io/Resources/common-media-client-data--cta-5004-b.html#streaming-format | CTA-5004-B Streaming Format} * * @public */ declare const CmcdStreamingFormat: { /** * MPEG DASH */ readonly DASH: "d"; /** * HTTP Live Streaming (HLS) */ readonly HLS: "h"; /** * Smooth Streaming */ readonly SMOOTH: "s"; /** * Other */ readonly OTHER: "o"; }; /** * @public */ type CmcdStreamingFormat = ValueOf; //#endregion //#region src/CmcdRequest.d.ts /** * Common Media Client Data (CMCD) version 2 - Request Mode. * * A standardized set of HTTP request header fields and query string parameters * for communicating media playback metrics in request mode. * * @see {@link https://cta-wave.github.io/Resources/common-media-client-data--cta-5004-b.html#request-mode | CTA-5004-B Request Mode} * * @public */ type CmcdRequest = { /** * Custom key names may be used, but they MUST carry a hyphenated prefix to ensure that there will not be a namespace collision * with future revisions to this specification. Clients SHOULD use a reverse-DNS syntax when defining their own prefix. */ [index: CmcdCustomKey]: CmcdCustomValue | undefined; /** * Aggregate encoded bitrate * * The aggregate encoded bitrate across a playable combination of tracks. This metric SHOULD NOT be used when the individual bitrates * of the tracks are known. This value SHOULD be derived from a playlist/manifest declaration, or it MAY be estimated by the player. * If the playlist declares both peak and average bitrate values, the peak value MUST be transmitted. This value MUST NOT be sent if * the encoded bitrate is known. * * Inner list of integer kbps with token identifiers * * @see {@link https://cta-wave.github.io/Resources/common-media-client-data--cta-5004-b.html#aggregate-encoded-bitrate | CTA-5004-B Aggregate Encoded Bitrate} */ ab?: CmcdObjectTypeList; /** * Backgrounded * * 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 * be sent if it is TRUE. If the visibility state of the player is not known this key SHOULD NOT be reported. * * Boolean * * @see {@link https://cta-wave.github.io/Resources/common-media-client-data--cta-5004-b.html#backgrounded | CTA-5004-B Backgrounded} */ bg?: boolean; /** * Buffer length * * The buffer length associated with the media object being requested. This value SHOULD be rounded to the nearest 100 ms. * * Inner list of integer milliseconds with token identifiers * * @see {@link https://cta-wave.github.io/Resources/common-media-client-data--cta-5004-b.html#buffer-length | CTA-5004-B Buffer Length} */ bl?: CmcdObjectTypeList; /** * Encoded bitrate * * The encoded bitrate. In request mode, this refers to the encoded bitrate of the requested representation. * In event mode this refers to the encoded bitrate of the currently selected representation. * This SHOULD be derived from playlist/manifest declarations, or it MAY be estimated by the player. * If the playlist declares both peak and average bitrate values, the peak value MUST be transmitted. * * Inner list of integer kbps with token identifiers * * @see {@link https://cta-wave.github.io/Resources/common-media-client-data--cta-5004-b.html#encoded-bitrate | CTA-5004-B Encoded Bitrate} */ br?: CmcdObjectTypeList; /** * Buffer starvation * * TRUE if the player buffer was starved at some point between the prior report and this report per reporting destination, resulting in * the player entering a rebuffering state or remaining in a rebuffering state. Note that if the player begins requesting data from a * new CDN, then this key might initially report buffering caused by the prior CDN. This key SHOULD NOT be reported if it is FALSE. * * Boolean * * @see {@link https://cta-wave.github.io/Resources/common-media-client-data--cta-5004-b.html#buffer-starvation | CTA-5004-B Buffer Starvation} */ bs?: boolean; /** * Buffer Starvation Absolute * * An absolute count of buffer starvation events since session initiation. A buffer starvation event occurs when the state changes * to rebuffering. Token identifier MAY be omitted if the cause of the rebuffering is unknown. * * Inner list of integers with optional token identifiers * * @see {@link https://cta-wave.github.io/Resources/common-media-client-data--cta-5004-b.html#buffer-starvation-absolute | CTA-5004-B Buffer Starvation Absolute} */ bsa?: CmcdObjectTypeList; /** * Buffer Starvation Duration * * A list of durations of each buffer starvation period reported once the rebuffering has completed. This value MUST only be reported * once per reporting mode and report destination. Token identifier MAY be omitted if the cause of the rebuffering is unknown. * * Inner list of integer milliseconds with optional token identifiers * * @see {@link https://cta-wave.github.io/Resources/common-media-client-data--cta-5004-b.html#buffer-starvation-duration | CTA-5004-B Buffer Starvation Duration} */ bsd?: CmcdObjectTypeList; /** * Buffer Starvation Duration Absolute * * An absolute count of buffer starvation duration since session initiation. Token identifier MAY be omitted if the cause of the * rebuffering is unknown. * * Inner list of integer milliseconds with optional token identifiers * * @see {@link https://cta-wave.github.io/Resources/common-media-client-data--cta-5004-b.html#buffer-starvation-duration-absolute | CTA-5004-B Buffer Starvation Duration Absolute} */ bsda?: CmcdObjectTypeList; /** * CDN ID * * A string identifying the current delivery network from which the player is retrieving content. Maximum length is 128 characters. * * String * * @see {@link https://cta-wave.github.io/Resources/common-media-client-data--cta-5004-b.html#cdn-id | CTA-5004-B CDN ID} */ cdn?: string; /** * Content ID * * A unique string identifying the current content. The maximum length is 128 characters. This value is consistent across multiple different * sessions and devices and is defined and updated at the discretion of the service provider. * * String * * @see {@link https://cta-wave.github.io/Resources/common-media-client-data--cta-5004-b.html#content-id | CTA-5004-B Content ID} */ cid?: string; /** * Content Signature * * 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. For example, this field may be used to transmit the C2PA signature associated with the content being viewed. * * String * * @see {@link https://cta-wave.github.io/Resources/common-media-client-data--cta-5004-b.html#content-signature | CTA-5004-B Content Signature} */ cs?: string; /** * Object duration * * The playback duration in milliseconds of the object being requested. If a partial segment is being requested, * then this value MUST indicate the playback duration of that part and not that of its parent segment. * This value can be an approximation of the estimated duration if the explicit value is not known. * This value MUST NOT be sent for objects which do not have an object type of 'a', 'v', 'av', 'tt', 'c', or 'o'. * * Integer milliseconds * * @see {@link https://cta-wave.github.io/Resources/common-media-client-data--cta-5004-b.html#object-duration | CTA-5004-B Object Duration} */ d?: number; /** * Dropped Frames Absolute * * An absolute count of dropped frames since session initiation. This key SHOULD only be sent for content types of 'v', 'av' or 'o'. * 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. * * Integer * * @see {@link https://cta-wave.github.io/Resources/common-media-client-data--cta-5004-b.html#dropped-frames-absolute | CTA-5004-B Dropped Frames Absolute} */ dfa?: number; /** * Deadline * * 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 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 remaining buffer length. * * Integer milliseconds * * @see {@link https://cta-wave.github.io/Resources/common-media-client-data--cta-5004-b.html#deadline | CTA-5004-B Deadline} */ dl?: number; /** * Player Error Code * * A string defining an error code produced by the player. The namespace and formatting of this error code is left to the application. * * Even if only one error code is being specified, the list notation MUST still be used. * * Inner list of strings * * @see {@link https://cta-wave.github.io/Resources/common-media-client-data--cta-5004-b.html#player-error-code | CTA-5004-B Player Error Code} */ ec?: string[]; /** * Lowest aggregated encoded bitrate * * The lowest aggregated bitrate rendition in the manifest or playlist. This SHOULD be derived from playlist/manifest declarations, * or it MAY be estimated by the player. If the playlist declares both peak and average bitrate values, the peak value MUST be * transmitted. The aggregate encoded bitrate is of the complete media object including all object types. This value MUST NOT be * sent if the lowest encoded bitrate is known. * * Inner list of integer kbps with token identifiers * * @see {@link https://cta-wave.github.io/Resources/common-media-client-data--cta-5004-b.html#lowest-aggregated-encoded-bitrate | CTA-5004-B Lowest Aggregated Encoded Bitrate} */ lab?: CmcdObjectTypeList; /** * Lowest encoded bitrate * * The lowest bitrate rendition in the manifest or playlist. This SHOULD be derived from playlist/manifest declarations, or it MAY be * estimated by the player. If the playlist declares both peak and average bitrate values, the peak value MUST be transmitted. This * lowest bitrate MUST apply to the object type being requested. Requests for video objects MUST specify the lowest video bitrate and * requests for audio objects MUST specify the lowest audio bitrate. * * Inner list of integer kbps with token identifiers * * @see {@link https://cta-wave.github.io/Resources/common-media-client-data--cta-5004-b.html#lowest-encoded-bitrate | CTA-5004-B Lowest Encoded Bitrate} */ lb?: CmcdObjectTypeList; /** * Live stream latency * * The time delta between when a given media timestamp was made available at the origin and when it was rendered by the player. The * accuracy of this estimate is dependent on synchronization between the packager and the player clocks. * * Integer milliseconds * * @see {@link https://cta-wave.github.io/Resources/common-media-client-data--cta-5004-b.html#live-stream-latency | CTA-5004-B Live Stream Latency} */ ltc?: number; /** * Media Start Delay * * 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, whether it be primary content or interstitial content. This value SHOULD be the time difference between the * "starting" and "playing" states. * * This key MUST only be sent once per Session ID and MUST be sent for each reporting mode which is active within the player. * * Integer milliseconds * * @see {@link https://cta-wave.github.io/Resources/common-media-client-data--cta-5004-b.html#media-start-delay | CTA-5004-B Media Start Delay} */ msd?: number; /** * Measured throughput * * The throughput between player and server, as measured by the player. Throughput MUST be rounded to the nearest 100 kbps. This value, however * derived, SHOULD be the value that the player is using to make its next Adaptive Bitrate switching decision. If the player is requesting * different object types from different providers then it SHOULD take care to match the throughput measured against that provider with each * object type request. It is acceptable to report aggregate information if objects of the same type are requested from different providers. * If the player has multiple concurrent connections to the provider, then the intent is that this value communicates the aggregate throughput * the player sees across all those connections. If this key is sent on an interval report, the value transmitted should be the last throughput * estimate made by the player prior to making the report. There is no requirement for the player to calculate the average measured throughput * since the prior interval report. * * Inner list of integer kbps with token identifiers * * @see {@link https://cta-wave.github.io/Resources/common-media-client-data--cta-5004-b.html#measured-throughput | CTA-5004-B Measured Throughput} */ mtp?: CmcdObjectTypeList; /** * Next object request * * 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 * the current request. Each object SHOULD be fetched in its entirety unless there is a range associated with the future request. Even if * only one object is being specified, the list notation MUST still be used. If there is a range associated with the future request, then * the range is communicated as the parameter 'r' with a String value. The formatting of the String value is similar to the HTTP Range * header, except that the unit MUST be 'byte', the 'Range:' prefix is NOT permitted, specifying multiple ranges is NOT allowed and the * only valid combinations are: * * - `"-"` * - `"-"` * - `"-"` * * 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. * * Inner list of strings * * @remarks * Values may be provided as absolute URLs for convenience; when {@link CmcdEncodeOptions.baseUrl} is set, * same-origin URLs are converted to paths relative to that base. Already-relative values are emitted unchanged. * * @see {@link https://cta-wave.github.io/Resources/common-media-client-data--cta-5004-b.html#next-object-request | CTA-5004-B Next Object Request} */ nor?: (string | SfItem)[]; /** * Non rendered * * 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. * * Boolean * * @see {@link https://cta-wave.github.io/Resources/common-media-client-data--cta-5004-b.html#non-rendered | CTA-5004-B Non Rendered} */ nr?: boolean; /** * Object type * * The media type of the current object being requested: * - `m` = text file, such as a manifest or playlist * - `a` = audio only * - `v` = video only * - `av` = muxed audio and video * - `i` = init segment * - `c` = caption or subtitle * - `tt` = ISOBMFF timed text track * - `k` = cryptographic key, license or certificate. * - `o` = other * * If the object type being requested is unknown, then this key MUST NOT be used. * * This key is also used as a token parameter for other keys. * * Token * * @see {@link https://cta-wave.github.io/Resources/common-media-client-data--cta-5004-b.html#object-type | CTA-5004-B Object Type} */ ot?: CmcdObjectType; /** * Playhead bitrate * * The encoded bitrate of the media object(s) being shown to the end user. * * Inner list of integer kbps with token identifiers * * @see {@link https://cta-wave.github.io/Resources/common-media-client-data--cta-5004-b.html#playhead-bitrate | CTA-5004-B Playhead Bitrate} */ pb?: CmcdObjectTypeList; /** * Playback rate * * 1.0 if real-time, 2.0 if double speed, 0 if not playing. SHOULD only be sent if not equal to 1.0. * * Decimal * * @see {@link https://cta-wave.github.io/Resources/common-media-client-data--cta-5004-b.html#playback-rate | CTA-5004-B Playback Rate} */ pr?: number; /** * Playhead time * * The playhead time, expressed in milliseconds, which is being rendered to the viewer when the report is made. * * Integer milliseconds * * @see {@link https://cta-wave.github.io/Resources/common-media-client-data--cta-5004-b.html#playhead-time | CTA-5004-B Playhead Time} */ pt?: number; /** * Requested maximum throughput * * The requested maximum throughput that the player considers sufficient for delivery of the asset. Values MUST be rounded to the * nearest 100kbps. * * Integer kbps * * @see {@link https://cta-wave.github.io/Resources/common-media-client-data--cta-5004-b.html#requested-maximum-throughput | CTA-5004-B Requested Maximum Throughput} */ rtp?: number; /** * Streaming format * * The streaming format that defines the current request. * * - `d` = MPEG DASH * - `h` = HTTP Live Streaming (HLS) * - `e` = HESP * - `s` = Smooth Streaming * - `o` = other * * Token * * @see {@link https://cta-wave.github.io/Resources/common-media-client-data--cta-5004-b.html#streaming-format | CTA-5004-B Streaming Format} */ sf?: CmcdStreamingFormat; /** * Session ID * * A GUID identifying the current playback session. A playback session typically consists of the playback of a single media asset along * with accompanying content such as advertisements. This session may comprise the playback of primary content combined with interstitial * content. This session is being played on a single device. The maximum length is 64 characters. It is RECOMMENDED to conform to the * UUID specification. * * String * * @see {@link https://cta-wave.github.io/Resources/common-media-client-data--cta-5004-b.html#session-id | CTA-5004-B Session ID} */ sid?: string; /** * Sequence Number * * 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 a new session-id. Sequence numbers increase independently per each combination of mode and target. * * Integer * * @see {@link https://cta-wave.github.io/Resources/common-media-client-data--cta-5004-b.html#sequence-number | CTA-5004-B Sequence Number} */ sn?: number; /** * Stream type * * - `v` = all segments are available - e.g., VOD * - `l` = segments become available over time - e.g., LIVE * - `ll` = low latency LIVE * * Token * * @see {@link https://cta-wave.github.io/Resources/common-media-client-data--cta-5004-b.html#stream-type | CTA-5004-B Stream Type} */ st?: CmcdStreamType; /** * State * * A token describing the current playback state of the player as perceived by the end user, one of: * * - `s` - starting: the player has been instructed to play media for a given session, either by a user interaction or by an autoplay action. * - `p` - playing: Media is being rendered. * - `k` - seeking: The start of the action of moving the playhead position after starting. * - `r` - rebuffering: Media has stopped being rendered due to an insufficient buffer. This state is not reported during startup or seeking. * - `a` - paused: Playback has been intentionally paused by either the user or the player. * - `e` - ended: Rendering has ended due to completion of the media asset playback. * - `f` - fatal error: Rendering has ended due to an irrecoverable error. * - `q` - quit: User initiated end of playback before media asset completion. * - `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. * * Token - one of [s,p,k,r,a,e,f,q,d] * * @see {@link https://cta-wave.github.io/Resources/common-media-client-data--cta-5004-b.html#state | CTA-5004-B State} */ sta?: CmcdPlayerState; /** * Startup * * 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 * reports this key as true until its buffer first reaches the target buffer for stable playback. * * Boolean * * @see {@link https://cta-wave.github.io/Resources/common-media-client-data--cta-5004-b.html#startup | CTA-5004-B Startup} */ su?: boolean; /** * Top aggregated encoded bitrate * * The highest aggregated bitrate rendition in the manifest or playlist. This SHOULD be derived from playlist/manifest declarations, * or it MAY be estimated by the player. If the playlist declares both peak and average bitrate values, the peak value MUST be * transmitted. The aggregate encoded bitrate is of the complete media object including all object types. This value MUST NOT be * sent if the top encoded bitrate is known. * * Inner list of integer kbps with token identifiers * * @see {@link https://cta-wave.github.io/Resources/common-media-client-data--cta-5004-b.html#top-aggregated-encoded-bitrate | CTA-5004-B Top Aggregated Encoded Bitrate} */ tab?: CmcdObjectTypeList; /** * Top encoded bitrate * * The highest bitrate rendition in the manifest or playlist. This SHOULD be derived from playlist/manifest declarations, * or it MAY be estimated by the player. If the playlist declares both peak and average bitrate values, the peak value * MUST be transmitted. This top bitrate MUST apply to the object type being requested. Requests for video objects MUST * specify the top video bitrate and requests for audio objects MUST specify the top audio bitrate. * * Inner list of integer kbps with token identifiers * * @see {@link https://cta-wave.github.io/Resources/common-media-client-data--cta-5004-b.html#top-encoded-bitrate | CTA-5004-B Top Encoded Bitrate} */ tb?: CmcdObjectTypeList; /** * Target Buffer length * * The target buffer length associated with the media object being requested at the time of the request. This value SHOULD be rounded * to the nearest 100 ms. * * Inner list of integer milliseconds with token identifiers * * @see {@link https://cta-wave.github.io/Resources/common-media-client-data--cta-5004-b.html#target-buffer-length | CTA-5004-B Target Buffer Length} */ tbl?: CmcdObjectTypeList; /** * Top playable bitrate * * The highest bitrate rendition that the player is currently capable of playing for reasons other than bandwidth limitations. This * key captures the cases in which, for example, screen resolution, DRM, or performance constraints limit the player's topmost choice * of bitrate. These constraints are intentionally obfuscated for privacy reasons. * * This key can increase the fingerprinting surface exposed by CMCD transmission and SHOULD NOT be transmitted in a default player * configuration. * * If the playlist declares both peak and average bitrate values, the peak value MUST be transmitted. This top playable bitrate MUST * apply to the object type being requested. Requests for video objects MUST specify the top playable video bitrate and requests for * audio objects MUST specify the top playable audio bitrate. This value MUST NOT be sent for objects which do not have an object type * of 'a', 'v', 'av' or 'c'. * * Inner list of integer kbps with token identifiers * * @see {@link https://cta-wave.github.io/Resources/common-media-client-data--cta-5004-b.html#top-playable-bitrate | CTA-5004-B Top Playable Bitrate} */ tpb?: CmcdObjectTypeList; /** * Version * * The version of this specification used for interpreting the defined key names and values. If this key is omitted, the player and server * 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 * if the version is not 1. * * Integer * * @see {@link https://cta-wave.github.io/Resources/common-media-client-data--cta-5004-b.html#version | CTA-5004-B Version} */ v?: number; }; //#endregion //#region src/CmcdEvent.d.ts /** * Common Media Client Data (CMCD) version 2 - Event Mode. * * Extends {@link CmcdRequest} with event-specific keys for reporting events * according to the CMCD version 2 specification. * * @see {@link https://cta-wave.github.io/Resources/common-media-client-data--cta-5004-b.html#event-mode | CTA-5004-B Event Mode} * * @public */ type CmcdEvent = CmcdRequest & { /** * Custom Event Name * * 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 * '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 * a custom value associated with this event. The names chosen SHOULD associate the custom event name with the custom key name. * * String * * @see {@link https://cta-wave.github.io/Resources/common-media-client-data--cta-5004-b.html#custom-event-name | CTA-5004-B Custom Event Name} */ cen?: string; /** * Event * * This key MUST only be used in Event mode and MUST be present on all reports. The minimum recommended set of supported events * are: `ps`, `e`, `t`, and `rr`. * * - `abs` - ad break start * - `abe` - ad break end * - `ae` - ad end * - `as` - ad start * - `b` - backgrounded mode * - `bc` - bitrate change * - `c` - content ID changed * - `ce` - custom event * - `e` - error * - `h` - hostname changed * - `m` - mute * - `pc` - player collapse * - `pe` - player expand * - `pr` - playback rate change * - `ps` - play state change * - `rr` - response received * - `sk` - skip * - `t` - time interval * - `um` - unmute * * Token * * @see {@link https://cta-wave.github.io/Resources/common-media-client-data--cta-5004-b.html#event | CTA-5004-B Event} */ e?: CmcdEventType; /** * Hostname * * A string identifying the current hostname from which the player is retrieving content. Maximum length is 128 characters. * * String * * @see {@link https://cta-wave.github.io/Resources/common-media-client-data--cta-5004-b.html#hostname | CTA-5004-B Hostname} */ h?: string; /** * Timestamp * * The timestamp at which the associated event occurred, expressed as the number of milliseconds that have elapsed since the Unix * 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 * reference when the request was first initiated. * * This key MUST be included with all Event reports. * * Integer milliseconds * * @see {@link https://cta-wave.github.io/Resources/common-media-client-data--cta-5004-b.html#timestamp | CTA-5004-B Timestamp} */ ts?: number; }; //#endregion //#region src/CmcdResponse.d.ts /** * Common Media Client Data (CMCD) version 2 - Response Mode. * * Extends {@link CmcdRequest} with response-specific keys for reporting * response data according to the CMCD version 2 specification. * * @see {@link https://cta-wave.github.io/Resources/common-media-client-data--cta-5004-b.html#response-mode | CTA-5004-B Response Mode} * * @public */ type CmcdResponse = CmcdRequest & { /** * CMSD Dynamic Header * * Holds a Base64 encoded copy of the CMSD data received on the CMSD-Dynamic response header. This key MUST only be reported on * events of type `rr` (response received). * * String * * @see {@link https://cta-wave.github.io/Resources/common-media-client-data--cta-5004-b.html#cmsd-dynamic-header | CTA-5004-B CMSD Dynamic Header} */ cmsdd?: string; /** * CMSD Static Header * * Holds a Base64 encoded copy of the CMSD data received on the CMSD-Static response header. This key MUST only be reported on * events of type `rr` (response received). * * String * * @see {@link https://cta-wave.github.io/Resources/common-media-client-data--cta-5004-b.html#cmsd-static-header | CTA-5004-B CMSD Static Header} */ cmsds?: string; /** * Response code * * The response code received when requesting a media object. In a redirect scenario, this would be the final response code received. * A value of 0 SHOULD be used to indicate that a response was not received. * * This key MUST only be reported on events of type `rr` (response received). * * Integer * * @see {@link https://cta-wave.github.io/Resources/common-media-client-data--cta-5004-b.html#response-code | CTA-5004-B Response Code} */ rc?: number; /** * SMRT-Data Header * * Holds a Base64 encoded copy of the streaming media response tracing data received on the Request Tracing header. This key MUST * only be reported on events of type `rr` (response received). * * String * * @see {@link https://cta-wave.github.io/Resources/common-media-client-data--cta-5004-b.html#smrt-data-header | CTA-5004-B SMRT-Data Header} */ smrt?: string; /** * Time to first byte * * 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. This key MUST only be reported on events of type `rr` (response received). * * Integer milliseconds * * @see {@link https://cta-wave.github.io/Resources/common-media-client-data--cta-5004-b.html#time-to-first-byte | CTA-5004-B Time to First Byte} */ ttfb?: number; /** * Time to first body byte * * 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. This key MUST only be reported on events of type `rr` (response received). * * Integer milliseconds * * @see {@link https://cta-wave.github.io/Resources/common-media-client-data--cta-5004-b.html#time-to-first-body-byte | CTA-5004-B Time to First Body Byte} */ ttfbb?: number; /** * Time to last byte * * The elapsed time between when the request was first initiated (captured in ts) and the time the response body is fully received. * This key MUST only be reported on events of type `rr` (response received). * * Integer milliseconds * * @see {@link https://cta-wave.github.io/Resources/common-media-client-data--cta-5004-b.html#time-to-last-byte | CTA-5004-B Time to Last Byte} */ ttlb?: number; /** * Request URL * * The URL used to request the media object. If the request is redirected, this key MUST report the initial requested URL. This key * MUST be reported on events of type `rr` (response received). * * String * * @see {@link https://cta-wave.github.io/Resources/common-media-client-data--cta-5004-b.html#request-url | CTA-5004-B Request URL} */ url?: string; }; //#endregion //#region src/Cmcd.d.ts /** * Common Media Client Data (CMCD) version 2. * * A standardized set of HTTP request header fields, query string parameters, * and event reporting fields for communicating media playback metrics. * * This type is the intersection of {@link CmcdRequest}, {@link CmcdResponse}, * and {@link CmcdEvent}, combining all keys from all reporting modes. * * @see {@link https://cdn.cta.tech/cta/media/media/resources/standards/pdfs/cta-5004-final.pdf|CMCD v1 Spec} * * @public */ type Cmcd = CmcdRequest & CmcdResponse & CmcdEvent; //#endregion //#region src/CmcdReportingMode.d.ts /** * CMCD event mode variable name. * * @public */ declare const CMCD_EVENT_MODE: "event"; /** * CMCD request mode variable name. * * @public */ declare const CMCD_REQUEST_MODE: "request"; /** * CMCD reporting mode types. * * @enum * * @public */ declare const CmcdReportingMode: { /** * Request mode */ readonly REQUEST: typeof CMCD_REQUEST_MODE; /** * Event mode */ readonly EVENT: typeof CMCD_EVENT_MODE; }; /** * @public */ type CmcdReportingMode = ValueOf; //#endregion //#region src/CMCD_V1.d.ts /** * CMCD Version 1 * * @public */ declare const CMCD_V1: 1; //#endregion //#region src/CMCD_V2.d.ts /** * CMCD Version 2 * * @public */ declare const CMCD_V2: 2; //#endregion //#region src/CmcdVersion.d.ts /** * The version of the CMCD specification. * * @public */ type CmcdVersion = typeof CMCD_V1 | typeof CMCD_V2; //#endregion //#region src/CmcdFormatterOptions.d.ts /** * Options for formatting CMCD data values. * * @public */ type CmcdFormatterOptions = { /** * The version of the CMCD specification to use. */ version: CmcdVersion; /** * The reporting mode to use. */ reportingMode: CmcdReportingMode; /** * Base URL (typically the manifest or current request URL) used to convert absolute `nor` values * into paths relative to this base, per the CMCD specification. Values that are already relative * paths are passed through unchanged. When omitted, `nor` values are emitted as-is. */ baseUrl?: string; }; //#endregion //#region src/CmcdValue.d.ts /** * CMCD Value * * @public */ type CmcdValue = ValueOf; //#endregion //#region src/CmcdFormatter.d.ts /** * A formatter for CMCD values. * * @param value - The value to format. * * @returns The formatted value. * * @public */ type CmcdFormatter = (value: CmcdValue, options: CmcdFormatterOptions) => ValueOrArray> | ValueOrArray>; //#endregion //#region src/CmcdV1.d.ts /** * CMCD Version 1 * * @public */ type CmcdV1 = { /** * Buffer length * * 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 * sent with an object type of ‘a’, ‘v’ or ‘av’. * * Integer milliseconds */ bl?: number; /** * Bitrate * * Integer */ br?: number; /** * Measured mtp CMCD throughput * * The throughput between client and server, as measured by the client and MUST be rounded to the nearest 100 kbps. This value, however derived, * SHOULD be the value that the client is using to make its next Adaptive Bitrate switching decision. If the client is connected to multiple * servers concurrently, it must take care to report only the throughput measured against the receiving server. If the client has multiple concurrent * connections to the server, then the intent is that this value communicates the aggregate throughput the client sees across all those connections. * * Integer kbps */ mtp?: number; /** * Next object request * * 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 * 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 * pre-fetch to take place. * * String * * @remarks * Values may be provided as absolute URLs for convenience; when `CmcdEncodeOptions.baseUrl` is set, * same-origin URLs are converted to paths relative to that base. Already-relative values are not * converted, but are still URL-encoded on emission as required by CMCD v1. */ nor?: string; /** * Next range request * * @deprecated Use 'nor' with the 'r' parameter instead. * * String */ nrr?: string; /** * Top bitrate * * The highest bitrate rendition in the manifest or playlist that the client is allowed to play, given current codec, licensing and * sizing constraints. * * Integer Kbps */ tb?: number; }; //#endregion //#region src/CmcdKey.d.ts /** * A CMCD key including V1-only keys. * * @public */ type CmcdKey = keyof Cmcd | keyof CmcdV1; //#endregion //#region src/CmcdFormatterMap.d.ts /** * A map of CMCD keys to format functions. * * @public */ type CmcdFormatterMap = Record; //#endregion //#region src/CmcdHeaderField.d.ts /** * CMCD object header name. * * @public */ declare const CMCD_OBJECT: "CMCD-Object"; /** * CMCD request header name. * * @public */ declare const CMCD_REQUEST: "CMCD-Request"; /** * CMCD session header name. * * @public */ declare const CMCD_SESSION: "CMCD-Session"; /** * CMCD status header name. * * @public */ declare const CMCD_STATUS: "CMCD-Status"; /** * CMCD header fields. * * * @enum * * @public */ declare const CmcdHeaderField: { /** * keys whose values vary with the object being requested. */ readonly OBJECT: typeof CMCD_OBJECT; /** * keys whose values vary with each request. */ readonly REQUEST: typeof CMCD_REQUEST; /** * keys whose values are expected to be invariant over the life of the session. */ readonly SESSION: typeof CMCD_SESSION; /** * keys whose values do not vary with every request or object. */ readonly STATUS: typeof CMCD_STATUS; }; /** * @public */ type CmcdHeaderField = ValueOf; /** * All CMCD header fields as an array. * * @public */ declare const CMCD_HEADER_FIELDS: readonly CmcdHeaderField[]; //#endregion //#region src/CmcdHeaderMap.d.ts /** * A map of CMCD header fields to CMCD keys. * * @public */ type CmcdHeaderMap = Record; //#endregion //#region src/CmcdEncodeOptions.d.ts /** * Options for encoding CMCD values. * * @public */ type CmcdEncodeOptions = { /** * The version of the CMCD specification to use. * * @defaultValue `1` */ version?: CmcdVersion; /** * The reporting mode to use. * * @defaultValue `CmcdReportingMode.REQUEST` */ reportingMode?: CmcdReportingMode; /** * A map of CMCD keys to custom formatters. */ formatters?: Partial; /** * A map of CMCD header fields to custom CMCD keys. */ customHeaderMap?: Partial; /** * A filter function for CMCD keys. * * @param key - The CMCD key to filter. * * @returns `true` if the key should be included, `false` otherwise. */ filter?: (key: CmcdKey) => boolean; /** * Base URL (typically the manifest or current request URL) used to convert absolute `nor` values * into paths relative to this base, per the CMCD specification. Values that are already relative * paths are not modified by this option, though CMCD v1 still URL-encodes them on emission. When * omitted, `nor` values are emitted as-is (subject to the v1 URL-encoding rule). */ baseUrl?: string; /** * Array of event names to filter. */ events?: string[]; }; //#endregion //#region src/appendCmcdHeaders.d.ts /** * Append CMCD query args to a header object. * * @param headers - The headers to append to. * @param cmcd - The CMCD object to append. * @param options - Encode options. * * @returns The headers with the CMCD header shards appended. * * @public * * @example * {@includeCode ../test/appendCmcdHeaders.test.ts#example} * * @see {@link https://cta-wave.github.io/Resources/common-media-client-data--cta-5004-b.html#header-field-definition | CTA-5004-B Header Field Definition} */ declare function appendCmcdHeaders(headers: Record, cmcd: Cmcd, options?: CmcdEncodeOptions): Record; //#endregion //#region src/appendCmcdQuery.d.ts /** * Append CMCD query args to a URL. * * @param url - The URL to append to. * @param cmcd - The CMCD object to append. * @param options - Options for encoding the CMCD object. * * @returns The URL with the CMCD query args appended. * * @public * * @example * {@includeCode ../test/appendCmcdQuery.test.ts#example} * * @see {@link https://cta-wave.github.io/Resources/common-media-client-data--cta-5004-b.html#query-argument-definition | CTA-5004-B Query Argument Definition} */ declare function appendCmcdQuery(url: string, cmcd: Cmcd, options?: CmcdEncodeOptions): string; //#endregion //#region src/CMCD_DEFAULT_TIME_INTERVAL.d.ts /** * The default time interval in seconds when using using event mode * * @public */ declare const CMCD_DEFAULT_TIME_INTERVAL = 30; //#endregion //#region src/CMCD_EVENT_KEYS.d.ts /** * Defines the event-specific keys for CMCD (Common Media Client Data) version 2. * * @public */ declare const CMCD_EVENT_KEYS: readonly ["cen", "e", "h", "ts"]; //#endregion //#region src/CMCD_FORMATTER_MAP.d.ts /** * The default formatters for CMCD values. * * @public */ declare const CMCD_FORMATTER_MAP: Record; //#endregion //#region src/CmcdRequestKey.d.ts /** * A CMCD request key. * * @public */ type CmcdRequestKey = keyof CmcdRequest | "nrr"; //#endregion //#region src/CMCD_HEADER_MAP.d.ts /** * The map of CMCD keys to their appropriate header shard. * * Note: Event-only keys (e, ts, cen, h) and response-received keys * (rc, ttfb, ttlb, url, etc.) are intentionally absent. They are * transmitted via the event-mode POST body, not HTTP headers. * * @public */ declare const CMCD_HEADER_MAP: Record; //#endregion //#region src/CMCD_KEYS.d.ts /** * A list of all CMCD keys. * * @public */ declare const CMCD_KEYS: CmcdKey[]; //#endregion //#region src/CMCD_MIME_TYPE.d.ts /** * CMCD MIME type for event report payloads. * * @public */ declare const CMCD_MIME_TYPE = "application/cmcd"; //#endregion //#region src/CMCD_PARAM.d.ts /** * CMCD parameter name. * * @public */ declare const CMCD_PARAM = "CMCD"; //#endregion //#region src/CMCD_REQUEST_KEYS.d.ts /** * Defines the request-specific keys for CMCD (Common Media Client Data) version 2. * * @public */ 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"]; //#endregion //#region src/CMCD_RESPONSE_KEYS.d.ts /** * CMCD v2 - Response-only and timing keys. * * @public */ declare const CMCD_RESPONSE_KEYS: readonly ["cmsdd", "cmsds", "rc", "smrt", "ttfb", "ttfbb", "ttlb", "url"]; //#endregion //#region src/CMCD_V1_KEYS.d.ts /** * Defines the keys for CMCD (Common Media Client Data) version 1. * * @public */ declare const CMCD_V1_KEYS: readonly ["bl", "br", "bs", "cid", "d", "dl", "mtp", "nor", "nrr", "ot", "pr", "rtp", "sf", "sid", "st", "su", "tb", "v"]; //#endregion //#region src/CmcdData.d.ts /** * CMCD version 1 data. * * Overrides keys whose types differ in version 1 (e.g., `bl` and `br` * are plain integers instead of inner lists). * * @public */ type CmcdV1Data = Omit & CmcdV1 & { v?: 1; }; /** * CMCD version 2 data. * * Includes all request, event, and response mode keys with version 2 * types. * * @public */ type CmcdV2Data = Omit & { v: 2; }; /** * A CMCD data object that is either version 1 or version 2. * * The `v` property acts as a discriminator: * * - When `v` is `2`, the type narrows to {@link CmcdV2Data} with * inner-list values and event/response keys. * - When `v` is `1` or absent, the type narrows to {@link CmcdV1Data} * with scalar values. * * @example * ```ts * function process(data: CmcdData) { * if (data.v === 2) { * // data.bl is CmcdObjectTypeList | undefined * } else { * // data.bl is number | undefined * } * } * ``` * * @public */ type CmcdData = CmcdV1Data | CmcdV2Data; //#endregion //#region src/CmcdValidationSeverity.d.ts /** * CMCD validation severity level: error. * * @public */ declare const CMCD_VALIDATION_SEVERITY_ERROR: "error"; /** * CMCD validation severity level: warning. * * @public */ declare const CMCD_VALIDATION_SEVERITY_WARNING: "warning"; /** * CMCD validation severity level. * * @public */ declare const CmcdValidationSeverity: { readonly ERROR: typeof CMCD_VALIDATION_SEVERITY_ERROR; readonly WARNING: typeof CMCD_VALIDATION_SEVERITY_WARNING; }; /** * CMCD validation severity level. * * @public */ type CmcdValidationSeverity = ValueOf; //#endregion //#region src/CmcdValidationIssue.d.ts /** * Describes a single validation issue found in a CMCD payload. * * @public */ type CmcdValidationIssue = { /** * The CMCD key associated with the issue, or undefined for * structural issues. */ key?: string; /** * A human-readable description of the issue. */ message: string; /** * The severity of the issue. */ severity: CmcdValidationSeverity; }; //#endregion //#region src/CmcdValidationResult.d.ts /** * The result of validating a CMCD payload. * * @public */ type CmcdValidationResult = { /** Whether the payload is valid. True if there are zero errors * (warnings are acceptable). */ valid: boolean; /** * The list of validation issues found. */ issues: CmcdValidationIssue[]; }; //#endregion //#region src/CmcdDataValidationResult.d.ts /** * The result of validating a single CMCD payload (headers or query). * * Extends {@link CmcdValidationResult} with the decoded {@link CmcdData}. * * @public */ type CmcdDataValidationResult = CmcdValidationResult & { /** * The decoded CMCD data. */ data: CmcdData; }; //#endregion //#region src/CmcdDecodeOptions.d.ts /** * Options for decoding CMCD data. * * @public */ type CmcdDecodeOptions = { /** * When `true`, up-converts version 1 data to version 2 format by wrapping * scalar values in arrays for inner-list keys (e.g., `bl`, `br`, `mtp`). * * This ensures a consistent data shape regardless of the source version, * mirroring the down-conversion that occurs during encoding. * * @defaultValue false */ convertToLatest?: boolean; }; //#endregion //#region src/CmcdReportConfig.d.ts /** * Configuration for a CMCD report. * * @public */ type CmcdReportConfig = { /** * The version of the CMCD specification to use. * * @defaultValue `CMCD_V2` */ version?: CmcdVersion; /** * The list of CMCD keys to include in the report. If not provided, * no keys will be reported, unless there are other configuration * options that require keys to be reported, specifically in event mode. * * @defaultValue `undefined` */ enabledKeys?: CmcdKey[]; }; //#endregion //#region src/CmcdEventReportConfig.d.ts /** * Configuration for a CMCD event report. * * @public */ type CmcdEventReportConfig = CmcdReportConfig & { /** * The version of the CMCD protocol to use. Must be * version 2 or higher for event reporting. * * @defaultValue `CMCD_V2` */ version?: typeof CMCD_V2; /** * The URL to which the CMCD event should be sent. */ url: string; /** * The events to report. If no events are provided, * the event target will be effectively disabled. * * @defaultValue `undefined` */ events?: CmcdEventType[]; /** * When the time interval event is sent, the interval at which the * events should be reported as a number of seconds. * * @defaultValue `CMCD_DEFAULT_TIME_INTERVAL` * * @see {@link CMCD_DEFAULT_TIME_INTERVAL} */ interval?: number; /** * The number of events to batch before sending the report. * * @defaultValue `1` */ batchSize?: number; }; //#endregion //#region src/CmcdEventsValidationResult.d.ts /** * The result of validating a multi-line CMCD event payload. * * Extends {@link CmcdValidationResult} with an array of decoded * {@link CmcdData} objects, one per event line. * * @public */ type CmcdEventsValidationResult = CmcdValidationResult & { /** * The decoded CMCD data, one entry per event line. */ data: CmcdData[]; }; //#endregion //#region src/CmcdHeaderKey.d.ts /** * A CMCD header key. * * @public */ type CmcdHeaderKey = keyof typeof CMCD_HEADER_MAP; //#endregion //#region src/CmcdHeaderValue.d.ts /** * CMCD header value * * @public */ type CmcdHeaderValue = CmcdRequest | CmcdV1; //#endregion //#region src/CmcdRecordedReportMode.d.ts /** * CMCD query reporting mode — CMCD data carried as a `CMCD=` URL * query parameter. * * @public */ declare const CMCD_RECORDED_REPORT_MODE_QUERY: "query"; /** * CMCD header reporting mode — CMCD data carried as `Cmcd-*` HTTP * headers. * * @public */ declare const CMCD_RECORDED_REPORT_MODE_HEADER: "header"; /** * CMCD event reporting mode — CMCD data carried as a POST body to an * event-target URL. * * @public */ declare const CMCD_RECORDED_REPORT_MODE_EVENT: "event"; /** * Reporting mode under which a captured report was observed by * `CmcdReportRecorder`. * * @enum * * @public */ declare const CmcdRecordedReportMode: { readonly QUERY: typeof CMCD_RECORDED_REPORT_MODE_QUERY; readonly HEADER: typeof CMCD_RECORDED_REPORT_MODE_HEADER; readonly EVENT: typeof CMCD_RECORDED_REPORT_MODE_EVENT; }; /** * @public */ type CmcdRecordedReportMode = ValueOf; //#endregion //#region src/CmcdRecordedRequestType.d.ts /** * Manifest or playlist request classification. * * @public */ declare const CMCD_RECORDED_REQUEST_TYPE_MANIFEST: "manifest"; /** * Media segment request classification. * * @public */ declare const CMCD_RECORDED_REQUEST_TYPE_SEGMENT: "segment"; /** * CMCD event-mode report request classification (POST to a URL in * `eventTargetUrls`). * * @public */ declare const CMCD_RECORDED_REQUEST_TYPE_EVENT: "event"; /** * Fallback classification for requests the recorder did not recognize * as manifest, segment, or event. * * @public */ declare const CMCD_RECORDED_REQUEST_TYPE_UNKNOWN: "unknown"; /** * Classification of a captured request, used by `CmcdReportRecorder` * for filtering. * * @enum * * @public */ declare const CmcdRecordedRequestType: { readonly MANIFEST: typeof CMCD_RECORDED_REQUEST_TYPE_MANIFEST; readonly SEGMENT: typeof CMCD_RECORDED_REQUEST_TYPE_SEGMENT; readonly EVENT: typeof CMCD_RECORDED_REQUEST_TYPE_EVENT; readonly UNKNOWN: typeof CMCD_RECORDED_REQUEST_TYPE_UNKNOWN; }; /** * @public */ type CmcdRecordedRequestType = ValueOf; //#endregion //#region src/CmcdRecordedReport.d.ts /** * A CMCD report captured by `CmcdReportRecorder`, normalized to * `HttpRequest` regardless of the transport that produced it. * * @public */ type CmcdRecordedReport = { /** * The captured request that carried the CMCD report, normalized to * {@link @svta/cml-utils!HttpRequest | HttpRequest}. Headers are * lowercase-keyed; bodies are eagerly read as strings. */ readonly request: HttpRequest; /** * Classification of the underlying request (manifest / segment / event / unknown). */ readonly type: CmcdRecordedRequestType; /** * Reporting mode under which the CMCD data was carried: * `'query'` for `CMCD=` URL parameter, `'header'` for `Cmcd-*` * HTTP headers, `'event'` for an event-target POST body. */ readonly reportingMode: CmcdRecordedReportMode; /** * Wall-clock millisecond timestamp from `Date.now()` at capture time. */ readonly timestamp: number; }; //#endregion //#region src/CmcdTransportAdapter.d.ts /** * Callback the recorder supplies to a transport adapter. The adapter * calls this once per intercepted request, with the request normalized * to {@link @svta/cml-utils!HttpRequest | HttpRequest}. * * If the callback returns a `Response`, the adapter must short-circuit * the underlying transport and complete the request with that response * (used for event-target POST stubbing). * * If the callback returns `undefined`, the adapter forwards the request * to the original transport unchanged. * * @public */ type CmcdRequestDeliver = (request: HttpRequest) => Response | undefined; /** * Pluggable transport-interception contract for `CmcdReportRecorder`. * The default implementations (`createXhrTransport`, `createFetchTransport`) * patch global `XMLHttpRequest` and `fetch`. Custom adapters can wrap * other transports (e.g. `undici`, a player-internal HTTP client). * * @public */ type CmcdTransportAdapter = { /** * Install the transport's interception hook. Called once per * recorder `attach()`. The adapter must normalize each outgoing * request to `HttpRequest` (reading the body to a synchronous value * if necessary) and invoke `deliver`. Returns a detach function that * restores the original transport. */ attach(deliver: CmcdRequestDeliver): () => void; }; //#endregion //#region src/CmcdReportRecorderOptions.d.ts /** * Options for `CmcdReportRecorder.attach()`. * * @public */ type CmcdReportRecorderOptions = { /** * URLs whose POST requests are intercepted and stubbed with a * synthetic 204 response, instead of being passed through to the * network. A request matches if its URL starts with any entry. * * Use this to verify CMCD event-mode reports without making real * network calls to placeholder endpoints. */ eventTargetUrls?: readonly string[]; /** * Override the default set of transport adapters. Defaults to * `[createXhrTransport(), createFetchTransport()]`, which patches * `XMLHttpRequest` and `fetch` on the current realm. * * Supply this when the player under test uses a non-standard * transport (e.g. a custom HTTP client). */ transports?: readonly CmcdTransportAdapter[]; /** * Default timeout (in milliseconds) applied to every `waitFor*` * call on this recorder. Individual call sites can still pass * an explicit timeout to override per call. * * @defaultValue `15000` */ waitTimeout?: number; /** * Called once for each captured CMCD report, immediately after it * is appended to the buffer and before any pending `waitFor*` * promises resolve. Use for live UI inspection in test harness * pages. Cleared automatically on `detach()`; pass a fresh * callback to a subsequent `attach()` to resume notification. * * The callback receives the same {@link CmcdRecordedReport} * shape that `getReports()` returns. Filter by `report.type` or * `report.reportingMode` inside the callback if you only care * about a subset. * * @example * {@includeCode ../test/CmcdReportRecorder.test.ts#example-on-report} */ onReport?: (report: CmcdRecordedReport) => void; }; //#endregion //#region src/CmcdReportRecorderWaitOptions.d.ts /** * Options for the `waitFor*` methods on * {@link CmcdReportRecorder | CmcdReportRecorder}. * * @public */ type CmcdReportRecorderWaitOptions = { /** * Minimum number of matching reports the call should resolve with. * * @defaultValue `1` */ count?: number; /** * Maximum time to wait (in milliseconds) before rejecting. Falls * back to the recorder's `waitTimeout` attach option (15000 ms if * unset). */ timeout?: number; }; //#endregion //#region src/CmcdReportRecorder.d.ts /** * Test helper that records CMCD-bearing reports across XHR and fetch * transports for assertion in e2e tests. Each captured request is * normalized to {@link @svta/cml-utils!HttpRequest | HttpRequest} so * tests are identical regardless of which transport the player uses. * * @example * {@includeCode ../test/CmcdReportRecorder.test.ts#example} * * @public */ declare class CmcdReportRecorder { #private; /** * Install transport patches and begin recording CMCD reports. * No-op if already attached — the previously supplied options are * retained and the new `options` argument is silently ignored. * Call `detach()` first if you need to re-attach with different * options. * * @public */ attach(options?: CmcdReportRecorderOptions): void; /** * Remove transport patches and stop recording. Rejects any pending * wait promises with `Error('Recorder detached while waiting')`. * * @public */ detach(): void; /** * Discard all recorded reports. Does not affect the attached state. * * @public */ clear(): void; /** * Return a defensive copy of all recorded reports. * * @public */ getReports(): CmcdRecordedReport[]; /** * Wait until at least `count` reports of any type are recorded. * Resolves with all matching reports; rejects with a diagnostic error * on timeout. `count` defaults to 1; `timeout` falls back to the * recorder's `waitTimeout` option (default 15000 ms). * * @public */ waitForReports(options?: CmcdReportRecorderWaitOptions): Promise; /** * Wait until at least `count` manifest reports are recorded. * Resolves with all matching reports; rejects with a diagnostic error * on timeout. `count` defaults to 1; `timeout` falls back to the * recorder's `waitTimeout` option (default 15000 ms). * * @public */ waitForManifest(options?: CmcdReportRecorderWaitOptions): Promise; /** * Wait until at least `count` segment reports are recorded. * Resolves with all matching reports; rejects with a diagnostic error * on timeout. `count` defaults to 1; `timeout` falls back to the * recorder's `waitTimeout` option (default 15000 ms). * * @public */ waitForSegments(options?: CmcdReportRecorderWaitOptions): Promise; /** * Wait until at least `count` event-mode reports are recorded. * Resolves with all matching reports; rejects with a diagnostic error * on timeout. `count` defaults to 1; `timeout` falls back to the * recorder's `waitTimeout` option (default 15000 ms). * * @public */ waitForEvents(options?: CmcdReportRecorderWaitOptions): Promise; } //#endregion //#region src/CmcdTransmissionMode.d.ts /** * CMCD `query` transmission mode. * * @public */ declare const CMCD_QUERY: "query"; /** * CMCD `headers` transmission mode. * * @public */ declare const CMCD_HEADERS: "headers"; /** * CMCD `json` transmission mode. * * @public * * @deprecated JSON transmission mode is deprecated and will be removed in future versions. */ declare const CMCD_JSON: "json"; /** * CMCD transmission modes. * * @enum * * @public */ declare const CmcdTransmissionMode: { /** * JSON * * @deprecated JSON transmission mode is deprecated and will be removed in future versions. */ readonly JSON: typeof CMCD_JSON; /** * Query string */ readonly QUERY: typeof CMCD_QUERY; /** * Request headers */ readonly HEADERS: typeof CMCD_HEADERS; }; /** * @public */ type CmcdTransmissionMode = ValueOf; //#endregion //#region src/CmcdRequestReportConfig.d.ts /** * Configuration for a CMCD request report. * * @public */ type CmcdRequestReportConfig = CmcdReportConfig & { /** * The transmission mode to use. * * @defaultValue `CmcdTransmissionMode.QUERY` */ transmissionMode?: CmcdTransmissionMode; }; //#endregion //#region src/CmcdReporterConfig.d.ts /** * Configuration for a CMCD reporting component. * * @public */ type CmcdReporterConfig = CmcdRequestReportConfig & { /** * The session ID. If not provided, a new random session ID will be generated. * * @defaultValue `undefined` */ sid?: string; /** * The content ID. * * @defaultValue `undefined` */ cid?: string; /** * The event configurations. If not provided, no events will be reported. * * @defaultValue `undefined` */ eventTargets?: CmcdEventReportConfig[]; }; //#endregion //#region src/CmcdRequestReport.d.ts /** * A report of a CMCD request. * * @public */ type CmcdRequestReport = HttpRequest & { customData: { cmcd: Cmcd; } & D; headers: Record; }; //#endregion //#region src/CmcdReporter.d.ts /** * The CMCD reporter. * * @see {@link https://cta-wave.github.io/Resources/common-media-client-data--cta-5004-b.html#reporting-modes-when-we-send-data | CTA-5004-B Reporting Modes} * * @public */ declare class CmcdReporter { private timeOrigin; private data; private config; private msd; private eventTargets; private lastEmitted; private requestTarget; private requester; /** * Creates a new CMCD reporter. * * @param config - The configuration for the CMCD reporter. * @param requester - The function to use to send the request. * The default is a simple wrapper around the * native `fetch` API. */ constructor(config: Partial, requester?: (request: HttpRequest) => Promise<{ status: number; }>); /** * Starts the CMCD reporter. Called by the player when the reporter is enabled. * * Note: This fires an initial time-interval event immediately (synchronously) * before the first interval elapses. Ensure CMCD data (sid, cid, etc.) is * populated before calling start(). */ start(): void; /** * Stops the CMCD reporter. Called by the player when the reporter is disabled. * * @param flush - Whether to flush the event targets. */ stop(flush?: boolean): void; /** * Forces the sending of all event reports, regardless of the batch size or interval. * Useful for sending outstanding reports when the player is destroyed or a playback * session ends. */ flush(): void; /** * Updates the CMCD data. * * Called by the player when data changes. For tracked state fields * (`sta`, `pr`, `cid`, `bg`, `br`), if the new value differs from the * last-reported value (the value most recently emitted on the wire for * that field), the corresponding state-change event is automatically * fired. Comparing against the last-reported value (rather than the * previous persisted value) ensures the first state-change event in a * new session always emits, even when the persisted value didn't change * across the `sid` boundary. * * Multi-field updates fire multiple events in the order: `sta` → `pr` → * `cid` → `bg` → `br`. The order of keys in the input object does not * affect the firing order. * * To attach snapshot context (e.g., `bl`, `mtp`, `pt`, `ltc`) to a * state-change event, ensure those fields are in the reporter's data * before the state field changes. Either include them alongside the * state field in the same `update()` call, or persist them via earlier * `update()` calls — auto-fired events emit whatever is currently in * the persistent data store. This is also how to keep `TIME_INTERVAL` * reports useful — those events draw from the persistent data store * with no caller hook for per-event data, so fields the player wants * in periodic reports must be kept fresh here. * * A `sid` change resets the dedup baseline. * * @param data - The data to update. */ update(data: Partial): void; /** * Records an event. Called by the player when an event occurs. * * For state-change events (`PLAY_STATE`, `PLAYBACK_RATE`, `CONTENT_ID`, * `BACKGROUNDED_MODE`, `BITRATE_CHANGE`), this method: * 1. Persists the dedup field from `data` (if present) into the reporter's * persistent data store — equivalent to a write-through `update()`. * 2. Drops the event entirely if the dedup field has no value after the * write-through (never set, or cleared via `update({ field: undefined })`). * State-change events without their required field would violate CTA-5004-B. * 3. Suppresses the event if the field's current value matches the * last-emitted value (no state transition). * * For all other event types, the event is always emitted. * * For state-change events, prefer {@link CmcdReporter.update} — including * for snapshot enrichment via a combined call like * `update({ sta: 'p', bl: [3000], mtp: [8500] })`. Calling `recordEvent()` * for a state-change event after `update()` has already auto-fired it * silently drops the second call's `data`, because dedup suppresses the * second emission. * * Use `recordEvent()` directly for events whose payload is intrinsic to * the event call — `CUSTOM_EVENT` with `cen`, `ERROR` with `ec`, * ad-lifecycle events, `MUTE`/`UNMUTE`, `PLAYER_EXPAND`/`PLAYER_COLLAPSE`, * `SKIP`. For `RESPONSE_RECEIVED`, prefer * {@link CmcdReporter.recordResponseReceived}, which derives the * per-response fields automatically. * * @param type - The type of event to record. * @param data - Additional data to record with the event. This data * only applies to this event report, except for the dedup * field of a state-change event, which is also persisted * into the reporter's data store. */ recordEvent(type: CmcdEventType, data?: Partial): void; /** * Records an event for a target. Called by the reporter when an event occurs. * * @param target - The target to record the event for. * @param config - The configuration for the target. * @param type - The type of event to record. * @param data - Additional data to record with the event. This data * only applies to this event report. Persistent data should * be updated using `update()`. */ private recordTargetEvent; /** * Records a response-received event. Called by the player when a media * request response has been fully received. * * This method automatically derives the `rr` event keys from the * * - `url` - the original requested URL (before any redirects) * - `rc` - the HTTP response status code * - `ts` - the request initiation time (from `resourceTiming.startTime`) * - `ttfb` - time to first byte (from `resourceTiming.responseStart`) * - `ttlb` - time to last byte (from `resourceTiming.duration`) * * Additional keys like `ttfbb`, `cmsdd`, `cmsds`, and `smrt` can be * supplied via the `data` parameter if the player has access to them. * * @param response - The HTTP response received. * @param data - Additional CMCD data to include with the event. * Values provided here override any auto-derived values. */ recordResponseReceived(response: HttpResponse>, data?: Partial): void; /** * Applies the CMCD request report data to the request. Called by the player * before sending the request. * * @param req - The request to apply the CMCD request report to. * @returns The request with the CMCD request report applied. * * @deprecated Use {@link CmcdReporter.createRequestReport} instead. */ applyRequestReport(req: HttpRequest): HttpRequest; /** * Checks if the request reporting is enabled. * * @returns `true` if the request reporting is enabled, `false` otherwise. */ isRequestReportingEnabled(): boolean; /** * Creates a new request with the CMCD request report data applied. Called by the player * before sending the request. * * @param request - The request to apply the CMCD request report to. * @param data - The data to apply to the request. This data only * applies to this request report. Persistent data * should be updated using `update()`. * @returns The request with the CMCD request report applied. */ createRequestReport(request: R, data?: Partial): R & CmcdRequestReport; /** * Processes the event targets. Called by the reporter when an event occurs. * * @param flush - Whether to flush the event targets. */ private processEventTargets; /** * Sends an event report. Called by the reporter when a batch is ready to be sent. * * @param config - The target config to send the event report to. * @param data - The data to send in the event report. */ private sendEventReport; /** * Cancels the time-interval timer for an event target and clears the stored id. * Safe to call when no timer is armed (clearInterval(undefined) is a no-op). */ private disarmInterval; /** * Permanently removes an event target: cancels its timer and removes it from the * eventTargets map. Used when the collector signals the target is gone (HTTP 410). */ private disposeEventTarget; /** * Resets the session related data. Called when the session ID changes. */ private resetSession; } //#endregion //#region src/CmcdValidationOptions.d.ts /** * Options for CMCD validation functions. * * @public */ type CmcdValidationOptions = { /** * Explicit CMCD version override. If not provided, the version is * inferred from the payload's `v` key, defaulting to 1. */ version?: CmcdVersion; /** * The reporting mode of the payload. */ reportingMode?: CmcdReportingMode; }; //#endregion //#region src/createFetchTransport.d.ts /** * Create a transport adapter that patches `globalThis.fetch` to capture * CMCD-bearing requests, normalizing each to `HttpRequest` (lowercase * headers, body read as UTF-8 string). Returns the adapter object * expected by `CmcdReportRecorder`. * * Bodies are read once via `Request.text()` for inspection. This is * safe for the body types CMCD reports use in practice (`string`, * `Blob`, `ArrayBuffer`, `FormData`, `URLSearchParams`), which can be * read by the wrapper and re-read by the underlying `fetch`. Passing * a `ReadableStream` as `init.body` is not supported — the stream is * consumed by the wrapper and the underlying `fetch` will receive an * already-disturbed stream. * * @public */ declare function createFetchTransport(): CmcdTransportAdapter; //#endregion //#region src/createXhrTransport.d.ts /** * Create a transport adapter that patches `XMLHttpRequest.prototype` to * capture CMCD-bearing requests. Returns the adapter object expected by * `CmcdReportRecorder`. * * @public */ declare function createXhrTransport(): CmcdTransportAdapter; //#endregion //#region src/decodeCmcd.d.ts /** * Decode a CMCD string to an object. * * @param cmcd - The CMCD string to decode. * @param options - Options for decoding. * * @returns The decoded CMCD object. * * @see {@link https://cta-wave.github.io/Resources/common-media-client-data--cta-5004-b.html#payload-definition-for-headers-and-query-argument-transmission | CTA-5004-B Payload Definition} * * @public * * @example * {@includeCode ../test/decodeCmcd.test.ts#example} */ declare function decodeCmcd(cmcd: string, options: CmcdDecodeOptions & { convertToLatest: true; }): Cmcd; declare function decodeCmcd(cmcd: string, options?: CmcdDecodeOptions): T; //#endregion //#region src/encodeCmcd.d.ts /** * Encode a CMCD object to a string. * * @param cmcd - The CMCD object to encode. * @param options - Options for encoding. * * @returns The encoded CMCD string. * * @see {@link https://cta-wave.github.io/Resources/common-media-client-data--cta-5004-b.html#payload-definition-for-headers-and-query-argument-transmission | CTA-5004-B Payload Definition} * * @public * * @example * {@includeCode ../test/encodeCmcd.test.ts#example} */ declare function encodeCmcd(cmcd: Cmcd, options?: CmcdEncodeOptions): string; //#endregion //#region src/fromCmcdHeaders.d.ts /** * Decode CMCD data from request headers. * * @param headers - The request headers to decode. * @param options - Options for decoding. * * @returns The decoded CMCD data. * * @see {@link https://cta-wave.github.io/Resources/common-media-client-data--cta-5004-b.html#header-field-definition | CTA-5004-B Header Field Definition} * * @public * * @example * {@includeCode ../test/fromCmcdHeaders.test.ts#example} */ declare function fromCmcdHeaders(headers: Record | Headers, options: CmcdDecodeOptions & { convertToLatest: true; }): Cmcd; declare function fromCmcdHeaders(headers: Record | Headers, options?: CmcdDecodeOptions): CmcdData; //#endregion //#region src/fromCmcdQuery.d.ts /** * Decode CMCD data from a query string. * * @param query - The query string to decode. * @param options - Options for decoding. * * @returns The decoded CMCD data. * * @see {@link https://cta-wave.github.io/Resources/common-media-client-data--cta-5004-b.html#query-argument-definition | CTA-5004-B Query Argument Definition} * * @public * * @example * {@includeCode ../test/fromCmcdQuery.test.ts#example} */ declare function fromCmcdQuery(query: string | URLSearchParams, options: CmcdDecodeOptions & { convertToLatest: true; }): Cmcd; declare function fromCmcdQuery(query: string | URLSearchParams, options?: CmcdDecodeOptions): CmcdData; //#endregion //#region src/fromCmcdUrl.d.ts /** * Decode CMCD data from a url encoded string. * * @param url - The url encoded string to decode. * @param options - Options for decoding. * * @returns The decoded CMCD data. * * @see {@link https://cta-wave.github.io/Resources/common-media-client-data--cta-5004-b.html#query-argument-definition | CTA-5004-B Query Argument Definition} * * @public * * @example * {@includeCode ../test/fromCmcdUrl.test.ts#example} */ declare function fromCmcdUrl(url: string, options: CmcdDecodeOptions & { convertToLatest: true; }): Cmcd; declare function fromCmcdUrl(url: string, options?: CmcdDecodeOptions): CmcdData; //#endregion //#region src/groupCmcdHeaders.d.ts /** * Group a CMCD data object into header shards * * @param cmcd - The CMCD data object to convert. * @param customHeaderMap - A map of CMCD header fields to custom CMCD keys. * * @returns The CMCD header shards. * * @see {@link https://cta-wave.github.io/Resources/common-media-client-data--cta-5004-b.html#header-field-definition | CTA-5004-B Header Field Definition} * * @public */ declare function groupCmcdHeaders(cmcd: Cmcd, customHeaderMap?: Partial): Record; //#endregion //#region src/isCmcdCustomKey.d.ts /** * Check if a key is a custom key. * * @param key - The key to check. * * @returns `true` if the key is a custom key, `false` otherwise. * * @public * * @example * {@includeCode ../test/isCmcdCustomKey.test.ts#example} */ declare function isCmcdCustomKey(key: CmcdKey): boolean; //#endregion //#region src/isCmcdEventKey.d.ts /** * Check if a key is a valid CMCD event key. * * @param key - The key to check. * * @returns `true` if the key is a valid CMCD event key, `false` otherwise. * * @public * * @example * {@includeCode ../test/isCmcdEventKey.test.ts#example} */ declare function isCmcdEventKey(key: string): key is keyof Cmcd; //#endregion //#region src/isCmcdRequestKey.d.ts /** * Check if a key is a valid CMCD request key. * * @param key - The key to check. * * @returns `true` if the key is a valid CMCD request key, `false` otherwise. * * @public * * @example * {@includeCode ../test/isCmcdRequestKey.test.ts#example} */ declare function isCmcdRequestKey(key: string): key is keyof Cmcd; //#endregion //#region src/isCmcdResponseReceivedKey.d.ts /** * Check if a key is a valid CMCD response key. * * @param key - The key to check. * * @returns `true` if the key is a valid CMCD request key, `false` otherwise. * * @public * * @example * {@includeCode ../test/isCmcdResponseReceivedKey.test.ts#example} */ declare function isCmcdResponseReceivedKey(key: string): key is keyof Cmcd; //#endregion //#region src/isCmcdV1Data.d.ts /** * Check if a CMCD data object is version 1. * * @param data - The CMCD data object to check. * * @returns `true` if the data is version 1, `false` otherwise. * * @public * * @example * {@includeCode ../test/isCmcdV1Data.test.ts#example} */ declare function isCmcdV1Data(data: CmcdData): data is CmcdV1Data; //#endregion //#region src/isCmcdV1Key.d.ts /** * Filter function for CMCD v1 keys. * * @param key - The CMCD key to filter. * * @returns `true` if the key should be included, `false` otherwise. * * @public * * @example * {@includeCode ../test/isCmcdV1Key.test.ts#example} */ declare function isCmcdV1Key(key: string): key is CmcdKey; //#endregion //#region src/isCmcdV2Data.d.ts /** * Check if a CMCD data object is version 2. * * @param data - The CMCD data object to check. * * @returns `true` if the data is version 2, `false` otherwise. * * @public * * @example * {@includeCode ../test/isCmcdV2Data.test.ts#example} */ declare function isCmcdV2Data(data: CmcdData): data is CmcdV2Data; //#endregion //#region src/prepareCmcdData.d.ts /** * Convert a generic object to CMCD data. * * @param obj - The CMCD object to process. * @param options - Options for encoding. * * @public */ declare function prepareCmcdData(obj: Record, options?: CmcdEncodeOptions): Cmcd; //#endregion //#region src/toCmcdHeaders.d.ts /** * Convert a CMCD data object to request headers * * @param cmcd - The CMCD data object to convert. * @param options - Options for encoding the CMCD object. * * @returns The CMCD header shards. * * @see {@link https://cta-wave.github.io/Resources/common-media-client-data--cta-5004-b.html#header-field-definition | CTA-5004-B Header Field Definition} * * @public * * @example * {@includeCode ../test/toCmcdHeaders.test.ts#example} */ declare function toCmcdHeaders(cmcd: Cmcd, options?: CmcdEncodeOptions): Record; //#endregion //#region src/toCmcdQuery.d.ts /** * Convert a CMCD data object to a query arg. * * @param cmcd - The CMCD object to convert. * @param options - Options for encoding the CMCD object. * * @returns The CMCD query arg. * * @see {@link https://cta-wave.github.io/Resources/common-media-client-data--cta-5004-b.html#query-argument-definition | CTA-5004-B Query Argument Definition} * * @public * * @example * {@includeCode ../test/toCmcdQuery.test.ts#example} */ declare function toCmcdQuery(cmcd: Cmcd, options?: CmcdEncodeOptions): string; //#endregion //#region src/toCmcdUrl.d.ts /** * Convert a CMCD data object to a URL encoded string. * * @param cmcd - The CMCD object to convert. * @param options - Options for encoding the CMCD object. * * @returns The URL encoded CMCD data. * * @see {@link https://cta-wave.github.io/Resources/common-media-client-data--cta-5004-b.html#query-argument-definition | CTA-5004-B Query Argument Definition} * * @public */ declare function toCmcdUrl(cmcd: Cmcd, options?: CmcdEncodeOptions): string; //#endregion //#region src/toCmcdValue.d.ts /** * Convert a value to a CMCD value. * * @param value - The value to convert to a CMCD value. * @param params - The parameters to convert to a CMCD value. * @returns The CMCD value. * * @public */ declare function toCmcdValue(value: V, params?: P): SfItem; //#endregion //#region src/validateCmcd.d.ts /** * Validates a CMCD payload by checking keys, values, and structure. * * @example * {@includeCode ../test/validateCmcd.test.ts#example} * * @param data - The CMCD payload to validate. * @param options - Validation options. * @returns The validation result. * * @see {@link https://cta-wave.github.io/Resources/common-media-client-data--cta-5004-b.html#data-payload-definition-what-data-to-send | CTA-5004-B Data Payload Definition} * * @public */ declare function validateCmcd(data: Record, options?: CmcdValidationOptions): CmcdValidationResult; //#endregion //#region src/validateCmcdEventReport.d.ts /** * Validates a full HTTP request as an event-mode payload. * * Accepts an {@link @svta/cml-utils!HttpRequest | HttpRequest} object. * * This function validates that the request uses the POST method and has * the correct `Content-Type` header (`application/cmcd`) in addition to * validating the body content via {@link validateCmcdEvents}. * * @param request - An `HttpRequest` to validate. * @param options - Validation options (excluding `reportingMode`). * @returns The validation result including decoded data per event line. * * @example {@includeCode ../test/validateCmcdEventReport.test.ts#example} * * @see {@link https://cta-wave.github.io/Resources/common-media-client-data--cta-5004-b.html#event-mode | CTA-5004-B Event Mode} * * @public */ declare function validateCmcdEventReport(request: HttpRequest, options?: Omit): CmcdEventsValidationResult; //#endregion //#region src/validateCmcdEvents.d.ts /** * Validates a raw CMCD string as an event-mode payload. * * This function decodes the string internally and validates it with * `reportingMode` set to `'event'`. The input may contain multiple * newline-separated events (e.g. an `application/cmcd` POST body), in which * case each line is validated independently and the results are merged. * * @param cmcd - The raw CMCD-encoded string to validate. May contain * multiple newline-separated event lines. * @param options - Validation options (excluding `reportingMode`). * @returns The validation result including decoded data per event line. * * @example * {@includeCode ../test/validateCmcdEvents.test.ts#example} * * @see {@link https://cta-wave.github.io/Resources/common-media-client-data--cta-5004-b.html#body-definition | CTA-5004-B Body Definition} * * @public */ declare function validateCmcdEvents(cmcd: string, options?: Omit): CmcdEventsValidationResult; //#endregion //#region src/validateCmcdHeaders.d.ts /** * Validates CMCD HTTP headers by checking shard placement and payload validity. * * This function accepts raw CMCD header strings, decodes each shard * internally, verifies that each key is placed in its correct header shard, * then merges all shards and runs full payload validation (keys, values, and * structure) on the merged data. * * @example * {@includeCode ../test/validateCmcdHeaders.test.ts#example} * * @param headers - A `Headers` instance or a record of CMCD header fields to their raw encoded string values. * @param options - Validation options (excluding `reportingMode`). * @returns The validation result including decoded data. * * @see {@link https://cta-wave.github.io/Resources/common-media-client-data--cta-5004-b.html#header-field-definition | CTA-5004-B Header Field Definition} * * @public */ declare function validateCmcdHeaders(headers: Record | Headers, options?: Omit): CmcdDataValidationResult; //#endregion //#region src/validateCmcdKeys.d.ts /** * Validates that all keys in a CMCD payload are recognized spec keys or valid custom keys. * * @example * {@includeCode ../test/validateCmcdKeys.test.ts#example} * * @param data - The CMCD payload to validate. * @param options - Validation options. * @returns The validation result. * * @see {@link https://cta-wave.github.io/Resources/common-media-client-data--cta-5004-b.html#reserved-keys | CTA-5004-B Reserved Keys} * * @public */ declare function validateCmcdKeys(data: Record, options?: CmcdValidationOptions): CmcdValidationResult; //#endregion //#region src/validateCmcdRequest.d.ts /** * Validates CMCD data from a request as a request-mode payload. * * Accepts a * {@link https://developer.mozilla.org/en-US/docs/Web/API/Request | Request} * object or an {@link @svta/cml-utils!HttpRequest | HttpRequest} object. * * The function checks for CMCD data in the HTTP headers first. If CMCD * headers are found, validation includes shard-placement checks via * {@link validateCmcdHeaders}. Otherwise, the CMCD query parameter is * extracted from the URL and validated. * * @param request - A `Request` or `HttpRequest` to validate. * @param options - Validation options (excluding `reportingMode`). * @returns The validation result including decoded data. * * @example * {@includeCode ../test/validateCmcdRequest.test.ts#example} * * @see {@link https://cta-wave.github.io/Resources/common-media-client-data--cta-5004-b.html#request-mode | CTA-5004-B Request Mode} * * @public */ declare function validateCmcdRequest(request: Request | HttpRequest, options?: Omit): CmcdDataValidationResult; //#endregion //#region src/validateCmcdStructure.d.ts /** * Validates the structural rules of a CMCD payload. * * @example * {@includeCode ../test/validateCmcdStructure.test.ts#example} * * @param data - The CMCD payload to validate. * @param options - Validation options. * @returns The validation result. * * @see {@link https://cta-wave.github.io/Resources/common-media-client-data--cta-5004-b.html#data-payload-definition-what-data-to-send | CTA-5004-B Data Payload Definition} * * @public */ declare function validateCmcdStructure(data: Record, options?: CmcdValidationOptions): CmcdValidationResult; //#endregion //#region src/validateCmcdValues.d.ts /** * Validates that all values in a CMCD payload conform to the expected types and constraints. * * @example * {@includeCode ../test/validateCmcdValues.test.ts#example} * * @param data - The CMCD payload to validate. * @param options - Validation options. * @returns The validation result. * * @see {@link https://cta-wave.github.io/Resources/common-media-client-data--cta-5004-b.html#reserved-keys | CTA-5004-B Reserved Keys} * * @public */ declare function validateCmcdValues(data: Record, options?: CmcdValidationOptions): CmcdValidationResult; //#endregion 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_PLAYBACK_RATE, 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_HEADER_FIELDS, CMCD_HEADER_MAP, CMCD_JSON, CMCD_KEYS, CMCD_MIME_TYPE, CMCD_OBJECT, CMCD_PARAM, CMCD_QUERY, CMCD_RECORDED_REPORT_MODE_EVENT, CMCD_RECORDED_REPORT_MODE_HEADER, CMCD_RECORDED_REPORT_MODE_QUERY, CMCD_RECORDED_REQUEST_TYPE_EVENT, CMCD_RECORDED_REQUEST_TYPE_MANIFEST, CMCD_RECORDED_REQUEST_TYPE_SEGMENT, CMCD_RECORDED_REQUEST_TYPE_UNKNOWN, CMCD_REQUEST, CMCD_REQUEST_KEYS, CMCD_REQUEST_MODE, CMCD_RESPONSE_KEYS, CMCD_SESSION, CMCD_STATUS, CMCD_V1, CMCD_V1_KEYS, CMCD_V2, CMCD_VALIDATION_SEVERITY_ERROR, CMCD_VALIDATION_SEVERITY_WARNING, Cmcd, CmcdCustomKey, CmcdCustomValue, CmcdData, CmcdDataValidationResult, CmcdDecodeOptions, CmcdEncodeOptions, CmcdEvent, CmcdEventReportConfig, CmcdEventType, CmcdEventsValidationResult, CmcdFormatter, CmcdFormatterMap, CmcdFormatterOptions, CmcdHeaderField, CmcdHeaderKey, CmcdHeaderMap, CmcdHeaderValue, CmcdKey, CmcdObjectType, CmcdObjectTypeList, CmcdPlayerState, CmcdRecordedReport, CmcdRecordedReportMode, CmcdRecordedRequestType, CmcdReportConfig, CmcdReportRecorder, CmcdReportRecorderOptions, CmcdReportRecorderWaitOptions, CmcdReporter, CmcdReporterConfig, CmcdReportingMode, CmcdRequest, CmcdRequestDeliver, CmcdRequestKey, CmcdRequestReport, CmcdRequestReportConfig, CmcdResponse, CmcdStreamType, CmcdStreamingFormat, CmcdTransmissionMode, CmcdTransportAdapter, CmcdV1, CmcdV1Data, CmcdV2Data, CmcdValidationIssue, CmcdValidationOptions, CmcdValidationResult, CmcdValidationSeverity, CmcdValue, CmcdVersion, appendCmcdHeaders, appendCmcdQuery, createFetchTransport, createXhrTransport, decodeCmcd, encodeCmcd, fromCmcdHeaders, fromCmcdQuery, fromCmcdUrl, groupCmcdHeaders, isCmcdCustomKey, isCmcdEventKey, isCmcdRequestKey, isCmcdResponseReceivedKey, isCmcdV1Data, isCmcdV1Key, isCmcdV2Data, prepareCmcdData, toCmcdHeaders, toCmcdQuery, toCmcdUrl, toCmcdValue, validateCmcd, validateCmcdEventReport, validateCmcdEvents, validateCmcdHeaders, validateCmcdKeys, validateCmcdRequest, validateCmcdStructure, validateCmcdValues }; //# sourceMappingURL=index.d.ts.map