diff --git a/src/components/animations/AccessPageVideo.tsx b/src/components/animations/AccessPageVideo.tsx index 5070f16..e3aaf5f 100644 --- a/src/components/animations/AccessPageVideo.tsx +++ b/src/components/animations/AccessPageVideo.tsx @@ -16,6 +16,7 @@ function AccessPageVideo(props: AccessPageVideoProps): React.ReactElement { ref={$videoElement} className="accessPage-video" width="100%" + muted > diff --git a/src/components/pages/AccessPage.tsx b/src/components/pages/AccessPage.tsx index 215d84c..4732f0a 100644 --- a/src/components/pages/AccessPage.tsx +++ b/src/components/pages/AccessPage.tsx @@ -45,12 +45,32 @@ function AccessPage(): React.ReactElement { setTimeout(() => { if ($videoElement.current) { $videoElement.current.style.display = 'block'; - $videoElement.current.play(); - setPageTitle('🚀..........'); + $videoElement.current.muted = true; + + const playPromise = $videoElement.current.play(); + if (playPromise !== undefined) { + playPromise + .then(() => { + // eslint-disable-next-line + console.log( + '/iturres-reactive-portfolio/ Video started successfully', + ); + setPageTitle('🚀..........'); + }) + .catch((error) => { + // eslint-disable-next-line + console.error('Video play failed:', error); + navigate('/homepage'); + }); + } else { + navigate('/homepage'); + } } }, 200); $videoElement.current.addEventListener('ended', () => navigate('/homepage')); + } else { + navigate('/homepage'); } };