From 6f8c553d81b7fb291a9d619effd5a7dd16cf2ce9 Mon Sep 17 00:00:00 2001 From: Zenon Mousmoulas Date: Sat, 6 Apr 2024 12:20:19 +0300 Subject: [PATCH 1/2] Ensure CMCD query argument is replaced The query argument added by the CMCD connector is preserved in subsequent manifest/segment requests by THEOplayer, apparently leading to multiple CMCD arguments being accumulated, which is a problem as the URL grows indefinitely. Using URLSearchParams set method, rather than append, ensures that the first CMCD argument is updated (the rest are removed) or one is appended. --- .../QueryArgumentTransmissionModeStrategy.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmcd/src/TransmissionModeStrategies/QueryArgumentTransmissionModeStrategy.ts b/cmcd/src/TransmissionModeStrategies/QueryArgumentTransmissionModeStrategy.ts index 3dd7113d..3498c210 100644 --- a/cmcd/src/TransmissionModeStrategies/QueryArgumentTransmissionModeStrategy.ts +++ b/cmcd/src/TransmissionModeStrategies/QueryArgumentTransmissionModeStrategy.ts @@ -19,7 +19,7 @@ export class QueryArgumentTransmissionModeStrategy implements TransmissionModeSt const url = new URL(request.url); const parameters = transformToQueryParameters(payload); if (parameters) { - url.searchParams.append('CMCD', parameters); + url.searchParams.set('CMCD', parameters); request.redirect({ ...request, url: url.href From f7e112e8f246a6ef6f0428c9e12cf54d10c9e949 Mon Sep 17 00:00:00 2001 From: Mattias Buelens <649348+MattiasBuelens@users.noreply.github.com> Date: Tue, 9 Apr 2024 10:58:08 +0200 Subject: [PATCH 2/2] Add changeset --- .changeset/slow-melons-mix.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/slow-melons-mix.md diff --git a/.changeset/slow-melons-mix.md b/.changeset/slow-melons-mix.md new file mode 100644 index 00000000..ec66bef3 --- /dev/null +++ b/.changeset/slow-melons-mix.md @@ -0,0 +1,5 @@ +--- +"@theoplayer/cmcd-connector-web": patch +--- + +Fixed an issue where multiple CMCD query arguments were being added to the request URL.