Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to play different formats according to different browsers by HTML5

2025-03-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

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!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report