I am working with a square video (scale 1:1) and I need to position it in the center of the screen.
My main issue is that when using the <video>
tag, two black areas are inserted on both sides. Is there a way to prevent this from happening?
https://i.sstatic.net/gBio4.png
<div style="width: 400px; height: 400px; background-color: red;">
<video>
<source src="~/Content/video/FreeBirdConstruction.mp4" type="video/mp4">
</video>
</div>
The containing div is set to be a square (400px x 400px), so why doesn't the video fill it? I have also attempted to use VideoJS but haven't been able to solve the problem.
Another question arises. Whenever I try to center the div on the screen, like this:
position: absolute; /*it can be fixed too*/
left: 0;
right: 0;
top: 0;
bottom: 0;
margin: auto;
overflow: auto;
The div initially appears in the center of the screen, but then disappears instantly.
Could someone please assist me in finding a solution to this issue? Thank you for your help.