Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable connector for HESP requests #59

Merged
merged 3 commits into from
Nov 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/sixty-knives-do.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@theoplayer/cmcd-connector-web": minor
---

Disable CMCD for HESP requests
10 changes: 7 additions & 3 deletions cmcd/src/CMCDCollector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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
? {
Expand Down
3 changes: 3 additions & 0 deletions cmcd/src/CMCDConnector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
23 changes: 12 additions & 11 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"prettier": "^3.2.4",
"rimraf": "^5.0.5",
"rollup": "^4.14.0",
"theoplayer": "^7.12.0",
"theoplayer": "^8.3.0",
"ts-jest": "^29.1.2",
"ts-node": "^10.9.2",
"tslib": "^2.6.2",
Expand Down