How can I write a proper video html code that will be supported on any browser. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

How can I write a proper video html code that will be supported on any browser.

I've tried different formats when writing the codes for html. But none worked. The audio seemed to work perfectly, but so far no progress with the video sources.

29th Mar 2017, 6:24 PM
Laguayari Ekio
Laguayari Ekio - avatar
3 Answers
+ 2
One way is to use different formats as sources for you video tag Here is an example that covers all web browsers. <video width="320" height="240" controls> <source src="movie.mp4" type="video/mp4"> <source src="movie.ogg" type="video/ogg"> <source src="movie.webm" type="video/webm"> <object data="movie.mp4" width="320" height="240"> <embed src="movie.flv" width="320" height="240"> </object> </video> Another way ( not sure ) : Add this line in your head somewhere. <script src="http://api.html5media.info/1.1.5/html5media.min.js"></script> Also try putting your source in the opening video tag. <video source src="movie.mp4" type="video/mp4" width="380px" height="190px" controls></video>
29th Mar 2017, 7:15 PM
NCIBI Ali
NCIBI Ali - avatar
+ 2
thanks! I'll try that out
29th Mar 2017, 7:47 PM
Laguayari Ekio
Laguayari Ekio - avatar
+ 1
okay then post the result.
29th Mar 2017, 8:05 PM
NCIBI Ali
NCIBI Ali - avatar