I’m using mux-player-react on a next.js site to implement a large background looped movie.
https://website-agobay-coming-soon-5iemrgd6o-hhag.vercel.app/
The video should be object-fit: cover to cover all the browser window. unfortunately it doesn’t work.
eather with:
.videoMob {
--controls: none;
--media-object-fit: cover;
--media-object-position: center;
or:
.videoMob {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%) scale(1);
min-width: 100vw;
min-height: 100vh;
overflow: hidden;
object-fit: cover;
It’s strange, if I use the mux-video-react class, it works fine but the video has a jumpcut and it don’t show the video on mobile devices.
thanks
2
Answers
object-fit
seems to be working but the video doesn’t take up all the vertical space of its parent element. If you can useheight: 100vh
on the video tag, it should work.On another note – for a background video like this, native HTML5 video does the job as well …
You can modify your
videoMob
class styles to look like this, it should solve your issue:Let me know if you have any other questions around using
mux-player
!