Thank you
I tried to create another component VideoPlayer.jsx and then put the lottie on it and then add variable and used useEffect:
const VideoPlayer = ({ onVideoEnd }) => {
const [videoLoaded, setVideoLoaded] = useState(false);
useEffect(() => {
const handleVideoLoad = () => {
setVideoLoaded(true);
};
const handleVideoEnded = () => {
if (onVideoEnd) {
onVideoEnd();
}
};
const videoElement = document.getElementById('myVideo');
videoElement.addEventListener('loadeddata', handleVideoLoad);
videoElement.addEventListener('ended', handleVideoEnded);
return () => {
videoElement.removeEventListener('loadeddata', handleVideoLoad);
videoElement.removeEventListener('ended', handleVideoEnded);
};
}, [onVideoEnd]);
give it absolute position and z-index of 1000.
In the return i added
{!videoLoaded &&
Loading video...}
0 comments:
Post a Comment
Thanks