MediaRecorder: isTypeSupported() static method
The isTypeSupported()
static method of the MediaRecorder
interface returns a Boolean
which is true
if the MIME media type specified is one the user agent should be able to successfully record.
Syntax
js
MediaRecorder.isTypeSupported(mimeType)
Parameters
mimeType
-
The MIME media type to check.
Return value
A Boolean
, true
if the MediaRecorder
implementation is capable of recording Blob
objects for the specified MIME type.
Recording may still fail if there are insufficient resources to support the recording and encoding process.
If the value is false
, the user agent is incapable of recording the specified format.
Examples
js
const types = [
"video/webm",
"audio/webm",
"video/webm;codecs=vp8",
"video/webm;codecs=daala",
"video/webm;codecs=h264",
"audio/webm;codecs=opus",
"video/mp4",
];
for (const type of types) {
console.log(
`Is ${type} supported? ${
MediaRecorder.isTypeSupported(type) ? "Maybe!" : "Nope :("
}`,
);
}
Specifications
Specification |
---|
MediaStream Recording # dom-mediarecorder-istypesupported |
Browser compatibility
BCD tables only load in the browser