From efea8fed2a3862fb1361e84b4a1fd3d905ca0f2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matu=CC=81s=CC=8C=20Tomlein?= Date: Mon, 5 May 2025 15:43:20 +0200 Subject: [PATCH 1/3] Add a default 0 value for start and end in the media_element entity time ranges --- plugins/browser-plugin-media-tracking/src/helperFunctions.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/browser-plugin-media-tracking/src/helperFunctions.ts b/plugins/browser-plugin-media-tracking/src/helperFunctions.ts index d5d025a2e..ad4e22677 100644 --- a/plugins/browser-plugin-media-tracking/src/helperFunctions.ts +++ b/plugins/browser-plugin-media-tracking/src/helperFunctions.ts @@ -53,7 +53,7 @@ type TimeRange = { start: number; end: number }; export function timeRangesToObjectArray(t: TimeRanges): TimeRange[] { const out: TimeRange[] = []; for (let i = 0; i < t.length; i++) { - out.push({ start: t.start(i), end: t.end(i) }); + out.push({ start: t.start(i) || 0, end: t.end(i) || 0 }); } return out; } From 9af17fb82b141a6b9240ed6487c13230e5ee1ca2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matu=CC=81s=CC=8C=20Tomlein?= Date: Mon, 5 May 2025 15:44:07 +0200 Subject: [PATCH 2/3] Run rush change --- ...sing_end_in_seekable_property_2025-05-05-13-43.json | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 common/changes/@snowplow/browser-plugin-media-tracking/issue-fix_missing_end_in_seekable_property_2025-05-05-13-43.json diff --git a/common/changes/@snowplow/browser-plugin-media-tracking/issue-fix_missing_end_in_seekable_property_2025-05-05-13-43.json b/common/changes/@snowplow/browser-plugin-media-tracking/issue-fix_missing_end_in_seekable_property_2025-05-05-13-43.json new file mode 100644 index 000000000..c26c0fff4 --- /dev/null +++ b/common/changes/@snowplow/browser-plugin-media-tracking/issue-fix_missing_end_in_seekable_property_2025-05-05-13-43.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@snowplow/browser-plugin-media-tracking", + "comment": "Add a default 0 value for start and end in the media_element entity time ranges", + "type": "none" + } + ], + "packageName": "@snowplow/browser-plugin-media-tracking" +} \ No newline at end of file From 4ccca18e1c40b9a0434f6393ebab443ca04c9ad3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matu=CC=81s=CC=8C=20Tomlein?= Date: Tue, 6 May 2025 10:09:07 +0200 Subject: [PATCH 3/3] Handle infinite values --- .../browser-plugin-media-tracking/src/helperFunctions.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/plugins/browser-plugin-media-tracking/src/helperFunctions.ts b/plugins/browser-plugin-media-tracking/src/helperFunctions.ts index ad4e22677..4fa7ebfb3 100644 --- a/plugins/browser-plugin-media-tracking/src/helperFunctions.ts +++ b/plugins/browser-plugin-media-tracking/src/helperFunctions.ts @@ -53,7 +53,11 @@ type TimeRange = { start: number; end: number }; export function timeRangesToObjectArray(t: TimeRanges): TimeRange[] { const out: TimeRange[] = []; for (let i = 0; i < t.length; i++) { - out.push({ start: t.start(i) || 0, end: t.end(i) || 0 }); + const start = t.start(i); + const end = t.end(i); + if (isFinite(start) && isFinite(end)) { + out.push({ start: start || 0, end: end || 0 }); + } } return out; }