Skip to content

Commit

Permalink
Merge pull request #65 from THEOplayer/bugfix/conviva/live_vod
Browse files Browse the repository at this point in the history
Do no include streamType on NaN duration
  • Loading branch information
tvanlaerhoven authored Jan 23, 2025
2 parents 17a582c + a63012e commit f68aff5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .changeset/khaki-planes-end.md
Original file line number Diff line number Diff line change
@@ -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.
9 changes: 5 additions & 4 deletions conviva/src/integration/ConvivaHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit f68aff5

Please sign in to comment.