Copy Code code as follows:
Detect if HTML5 is supported
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) {
return false;
}
else {
if (h264test = = "probably") {
return true;
}
else {
return false;
}
}
}
else {
if (oggtest = = "probably") {
return true;
}
else {
return false;
}
}
}
else {
return false;
}
}
Use the above method to determine whether the current browser supports the video tags in HTML5, and can support the use of the MP4 format for playback (because Firefox seems to be due to copyright, Playback in the H.264 encoded MP4 format is not supported, if true, the video in HTML5 can be played and returned false, and the Flash plugin will be used to play it.
This method is commonly used in video sites, compatible with mobile phones, tablets and other devices to play the video screen, mainly for compatibility with iOS;