Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How can I auto-resize a video in HTML?

I currently have this:

<video controls="" autoplay="" name="media"><source src="...." type="video/mp4"></video>

It turns out, that half of the video is cut out of the screen, and I can’t fix it.
Also, if you could help with this too, I’d like to know how to play the video in javascript.

Thanks!

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Here is what I tried vs what I am expecting:

enter image description here

>Solution :

You need to add attributes responsible for width and height.

As an example:

<center>
  <video id="Test_Video" width="400" height="240" controls>
    <source src="gfg.mp4" type="video/mp4">
  </video>
</center>

the size is in pixels. If you want you can also specify it in % f.ex width="100%"

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading