Video canPlayType()Method
Examples
Check whether your browser can play different types of video:
var
x = document.createElement("VIDEO");
isSupp = x.canPlayType(vidType+';codecs="'+codType+'"');
isSupp = x.canPlayType(vidType+';codecs="'+codType+'"');
Try it Yourself »
Definition and Usage
The canPlayType() method checks whether the browser can play the specified audio/video type.
The canPlayType() method can return one of the following values:
- "probably" - The browser most likely supports the audio/video type
- "maybe" - The browser might support the audio/video type
- "" - (empty string) The browser does not support the audio/video type
Browser Support
![]()
![]()
![]()
![]()
![]()
All major browsers support the canPlayType() method.
Note:Internet Explorer 8 and earlier IE versions do not support this method.
Syntax
videoObject.canPlayType(type))
Parameter Values
| Value | Description |
|---|---|
| type | Specifies the audio/video type to be detected. Usually can be:
Usually refers to including a codec:
Note:If a codec is included, this method can only return "probably". |
Technical Details
| Return value: | Indicates the level of support. Possible values:
|
|---|
Video Object Other Extensions