HTML Audio/Video DOM canPlayType() Method
Example
function supportType(e,vidType,codType) {
var vid = document.createElement('video');
isSupp = vid.canPlayType(vidType+';codecs="'+codType+'"');
if (isSupp == "") {
isSupp = "No";
}
e.target.parentNode.innerHTML = "Answer: " + isSupp;
}
Meaning
The canPlayType() method checks if the browser can play the specified audio/video type.
Return value:
- "probably" - The browser most likely supports this audio/video type.
- "maybe" - The browser might support this audio/video type.
- "" (empty string) - The browser does not support this audio/video type.
Standard Syntax
audio|video.canPlayType(type)
Advertisement
Parameter Value
| Type | Description |
|---|---|
| type | Specifies the audio/video type to test support for.
Common values:
|