How to tell if the current browser supports HTML5 video tags:
HTML5 added a video tag for playing videos, the function is very powerful, but because of the current many browsers are not supported, so in the use of the need to determine whether the current browser support this tag, the following provides a piece of code to achieve this function, hoping to bring some help to the needs of friends.
The code is as follows:
//detects if HTML5 is supportedfunctionCheckVideo () {if(!! Document.createelement (' video '). Canplaytype) {varVidtest = 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) { return false; } Else{ if(H264test = = "probably"){ return true; } Else { return false; } } } Else{ if(Oggtest = = "probably"){ return true; } Else{ return false; } } } Else{ return false; }}
The original address is: http://www.51texiao.cn/HTML5jiaocheng/2015/0612/4011.html
The most original address is: http://www.softwhy.com
How to tell if the current browser supports HTML5 video tags