Skip to content

🎥 Make videos programmatically with React

Adding check for onTimeUpdate

Ashik Meerankuttyc620d98fb23f
diff --git a/packages/player/src/PlayerUI.tsx b/packages/player/src/PlayerUI.tsx
index 73daab9fe2..eae56a7ee9 100644
--- a/packages/player/src/PlayerUI.tsx
+++ b/packages/player/src/PlayerUI.tsx
@@ -147,9 +147,9 @@ const PlayerUI: React.ForwardRefRenderFunction<
}, []);
useEffect(() => {
- if(config) {
+ if(config && onTimeUpdate) {
const playedSeconds = player.getCurrentFrame() / config.fps;
- onTimeUpdate?.({
+ onTimeUpdate({
elapsedTime: playedSeconds,
});
}