<!DOCTYPE html>
<
html
>
<
head
>
<
title
>
DOM Audio canPlayType( ) Method
</
title
>
</
head
>
<
body
style
=
"text-align: center"
>
<
h1
style
=
"color: green"
>
GeeksforGeeks
</
h1
>
<
h2
style
=
"font-family: Impact"
>
Audio canPlayType() Method
</
h2
>
<
br
>
<
p
>
Does the browser support playing OGG audios? <
span
>
<
button
ondblclick
=
"My_Audio(event, 'audio/ogg', 'vorbis')"
type
=
"button"
>Check</
button
>
</
span
></
p
>
<
p
>Does the browser support playing OGG audios? <
span
>
<
button
ondblclick
=
"My_Audio(event, 'audio/ogg', 'vorbis')"
type
=
"button"
>Check</
button
>
</
span
></
p
>
<
script
>
function My_Audio(e, vidType, codType) {
var v = document.createElement("Video");
isSupp =
v.canPlayType(vidType + ';codecs="' + codType + '"');
if (isSupp == "") {
isSupp = "No";
}
e.target.parentNode.innerHTML =
"Compatilibility : " + isSupp;
}
</
script
>
</
body
>
</
html
>