Get the App
SLTechnology News&Howtos  ›  Development  › 

How to play different formats according to different browsers by HTML5

Shulou Source: shulou.com Published: 2022-06-02 14:14:11 10月03日 Update

How to achieve HTML5 according to different browsers play different formats, I believe that many inexperienced people do not know what to do, so this article summarizes the causes of the problem and solutions, through this article I hope you can solve this problem.

Through Html5's Video tag syntax, we can quickly embed movies in the web page. However, different browsers support different HTML5 movie formats (video decoding), so in addition to preparing relevant audio and video files, the next step is how to enable the browser to automatically determine the format of playback. If we open an IE browser or Fireofx, it will automatically grab the format files supported by the browser.

Originally thought that this needs to be judged by js, or browser-specific properties, in fact, not at all, directly through the open tag of Html5, it will automatically play different audio and video formats according to different browsers, super convenient no longer need to write any judgment, as long as the documents of different formats are prepared!

Browser | Ogg TheoraMP4 (H.264) WebMMicrosoft Internet Explorer9 ╳○╳ Mozilla Firefox5+ ○╳○ Google Chrome13+ ○○○ Apple Safari5+ ╳○╳ Opera11+ ○╳○

The easiest way is to prepare two audio and video formats, Mp4 and Ogv, and then take a look at the presentation results in each browser.

IE9.0:

Chrome 13.0:

Firefox5.0:

Safari 5.05:

Opera 11.0:

After writing directly through the open label, it will automatically grab the supported audio and video formats according to different browsers, and play the audio and video files correctly, and there is no need to judge what to write at all, as long as the relevant audio and video files are marked completely and correctly, it will work normally in the major browsers!

After reading the above, have you mastered how HTML5 can play different formats according to different browsers? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel, thank you for reading!

Tags: Browser browse different format video file no method tag support content open movie more grammar problem open helpless to this end write Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno NVidia OPPO Reno Microsoft Docker Redmi