Get the App
SLTechnology News&Howtos  ›  Development  › 

How to detect whether the browser supports html5 video

Shulou Source: shulou.com Published: 2022-06-03 07:47:57 10月26日 Update

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:

Tags: Browsing video support testing content articles running code learning help effects easy to understand more organization knowledge editing industry information information channels Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno OPPO Reno vpn NVidia Redmi Linux