MediaCapabilitiesInfo
接口在
媒体能力 API
is made available when the promise returned by the
MediaCapabilities.encodingInfo()
or
MediaCapabilities.decodingInfo()
methods of the
MediaCapabilities
interface fulfills, providing information as to whether the media type is supported, and whether encoding or decoding such media would be smooth and power efficient.
MediaCapabilitiesInfo
interface contains three Boolean attribues:
supported
: Given the properties defined in the
MediaConfiguration
, can the specified piece of media content be encoded (if
MediaEncodingConfiguration
is set) or decode (if
MediaDecodingConfiguration
is set) at all? If yes,
supported
is
true
. Otherwise, it is
false
.
smooth
: Given the properties defined in the
MediaConfiguration
, will the playback of the specified piece of media be high quality? Will it be smooth? If
supported
is
true
, and playback will be smooth,
smooth
is
true
, Otherwise, is it
false.
powerEfficient
: Given the properties defined in the
MediaConfiguration
, will the playback of the specified piece of media be power efficient? If
supported
is
true
, and playback will be power efficient,
powerEfficient
is
true
, Otherwise, is it
false.
Browsers will report a supported media configuration as
smooth
and
powerEfficient
until stats on this device have been recorded. All supported audio codecs are reported to be power efficient.
//MediaConfigurationto be tested const mediaConfig = { type : 'file', audio : {contentType : "audio/ogg", channels : 2, bitrate : 132700, samplerate : 5200}, }; // check support and performance navigator.mediaCapabilities.decodingInfo(mediaConfig).then(result => { // result contains the media capabilities information console.log('This configuration is ' + (result.supported ? '' : 'not ') + 'supported, ' + // Can the media, as configured, be decoded by the user agent (result.smooth ? '' : 'not ') + 'smooth, and ' + // is it smooth? (result.powerEfficient ? '' : 'not ') + 'power efficient.') // is it power efficient? });
| 规范 | 状态 | 注释 |
|---|---|---|
|
Media Capabilities
The definition of 'MediaCapabilitiesInfo' in that specification. |
草案 | 初始定义 |
| 桌面 | 移动 | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
MediaCapabilitiesInfo
|
Chrome 66 | Edge ≤79 | Firefox 63 | IE ? | Opera ? | Safari ? | WebView Android 66 | Chrome Android 66 | Firefox Android 63 | Opera Android ? | Safari iOS ? | Samsung Internet Android 9.0 |
powerEfficient
|
Chrome 66 | Edge ≤79 | Firefox 63 | IE ? | Opera ? | Safari ? | WebView Android 66 | Chrome Android 66 | Firefox Android 63 | Opera Android ? | Safari iOS ? | Samsung Internet Android 9.0 |
smooth
|
Chrome 66 | Edge ≤79 | Firefox 63 | IE ? | Opera ? | Safari ? | WebView Android 66 | Chrome Android 66 | Firefox Android 63 | Opera Android ? | Safari iOS ? | Samsung Internet Android 9.0 |
supported
|
Chrome 66 | Edge ≤79 | Firefox 63 | IE ? | Opera ? | Safari ? | WebView Android 66 | Chrome Android 66 | Firefox Android 63 | Opera Android ? | Safari iOS ? | Samsung Internet Android 9.0 |
完整支持
兼容性未知
实验。期望将来行为有所改变。
MediaCapabilitiesInfo