Skip to content

Commit

Permalink
fix: check elements before video instantiation
Browse files Browse the repository at this point in the history
  • Loading branch information
astagi committed Jan 23, 2025
1 parent 0328a5d commit 729e9a6
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/Video/Video.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@ export interface VideoProps extends InputProps {

export const Video: FC<VideoProps> = ({ label, testId }) => {
useEffect(() => {
new VideoPlayer(document.querySelector('video'));
const el = document.querySelector('video');
if (el) {
new VideoPlayer(el);
}
});
return (
<div className="row" data-testid={testId}>
Expand Down

0 comments on commit 729e9a6

Please sign in to comment.