diff --git a/.changeset/sixty-knives-do.md b/.changeset/sixty-knives-do.md new file mode 100644 index 00000000..15c20153 --- /dev/null +++ b/.changeset/sixty-knives-do.md @@ -0,0 +1,5 @@ +--- +"@theoplayer/cmcd-connector-web": minor +--- + +Disable CMCD for HESP requests diff --git a/cmcd/src/CMCDCollector.ts b/cmcd/src/CMCDCollector.ts index ffa286e7..e0a775ec 100644 --- a/cmcd/src/CMCDCollector.ts +++ b/cmcd/src/CMCDCollector.ts @@ -59,7 +59,7 @@ export class CMCDCollector { */ private handleCurrentSourceChange_ = (event: CurrentSourceChangeEvent) => { const currentSource = event.currentSource; - if (!currentSource) { + if (!currentSource || currentSource.type === 'application/vnd.theo.hesp+json') { this._streamingFormat = undefined; } else { this._streamingFormat = getStreamingFormatFromTypedSource(currentSource); @@ -138,9 +138,13 @@ export class CMCDCollector { /** * Collects all the CMCD parameters as supported by the connector depending on the provided {@link Request}. * @param request The request for which CMCD parameters should be collected. - * @returns A payload object containing keys for the provided request. + * @returns A payload object containing keys for the provided request or `undefined` if CMCD is not applicable for + * this request */ - collect(request: Request): CMCDPayload { + collect(request: Request): CMCDPayload | undefined { + if (this._streamingFormat === undefined) { + return; + } const sessionKeys = this.collectSessionKeys(); const requestKeys = this._config.sendRequestID ? { diff --git a/cmcd/src/CMCDConnector.ts b/cmcd/src/CMCDConnector.ts index 9721bd88..20643e26 100644 --- a/cmcd/src/CMCDConnector.ts +++ b/cmcd/src/CMCDConnector.ts @@ -62,6 +62,9 @@ export class CMCDConnector { } let payload = this._collector.collect(request); + if (payload === undefined) { + return; + } if (this._processor) { payload = this._processor(payload, request); }