11'use client' ;
22
33import classNames from 'classnames' ;
4- import React , { useRef } from 'react' ;
4+ import React , { useState } from 'react' ;
55import LoadingSpinner from './LoadingSpinner' ;
6- import { useIsLoading } from '../hooks' ;
76
87const sizes = Object . freeze ( {
98 xs : {
@@ -31,10 +30,8 @@ const sizes = Object.freeze({
3130export interface EmbeddedVideoProps {
3231 allowFullScreen ?: boolean ;
3332 className ?: string ;
34- frameBorder ?: string ;
3533 height ?: string | number ;
3634 id ?: string ;
37- scrolling ?: string ;
3835 size ?: keyof typeof sizes ;
3936 src : string ;
4037 title ?: string ;
@@ -44,17 +41,14 @@ export interface EmbeddedVideoProps {
4441export default function EmbeddedVideo ( {
4542 allowFullScreen = true ,
4643 className,
47- frameBorder = '0' ,
4844 height,
4945 id = 'video-player' ,
50- scrolling = 'no' ,
5146 size,
5247 src,
5348 title = 'Video Player' ,
5449 width,
5550} : EmbeddedVideoProps ) {
56- const ref = useRef < HTMLIFrameElement > ( null ) ;
57- const loading = useIsLoading ( ref ) ;
51+ const [ loading , setLoading ] = useState ( true ) ;
5852 const offline = typeof navigator !== 'undefined' && ! navigator . onLine ;
5953 const _width = width || ( size && sizes [ size ] . width ) ;
6054 const _height = height || ( size && sizes [ size ] . height ) ;
@@ -73,11 +67,9 @@ export default function EmbeddedVideo({
7367 >
7468 < iframe
7569 allowFullScreen = { allowFullScreen }
76- frameBorder = { frameBorder }
7770 height = { _height || '100%' }
7871 id = { id }
79- ref = { ref }
80- scrolling = { scrolling }
72+ onLoad = { e => setLoading ( false ) }
8173 src = { src }
8274 title = { title }
8375 width = { _width || '100%' }
0 commit comments