MediaRecorder.isTypeSupported
MediaRecorder.isTypeSupported()
方法会判断其 MIME 格式能否被客户端录制。
语法
var canRecord = MediaRecorder.isTypeSupported
(mimeType)
参数
mimeType
- 需要检查的MIME 格式
返回值
如果 MediaRecorder
在浏览器上的具体实现能够支持指定MIME类型的 Blob
对象就返回true. 如果没有足够的资源来支持录制和编码任务,最终录制依然会失败. 如果返回结果是false, 用户的浏览器就无法录制指定的格式.
Example
var types = ["video/webm",
"audio/webm",
"video/webm\;codecs=vp8",
"video/webm\;codecs=daala",
"video/webm\;codecs=h264",
"audio/webm\;codecs=opus",
"video/mpeg"];
for (var i in types) {
console.log( "Is " + types[i] + " supported? " + (MediaRecorder.isTypeSupported(types[i]) ? "Maybe!" : "Nope :("));
}
规格说明
具体格式 | 状态 | 注释 |
---|---|---|
MediaStream Recording isTypeSupported() |
Working Draft | Initial definition. |
浏览器的支持情况
We're converting our compatibility data into a machine-readable JSON format.
This compatibility table still uses the old format,
because we haven't yet converted the data it contains.
Find out how you can help! (en-US)
名称 | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
---|---|---|---|---|---|
基本支持 | ibenompatChrome(47.0)}} | 25.0 (25.0) | ? | ? | ? |
名称 | Android | Android Webview | Firefox Mobile (Gecko) | Firefox OS | IE Mobile | Opera Mobile | Safari Mobile | Chrome for Android |
---|---|---|---|---|---|---|---|---|
基本支持 | 未实现 | 未实现 | 47 | 25.0 (25.0) | ? | ? | ? | 47.0 |