I am trying to embed a LOCAL video on a div background in React but it's not working. In fact, when I embed a URL video, it works, but not from LOCAL file. Is there something special to make this background video work in React?
Results
DO WORK --> https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4
DO NOT WORK --> ./assets/videos/show.mp4 (the path is correct)
EDIT: I inserted controls property and have found out that the video exists, but it plays in blank screen. Any help would be appreciated.
.video-container {
height: 100vh;
position: relative;
width: 100vw;
}
.video-container video {
height: 100%;
object-fit: cover;
position: fixed;
width: 100%;
z-index: 0;
}
<div className="video-container">
<video autoPlay muted loop id="video">
<source src='https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4'} type="video/mp4" />
</video>
</div>