From 5487217ed3662a1e67961b2188790f796e3c78f0 Mon Sep 17 00:00:00 2001 From: Wonne Joosen Date: Fri, 29 Nov 2024 22:51:26 +0100 Subject: [PATCH 01/20] rename default device metadata helper --- conviva/src/utils/Utils.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conviva/src/utils/Utils.ts b/conviva/src/utils/Utils.ts index 7448c83..b9c669e 100644 --- a/conviva/src/utils/Utils.ts +++ b/conviva/src/utils/Utils.ts @@ -21,7 +21,7 @@ import { } from 'theoplayer'; import { ConvivaConfiguration } from '../integration/ConvivaHandler'; -export function collectDeviceMetadata(): ConvivaDeviceMetadata { +export function collectDefaultDeviceMetadata(): ConvivaDeviceMetadata { // Most device metadata is auto-collected by Conviva. return { [Constants.DeviceMetadata.CATEGORY]: Constants.DeviceCategory.WEB From ab04ab50e441d56d009d5fd83bce7f136f052000 Mon Sep 17 00:00:00 2001 From: Wonne Joosen Date: Fri, 29 Nov 2024 22:52:10 +0100 Subject: [PATCH 02/20] pass device metadata to conviva sdk if present --- conviva/src/integration/ConvivaHandler.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/conviva/src/integration/ConvivaHandler.ts b/conviva/src/integration/ConvivaHandler.ts index 93c3bf1..6a9195f 100644 --- a/conviva/src/integration/ConvivaHandler.ts +++ b/conviva/src/integration/ConvivaHandler.ts @@ -4,7 +4,8 @@ import { Analytics, Constants, type ConvivaMetadata, - type VideoAnalytics + type VideoAnalytics, + ConvivaDeviceMetadata, } from '@convivainc/conviva-js-coresdk'; import type { YospaceConnector } from '@theoplayer/yospace-connector-web'; import { CONVIVA_CALLBACK_FUNCTIONS } from './ConvivaCallbackFunctions'; @@ -12,7 +13,7 @@ import { calculateBufferLength, calculateConvivaOptions, collectContentMetadata, - collectDeviceMetadata, + collectDefaultDeviceMetadata, collectPlayerInfo, flattenErrorObject } from '../utils/Utils'; @@ -25,6 +26,7 @@ export interface ConvivaConfiguration { customerKey: string; debug?: boolean; gatewayUrl?: string; + deviceMetadata?: ConvivaDeviceMetadata; } export class ConvivaHandler { @@ -52,7 +54,7 @@ export class ConvivaHandler { this.convivaConfig = config; this.currentSource = player.source; - Analytics.setDeviceMetadata(collectDeviceMetadata()); + Analytics.setDeviceMetadata(this.convivaConfig.deviceMetadata ?? collectDefaultDeviceMetadata()); Analytics.init( this.convivaConfig.customerKey, CONVIVA_CALLBACK_FUNCTIONS, From 189bc31ad5982fc1a57cb94b47d96ec0b1a3336c Mon Sep 17 00:00:00 2001 From: Wonne Joosen Date: Fri, 29 Nov 2024 22:54:08 +0100 Subject: [PATCH 03/20] fix serve script --- conviva/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conviva/package.json b/conviva/package.json index 93a4b87..4672f41 100644 --- a/conviva/package.json +++ b/conviva/package.json @@ -21,7 +21,7 @@ "bundle": "rollup -c rollup.config.mjs", "watch": "npm run bundle -- --watch", "build": "npm run clean && npm run bundle", - "serve": "http-server", + "serve": "http-server ./.. -o /conviva/test/pages/main_umd.html", "test": "jest" }, "author": "THEO Technologies NV", From ae5275fde7e1e2e5c6f0f22747d3bac0873ab313 Mon Sep 17 00:00:00 2001 From: Wonne Joosen Date: Fri, 29 Nov 2024 22:55:23 +0100 Subject: [PATCH 04/20] update readme --- conviva/README.md | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/conviva/README.md b/conviva/README.md index 9a3d23c..c2f3491 100644 --- a/conviva/README.md +++ b/conviva/README.md @@ -43,6 +43,26 @@ First you need to define the Conviva metadata and configuration: }; ``` +Optionally, you can include device metadata in the ConvivaConfiguration object + +```typescript +const exampleDeviceMetadata: ConvivaDeviceMetadata = { + [Constants.DeviceMetadata.BRAND]: "Samsung", + [Constants.DeviceMetadata.MANUFACTURER]: "Samsung", + [Constants.DeviceMetadata.MODEL]: "QE43Q64BAUXXN", + [Constants.DeviceMetadata.TYPE]: Constants.DeviceType.SMARTTV, + [Constants.DeviceMetadata.VERSION]: "6.5.0", + [Constants.DeviceMetadata.OS_NAME]: "Tizen", + [Constants.DeviceMetadata.OS_VERSION]: "6.5.0", + [Constants.DeviceMetadata.CATEGORY]: Constants.DeviceCategory.SAMSUNG_TV, + [Constants.DeviceMetadata.SCREEN_RESOLUTION_WIDTH]: 3840, + [Constants.DeviceMetadata.SCREEN_RESOLUTION_HEIGHT]: 2160, + [Constants.DeviceMetadata.SCREEN_RESOLUTION_SCALE_FACTOR]: 1 +} + +convivaMetadata.deviceMetadata = exampleDeviceMetadata +``` + Using these configs you can create the Conviva connector with THEOplayer. * Add as a regular script: From 50fb6faa1993327f6805f42eccba8b828d8bca37 Mon Sep 17 00:00:00 2001 From: Wonne Joosen Date: Fri, 29 Nov 2024 23:00:14 +0100 Subject: [PATCH 05/20] add device metadata to example --- conviva/test/pages/main_umd.html | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/conviva/test/pages/main_umd.html b/conviva/test/pages/main_umd.html index e9e7b47..8e7b89e 100644 --- a/conviva/test/pages/main_umd.html +++ b/conviva/test/pages/main_umd.html @@ -31,7 +31,20 @@ const convivaConfig = { debug: false, gatewayUrl: 'CUSTOMER_GATEWAY_GOES_HERE', - customerKey: 'CUSTOMER_KEY_GOES_HERE' // Can be a test or production key. + customerKey: 'CUSTOMER_KEY_GOES_HERE', // Can be a test or production key. + deviceMetadata: { + [Conviva.Constants.DeviceMetadata.BRAND]: "Chrome", + [Conviva.Constants.DeviceMetadata.MANUFACTURER]: "Apple", + [Conviva.Constants.DeviceMetadata.MODEL]: "MacBook Pro M2", + [Conviva.Constants.DeviceMetadata.TYPE]: Conviva.Client.DeviceType.DESKTOP, + [Conviva.Constants.DeviceMetadata.VERSION]: "131.0.6778.86", + [Conviva.Constants.DeviceMetadata.OS_NAME]: "macOS Sonoma", + [Conviva.Constants.DeviceMetadata.OS_VERSION]: "14.7.0", + [Conviva.Constants.DeviceMetadata.CATEGORY]: Conviva.Client.DeviceCategory.APPLE_DEVICE, + [Conviva.Constants.DeviceMetadata.SCREEN_RESOLUTION_WIDTH]: 3024, + [Conviva.Constants.DeviceMetadata.SCREEN_RESOLUTION_HEIGHT]: 1964, + [Conviva.Constants.DeviceMetadata.SCREEN_RESOLUTION_SCALE_FACTOR]: 1 + } }; const convivaIntegration = new THEOplayerConvivaConnector.ConvivaConnector( From 46849a67466866d08de57603ab69f53cc7288bb0 Mon Sep 17 00:00:00 2001 From: Wonne Joosen Date: Fri, 29 Nov 2024 23:03:47 +0100 Subject: [PATCH 06/20] add changeset --- .changeset/sixty-pots-teach.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/sixty-pots-teach.md diff --git a/.changeset/sixty-pots-teach.md b/.changeset/sixty-pots-teach.md new file mode 100644 index 0000000..a6e5c9f --- /dev/null +++ b/.changeset/sixty-pots-teach.md @@ -0,0 +1,5 @@ +--- +"@theoplayer/conviva-connector-web": minor +--- + +Added `deviceMetadata` property to `ConvivaConfiguration`. From bd5d7a21d3968712aa1fb05d3c32da5b3524ac05 Mon Sep 17 00:00:00 2001 From: Wonne Joosen Date: Sat, 7 Dec 2024 15:36:09 +0100 Subject: [PATCH 07/20] add check for an in metadata passed to constructor --- conviva/src/integration/ConvivaHandler.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conviva/src/integration/ConvivaHandler.ts b/conviva/src/integration/ConvivaHandler.ts index 6a9195f..6cf3332 100644 --- a/conviva/src/integration/ConvivaHandler.ts +++ b/conviva/src/integration/ConvivaHandler.ts @@ -245,7 +245,7 @@ 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.currentSource?.metadata?.title ?? 'NA'; + 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 = { [Constants.STREAM_URL]: src, From ff07e5248e39ee0725ac8f1f79fbffe7fd5795b8 Mon Sep 17 00:00:00 2001 From: Wonne Joosen Date: Sat, 7 Dec 2024 15:36:39 +0100 Subject: [PATCH 08/20] only cleanup customMetadata when source is cleared --- conviva/src/integration/ConvivaHandler.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/conviva/src/integration/ConvivaHandler.ts b/conviva/src/integration/ConvivaHandler.ts index 6cf3332..6874262 100644 --- a/conviva/src/integration/ConvivaHandler.ts +++ b/conviva/src/integration/ConvivaHandler.ts @@ -329,7 +329,9 @@ export class ConvivaHandler { private readonly onSourceChange = () => { this.maybeReportPlaybackEnded(); this.currentSource = this.player.source; - this.customMetadata = {}; + if (this.currentSource === undefined) { + this.customMetadata = {} + } }; private readonly onEnded = () => { From d3eca0c6dfcd002c71b2f55a762937f8e618c301 Mon Sep 17 00:00:00 2001 From: Wonne Joosen Date: Sat, 7 Dec 2024 15:46:37 +0100 Subject: [PATCH 09/20] add changeset --- .changeset/rare-readers-talk.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/rare-readers-talk.md diff --git a/.changeset/rare-readers-talk.md b/.changeset/rare-readers-talk.md new file mode 100644 index 0000000..1307894 --- /dev/null +++ b/.changeset/rare-readers-talk.md @@ -0,0 +1,5 @@ +--- +"@theoplayer/conviva-connector-web": patch +--- + +Fixed an issue where an asset name, provided via a `ConvivaMetadata` object in the `ConvivaConnector` initialization, stops getting reported after a `sourcechange` event. From 951bf312f56b66187d9f49e39a527dc180563ad2 Mon Sep 17 00:00:00 2001 From: Wonne Joosen Date: Wed, 11 Dec 2024 10:52:06 +0100 Subject: [PATCH 10/20] remove example device metadata --- conviva/test/pages/main_umd.html | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/conviva/test/pages/main_umd.html b/conviva/test/pages/main_umd.html index 8e7b89e..bc296bd 100644 --- a/conviva/test/pages/main_umd.html +++ b/conviva/test/pages/main_umd.html @@ -31,20 +31,7 @@ const convivaConfig = { debug: false, gatewayUrl: 'CUSTOMER_GATEWAY_GOES_HERE', - customerKey: 'CUSTOMER_KEY_GOES_HERE', // Can be a test or production key. - deviceMetadata: { - [Conviva.Constants.DeviceMetadata.BRAND]: "Chrome", - [Conviva.Constants.DeviceMetadata.MANUFACTURER]: "Apple", - [Conviva.Constants.DeviceMetadata.MODEL]: "MacBook Pro M2", - [Conviva.Constants.DeviceMetadata.TYPE]: Conviva.Client.DeviceType.DESKTOP, - [Conviva.Constants.DeviceMetadata.VERSION]: "131.0.6778.86", - [Conviva.Constants.DeviceMetadata.OS_NAME]: "macOS Sonoma", - [Conviva.Constants.DeviceMetadata.OS_VERSION]: "14.7.0", - [Conviva.Constants.DeviceMetadata.CATEGORY]: Conviva.Client.DeviceCategory.APPLE_DEVICE, - [Conviva.Constants.DeviceMetadata.SCREEN_RESOLUTION_WIDTH]: 3024, - [Conviva.Constants.DeviceMetadata.SCREEN_RESOLUTION_HEIGHT]: 1964, - [Conviva.Constants.DeviceMetadata.SCREEN_RESOLUTION_SCALE_FACTOR]: 1 - } + customerKey: 'CUSTOMER_KEY_GOES_HERE' // Can be a test or production key. }; const convivaIntegration = new THEOplayerConvivaConnector.ConvivaConnector( From 0a8c3c1f3b289102ac803250a9359cddab32958f Mon Sep 17 00:00:00 2001 From: Wonne Joosen Date: Wed, 11 Dec 2024 10:53:25 +0100 Subject: [PATCH 11/20] open pages folder --- conviva/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conviva/package.json b/conviva/package.json index 4672f41..69ea396 100644 --- a/conviva/package.json +++ b/conviva/package.json @@ -21,7 +21,7 @@ "bundle": "rollup -c rollup.config.mjs", "watch": "npm run bundle -- --watch", "build": "npm run clean && npm run bundle", - "serve": "http-server ./.. -o /conviva/test/pages/main_umd.html", + "serve": "http-server ./.. -o /conviva/test/pages/", "test": "jest" }, "author": "THEO Technologies NV", From 3394dfdf725b9dfe970dd4013837295c3d7e06b4 Mon Sep 17 00:00:00 2001 From: Wonne Joosen Date: Wed, 11 Dec 2024 10:56:34 +0100 Subject: [PATCH 12/20] add autocollect remark --- conviva/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conviva/README.md b/conviva/README.md index c2f3491..1a6503d 100644 --- a/conviva/README.md +++ b/conviva/README.md @@ -43,7 +43,7 @@ First you need to define the Conviva metadata and configuration: }; ``` -Optionally, you can include device metadata in the ConvivaConfiguration object +Optionally, you can include device metadata in the ConvivaConfiguration object. Note that `SCREEN_RESOLUTION_WIDTH`, `SCREEN_RESOLUTION_HEIGHT` and `SCREEN_RESOLUTION_SCALE_FACTOR` are the only fields that Conviva will auto-collect on most web-based platforms. ```typescript const exampleDeviceMetadata: ConvivaDeviceMetadata = { From df5bc55b79a396c3e7ca644d4962d13d8639407a Mon Sep 17 00:00:00 2001 From: Wonne Joosen Date: Mon, 16 Dec 2024 21:30:30 +0100 Subject: [PATCH 13/20] fix ESM example --- conviva/test/pages/main_esm.html | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/conviva/test/pages/main_esm.html b/conviva/test/pages/main_esm.html index 36b0356..f84f420 100644 --- a/conviva/test/pages/main_esm.html +++ b/conviva/test/pages/main_esm.html @@ -4,16 +4,23 @@ Connector test page - - -
+