From 9c9e251d7c4275bc1b5ca59239e9c1f1e07710cc Mon Sep 17 00:00:00 2001 From: Tom Van Laerhoven Date: Tue, 21 Jan 2025 13:51:44 +0100 Subject: [PATCH 1/2] Do no include streamType on NaN duration --- conviva/src/integration/ConvivaHandler.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/conviva/src/integration/ConvivaHandler.ts b/conviva/src/integration/ConvivaHandler.ts index d2c474e..c5dcfd2 100644 --- a/conviva/src/integration/ConvivaHandler.ts +++ b/conviva/src/integration/ConvivaHandler.ts @@ -243,18 +243,19 @@ export class ConvivaHandler { private reportMetadata() { const src = this.player.src ?? ''; - const streamType = this.player.duration === Infinity ? Constants.StreamType.LIVE : Constants.StreamType.VOD; const assetName = this.customMetadata[Constants.ASSET_NAME] ?? this.convivaMetadata[Constants.ASSET_NAME] ?? this.currentSource?.metadata?.title ?? 'NA'; const playerName = this.customMetadata[Constants.PLAYER_NAME] ?? 'THEOplayer'; - const metadata = { + const hasDuration = !Number.isNaN(this.player.duration); + const isLive = Number.isFinite(this.player.duration) ? Constants.StreamType.VOD : Constants.StreamType.LIVE; + const metadata: ConvivaMetadata = { [Constants.STREAM_URL]: src, - [Constants.IS_LIVE]: streamType, [Constants.ASSET_NAME]: assetName, - [Constants.PLAYER_NAME]: playerName + [Constants.PLAYER_NAME]: playerName, + ...(!hasDuration ? {} : { [Constants.IS_LIVE]: isLive }) }; this.setContentInfo(metadata); } From a63012e8ca650de98783a1db1e136126b38f4b75 Mon Sep 17 00:00:00 2001 From: Tom Van Laerhoven Date: Tue, 21 Jan 2025 13:55:29 +0100 Subject: [PATCH 2/2] Add changeset --- .changeset/khaki-planes-end.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/khaki-planes-end.md diff --git a/.changeset/khaki-planes-end.md b/.changeset/khaki-planes-end.md new file mode 100644 index 0000000..159e7e8 --- /dev/null +++ b/.changeset/khaki-planes-end.md @@ -0,0 +1,5 @@ +--- +"@theoplayer/conviva-connector-web": patch +--- + +Fixed an issue where the stream type, either `VOD` or `Live`, would sometimes be set with a wrong value for live streams.