Skip to content

Commit 4ccca18

Browse files
committed
Handle infinite values
1 parent 9af17fb commit 4ccca18

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

plugins/browser-plugin-media-tracking/src/helperFunctions.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,11 @@ type TimeRange = { start: number; end: number };
5353
export function timeRangesToObjectArray(t: TimeRanges): TimeRange[] {
5454
const out: TimeRange[] = [];
5555
for (let i = 0; i < t.length; i++) {
56-
out.push({ start: t.start(i) || 0, end: t.end(i) || 0 });
56+
const start = t.start(i);
57+
const end = t.end(i);
58+
if (isFinite(start) && isFinite(end)) {
59+
out.push({ start: start || 0, end: end || 0 });
60+
}
5761
}
5862
return out;
5963
}

0 commit comments

Comments
 (0)