How can I check whether your browser supports HTML5 videos or html5 videos?

Source: Internet
Author: User

How can I check whether your browser supports HTML5 videos or html5 videos?

Check the following code to check whether your browser supports HTML5 videos:

function checkVideo(){if(!!document.createElement('video').canPlayType){var vidTest=document.createElement("video");oggTest=vidTest.canPlayType('video/ogg; codecs="theora, vorbis"');if (!oggTest){h264Test=vidTest.canPlayType('video/mp4; codecs="avc1.42E01E, mp4a.40.2"');if (!h264Test){document.getElementById("checkVideoResult").innerHTML="Sorry. No video support."}else{if (h264Test=="probably"){document.getElementById("checkVideoResult").innerHTML="Yes! Full support!";}else{document.getElementById("checkVideoResult").innerHTML="Well. Some support.";}}}else{if (oggTest=="probably"){document.getElementById("checkVideoResult").innerHTML="Yes! Full support!";}else{document.getElementById("checkVideoResult").innerHTML="Well. Some support.";}}}else{document.getElementById("checkVideoResult").innerHTML="Sorry. No video support."}} 
The code is so simple !! Check the running effect:


Welcome to my blog! If you have any questions, please join the QQ group: 135430763 to learn together!

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.