Is mime type really needed for playing video in HTML5? -


i have small snippet of code play video using html5. accident, discovered runs without type attribute (the mime type) in source element (see code below).

i thought needed provide mime type, apparently not. i've tried google this, no luck. code below works fine in both firefox , chrome. have no other html5 supporting browsers installed. video files used in tests local mp4 files , webm files using http. result same; seemes work fine without mime type. hence question:

is safe write without type attribute or did miss here? (i don't need support browsers older ie11.)

any information on subject appreciated. thanks.

<video id="videocontrol1" width="600" controls poster="somepic.png">     <source id="videosource1" src="somevideo.mp4"></source>     <object>         <p>video not supported</p>     </object> </video> 

usually, browsers detect mime type based on meta data , incoming stream, believe not @ file type anymore. can see in action purposely renaming video on live webserver wrong extension, browsers , players usually still play video.

the reference find on subject tutorial site (html5 rocks tutorials), quoting:

in cases, browser won't play video if mime type isn't set properly.

this written in 2010, , said "in cases". should safe not provide mime type, although providing wrong 1 may or may not cause not play.


Comments