Navigator:mediaCapabilities 属性
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since January 2020.
Navigator
接口的 Navigator.mediaCapabilities
只读属性返回一个 MediaCapabilities
对象,该对象可以暴露有关给定格式的解码和编码能力以及由媒体能力 API 定义的输出能力的信息。
值
一个 MediaCapabilities
对象。
示例
js
navigator.mediaCapabilities
.decodingInfo({
type: "file",
audio: {
contentType: "audio/mp3",
channels: 2,
bitrate: 132700,
samplerate: 5200,
},
})
.then((result) => {
console.log(`${result.supported ? "" : "不"}支持此配置,`);
console.log(`${result.smooth ? "" : "不"}流畅,`);
console.log(`${result.powerEfficient ? "" : "不"}节能。`);
});
规范
Specification |
---|
Media Capabilities # dom-navigator-mediacapabilities |
浏览器兼容性
Report problems with this compatibility data on GitHubdesktop | mobile | server | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
mediaCapabilities |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
- No support
- No support
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.