Skip to content

Conversation

@taj54
Copy link
Member

@taj54 taj54 commented Aug 5, 2025

The previous implementation of the InteractiveVideo component was susceptible to a race condition where the IVLabsPlayer could be initialized before the container element was available in the DOM. This would cause the player to fail to load.

This commit resolves the issue by wrapping the player initialization in a setTimeout with a delay of 0. This ensures that the player is only initialized after the current event loop has completed and the container element is available.

Additionally, this commit:

  • Adds the @vitejs/plugin-react dependency to support React in Vite.
  • Updates the Vitest configuration to include the React plugin.
  • Refactors the event listener registration to be more robust.

The previous implementation of the `InteractiveVideo` component was susceptible to a race condition where the `IVLabsPlayer` could be initialized before the container element was available in the DOM. This would cause the player to fail to load.

This commit resolves the issue by wrapping the player initialization in a `setTimeout` with a delay of 0. This ensures that the player is only initialized after the current event loop has completed and the container element is available.

Additionally, this commit:

- Adds the `@vitejs/plugin-react` dependency to support React in Vite.
- Updates the Vitest configuration to include the React plugin.
- Refactors the event listener registration to be more robust.
@taj54 taj54 merged commit aea2070 into interactive-video-labs:main Aug 5, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant