//Check whether 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 true;
}
else {
return false; == "probably") {
return true;
; 🎜>
Use the above method to determine whether the current browser supports the Video tag in HTML5 and can support playback in the MP4 format (because Firefox does not support playback in the H.264 encoded MP4 format due to copyright reasons). If If you return true, you can use Video in HTML5 to play the video; if you return false, you can use the Flash plug-in to play it.
This method is generally used on video websites and is compatible with mobile phones, tablets and other devices for video playback, mainly for compatibility with IOS;