MediaCapabilities

MediaCapabilities interface of the 媒体能力 API provides information about the decoding abilities of the device, system and browser. The API can be used to query the browser about the decoding abilities of the device based on codecs, profile, resolution, and bitrates. The information can be used to serve optimal media streams to the user and determine if playback should be smooth and power efficient.

The information is accessed through the mediaCapabilities 特性为 Navigator 接口。

方法

MediaCapabilities.encodingInfo()
When passed a valid media configuration, it returns a promise with information as to whether the media type is supported, and whether encoding such media would be smooth and power efficient .
MediaCapabilities.decodingInfo()
When passed a valid media configuration, it returns a promise with information as to whether the media type is supported, and whether decoding such media would be smooth and power efficient .

规范

规范 状态 Comment
Media Capabilities
The definition of 'MediaCapabilities' in that specification.
草案 初始定义

浏览器兼容性

更新 GitHub 上的兼容性数据
Desktop Mobile
Chrome Edge Firefox Internet Explorer Opera Safari Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet
MediaCapabilities
Chrome 66 Edge ≤79 Firefox 63 IE ? Opera 55 Safari ? WebView Android 66 Chrome Android 66 Firefox Android 63 Opera Android 48 Safari iOS ? Samsung Internet Android 9.0
decodingInfo
Chrome 66 Edge ≤79 Firefox 63 IE ? Opera 55 Safari ? WebView Android 66 Chrome Android 66 Firefox Android 63 Opera Android 48 Safari iOS ? Samsung Internet Android 9.0
encodingInfo
Chrome 67
Disabled
67
Disabled
Disabled From version 67: this feature is behind the chrome://flags/#enable-experimental-web-platform-features preference (needs to be set to enabled ). To change preferences in Chrome, visit chrome://flags.
Edge ≤79
Disabled
≤79
Disabled
Disabled From version ≤79: this feature is behind the chrome://flags/#enable-experimental-web-platform-features preference (needs to be set to enabled ).
Firefox 63 IE ? Opera ? Safari ? WebView Android No Chrome Android 67
Disabled
67
Disabled
Disabled From version 67: this feature is behind the chrome://flags/#enable-experimental-web-platform-features preference (needs to be set to enabled ). To change preferences in Chrome, visit chrome://flags.
Firefox Android 63 Opera Android ? Safari iOS ? Samsung Internet Android No

图例

完整支持
完整支持
不支持
不支持
兼容性未知
兼容性未知
实验。期望将来行为有所改变。
实验。期望将来行为有所改变。
用户必须明确启用此特征。
用户必须明确启用此特征。

另请参阅