MediaDecodingConfiguration dictionary of the 媒体能力 API is used to define the type of media being tested when calling MediaCapabilities.decodingInfo() to query whether a specific media configuration is supported, smooth, and/or power efficient.

特性

A MediaDecodingConfiguration dictionary takes two properties:

  • type — the type of media being tested. This takes one of two values:
    • file : Represents a configuration that is meant to be used for a plain file playback.
    • media-source : Represents a configuration that is meant to be used for playback of a MediaSource .
  • A media configuration — a VideoConfiguration or AudioConfiguration 字典。

范例

//Create media configuration to be tested
const mediaConfig = {
    type : 'file', // or 'media-source'
    video : {
        contentType : "video/webm;codecs=vp8", // valid content type
        width : 800,     // width of the video
        height : 600,    // height of the video
        bitrate : 10000, // number of bits used to encode 1s of video
        framerate : 30   // number of frames making up that 1s.
     }
};
// check support and performance
navigator.mediaCapabilities.decodingInfo(mediaConfig).then(result => {
    console.log('This configuration is ' +  (result.supported ? '' : 'not ') + 'supported.')
});
					

规范

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

浏览器兼容性

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.

No compatibility data found. Please contribute data for "api.MediaDecodingConfiguration" (depth: 1) to the MDN 兼容性数据存储库 .

另请参阅

元数据

  • 最后修改: