How to determine whether the current browser supports html5 video tags, html5video

Source: Internet
Author: User

How to determine whether the current browser supports html5 video tags, html5video

How to determine whether the current browser supports html5 video tags:

Html5 adds the video tag, which is used to play videos. It is very powerful, but many Browsers Do not currently support it. Therefore, you need to determine whether the current browser supports this tag when using it, the following is a piece of code that can implement this function, hoping to help friends who need it.

The Code is as follows:

// Check whether HTML5function checkVideo () {if (!! Document. createElement ('video '). canPlayType) {var vidTest = document. createElement ("video"); oggTest = vidTest. canPlayType ('video/ogg; codecs = "theora, vorbis" '); if (! OggTest) {hsf-test = vidTest. canPlayType ('video/mp4; codecs = "avc1.42E01E, mp4a. 40.2" '); if (! Hsf-test) {return false;} else {if (hsf-test = "probably") {return true;} else {return false ;}}} else {if (oggTest = "probably") {return true;} else {return false ;}}

Original address: http://www.51texiao.cn/HTML5jiaocheng/2015/0612/4011.html

Most original address: http://www.softwhy.com

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.