What user agents support mp4 / H.264 video in the HTML5 <video> tag?

Which user agents support the HTML5 video tag using mp4 as a container and H.264 as a codec? Has anyone come up with a regex for this?

UPDATE: Thank you all for your comments. I forgot to mention that I prefer to do this in the background, which means that something like a modernizer will not work.

+4
source share
2 answers

Desktop:

  • IE6-8: No
  • IE9-10: H.264
  • Chrome: WebM and H.264
  • Firefox 3.6: Ogg Theora
  • Firefox 4+: WebM
  • Opera: WebM
  • Safari: H.264

Mobile:

  • iOS: H.264
  • Chrome Android: H.264 and WebM
  • Firefox Android: H.264 and WebM
  • IE for Windows Phone 7.5 - 8: H.264
  • Opera 12: H.264

See HTML5 Test for details. Notes: the default browser for Android (the so-called "Browser") does not support any codec, but I think that phone developers can solve this, I’m sure that you can guarantee H.264 as hardware acceleration for this codec, as usually integrated in mobile processors. Also with respect to Firefox for the desktop, it gets H.264 support this year .

Edit: Above support matrix was updated in 2013/03/22


So the two video formats you need to support are WebM and H.264. But it seems that H.264 is increasingly becoming the de facto standard for video on the Internet.

DO NOT use by flexing a user agent that is known to be unreliable and error prone. There are simply better ways to detect <video> tag support.

For example, see the Upgrade , which allows you to write:

 if (!Modernizr.video) { // Implement some Flash fallback } 

or, if you explicitly discover a specific codec ...

 if (!Modernizr.video || (Modernizr.video && !Modernizr.video.h264)) { // Flash fallback here } 
+5
source

Not sure about regex, although I don't think you need to sniff a user agent. The <video> element is intended to contain links to videos in several formats so that user agents play the one they support. See the "Dive into the HTML5 chapter" section for a great example .

Immersion in HTML5 also has a good HTML5 browser support list .

+1
source

Source: https://habr.com/ru/post/1339703/


All Articles