canPlayType() reports how likely it is that the current browser will be able to play media of a given MIME type.
Note: This feature is not available in Web Workers.
A string specifying the MIME type of the media and (optionally) a
codecsparameter containing a comma-separated list of the supported codecs.
A string indicating how likely it is that the media can be played. The string will be one of the following values:
The media cannot be played on the current device.
The media is probably playable on this device.
There is not enough information to determine whether the media can play (until playback is actually attempted).
let obj = document.createElement('video'); console.log(obj.canPlayType('video/mp4')); // "maybe"
|HTML Standard |
BCD tables only load in the browser