30 lines
927 B
JavaScript
30 lines
927 B
JavaScript
import '../../css/video.css';
|
|
|
|
function PlayVideo({ src = "hallway_FFF.mp4", onVideoReady }) {
|
|
const urlSource = `${import.meta.env.VITE_ASSETS_URL}/${src}`;
|
|
|
|
return (
|
|
<div className="video-container">
|
|
<video
|
|
autoPlay
|
|
muted
|
|
controls="none"
|
|
playsInline
|
|
loop
|
|
pointerEvents="none"
|
|
onCanPlayThrough={(e) => {
|
|
e.target.play();
|
|
console.log("Video is ready and played");
|
|
if (onVideoReady) {
|
|
onVideoReady(); // Call the callback to notify that the video is ready
|
|
}
|
|
}}
|
|
>
|
|
<source src={urlSource} type="video/mp4" />
|
|
Your browser does not support the video tag.
|
|
</video>
|
|
</div>
|
|
);
|
|
}
|
|
|
|
export default PlayVideo;
|