In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly shows you "how to insert video into HTML and is compatible with all browsers". The content is simple and clear. I hope it can help you solve your doubts. Let me lead you to study and learn this article "how to insert video into HTML and be compatible with all browsers".
There are two ways to insert video into HTML, one is the old object tag, and the other is the video tag in html5. The former is relatively compatible, while the latter is a headache.
There are two most common ways to insert video into HTML, one is the old tag, and the other is the tag in html5.
The compatibility of the former is needless to say, but it is not very convenient to use, while the latter is very convenient to use, but compatibility is a headache.
Although there are many problems in the compatibility of the latter, because it is very convenient to use and accords with the development trend of web design in the future, we take the latter as the main method to insert video, and the former is used as an assistant because of its compatibility.
Examples are as follows:
Your browser does not support the video tag
Currently, the video element supports three video formats:
Format IE Firefox Opera Chrome Safari
Ogg No 3.5 + 10.5 + 5.0 + No
MPEG 4.9.0 + No No 5.0 + 3.0 +
WebM No 4.0 + 10.6 + 6.0 + No
Ogg = Ogg file with Theora video encoding and Vorbis audio encoding
MPEG4 = MPEG4 file with H.264 video encoding and AAC audio encoding
WebM = WebM file with VP8 video encoding and Vorbis audio encoding
Note: the format must meet the above three detailed requirements, such as MPEG 4, and must be H.264 video and AAC audio.
In this case, if the video format is correct, we are satisfied with the compatibility results of most browsers, but IE678 does not support it, and other people's users are still very large in China, so we have to think of another solution to support them:
This introduces some files, in addition to flv format video, there are several swf or js files, are generated by DW software, do not want to study the tags of friends to DW software generation line, if you can skillfully integrate
These two pieces of code can get the ultimate code that is compatible with all major browsers.
So we can go like this:
Use jquery to determine whether the browser is IE (there is no need to determine the specific IE version, because the high version of IE is likely to fail because of the server, and all IE will use tags for the time being), and load different tags according to the version, as follows:
If ($.browser.msie) {[xss_clean] ('+');} else {[xss_clean] ('+ 'your browser does not support the video tag'+');}
Don't forget to introduce the jquery file before writing this code
At this point, you can write HTML video code that is compatible with all browsers.
The above is all the content of the article "how to insert video into HTML and be compatible with all browsers". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.