HTML DOM Video canPlayType () method
Examples
Detect 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"
Definition and Usage
canPlayType () method to specify whether the browser can play audio / video type.
canPlayType () method returns one of the following values:
- "Probably" - the most likely to support the browser of the audio / video type
- "Maybe" - perhaps the browser supports the audio / video type
- "" - (Null string) browser does not support the audio / video type
Browser Support
All major browsers support canPlayType () method
Note: Internet Explorer 8 and earlier versions of IE does not support this method.
grammar
videoObject .canPlayType( type ))
Parameter Value
值 | 描述 |
---|---|
type | 描述要检测的音频/视频类型。 通常可以是:
通常指,包含解码器:
注意: 如果包含了解码器,该方法只可能返回"probably"。 |
technical details
return value: | He expressed support level. Possible values:
|
---|
Video Object