Example
Detect whether your browser can play different types of videos:
myVid=document.createElement('video'); isSupp=myVid.canPlayType(vidType+';codecs="'+codType+'"');
Definition and usage
canPlayType() method browsing Whether the device can play the specified audio/video type.
The canPlayType() method can return one of the following values:
"probably" - The browser is most likely to support this audio/video type
"maybe" - The browser may support this audio/video type
"" - (empty string) The browser does not support this audio /Video Type
Browser support
All browsers support the canPlayType() method.
Note: This method is not supported in Internet Explorer 8 and earlier.
Syntax
audio|video.canPlayType(type))
Parameters
Value | Description |
type |
specifies the audio/video type to be detected. Common values:
|
indicates the supported level. Possible values: |
"probably" - most likely supported
|
The above is the detailed content of The method canPlayType() in HTML5 determines whether the browser can play the specified audio/video type.. For more information, please follow other related articles on the PHP Chinese website!