How to detect whether the browser supports html5 video
This article mainly shows you "how to detect whether the browser supports html5 video". The content is easy to understand and clear. I hope it can help you solve your doubts. Let me lead you to study and learn this article "how to detect whether the browser supports html5 video".
Running effect:
1. Run in EditPlus
two。 Run in a chrome browser
=
Code part:
=
The code is as follows:
Function checkVideo ()
{
If (!! document.createElement ('video'). CanPlayType)
{
Var vidTest=document.createElement ("video")
OggTest=vidTest.canPlayType ('video/ogg; codecs= "theora, vorbis"')
If (! oggTest)
{
H364Test=vidTest.canPlayType ('video/mp4; codecs= "avc1.42E01E, mp4a.40.2"')
If (! h364Test)
{
Document.getElementById ("checkVideoResult") [xss_clean] = "Sorry. No video support."
}
Else
{
If (h364 testing = "probably")
{
Document.getElementById ("checkVideoResult") [xss_clean] = "Yes! Full support!"
}
Else
{
Document.getElementById ("checkVideoResult") [xss_clean] = "Well. Some support."
}
}
}
Else
{
If (oggTest== "probably")
{
Document.getElementById ("checkVideoResult") [xss_clean] = "Yes! Full support!"
}
Else
{
Document.getElementById ("checkVideoResult") [xss_clean] = "Well. Some support."
}
}
}
Else
{
Document.getElementById ("checkVideoResult") [xss_clean] = "Sorry. No video support."
}
}
Check if your browser supports HTML5 video: