From c5644b30f367f06d36ef560add31e253fe626b4d Mon Sep 17 00:00:00 2001 From: Jon Hardie Date: Thu, 14 Oct 2021 17:38:32 +1300 Subject: [PATCH] Handle both kinds of positions --- src/CptvPlayerUtils.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/CptvPlayerUtils.ts b/src/CptvPlayerUtils.ts index a24107c..1e77507 100644 --- a/src/CptvPlayerUtils.ts +++ b/src/CptvPlayerUtils.ts @@ -111,7 +111,9 @@ const getPositions = ( const padding = 5; if (positions.length > 0 && !Array.isArray(positions[0])) { return (positions as Region[]).map((position: Region) => [ - position.frameNumber, + position.frameNumber || + (position.frameTime && frameAtTime(position.frameTime - timeOffset)) || + 0, [ Math.max(0, position.x - padding), Math.max(0, position.y - padding), @@ -185,7 +187,8 @@ export interface Region { y: number; width: number; height: number; - frameNumber: number; + frameNumber?: number; + frameTime?: number; } export interface SelectedTrack { trackId: number;