Media Capabilities Test
by juberti
JavaScript
//Create media configuration to be tested
const h264Config = {
type : 'media-source', // or 'media-source'
video: {
contentType: 'video/mp4; codecs="avc1.4d001e"',
width: 1920,
height: 1080,
bitrate: 2646242, // number of bits used to encode a second of video
framerate: 60 // number of frames used in one second
}
};
const vp9Config = {
type : 'media-source', // or 'media-source'
video: {
contentType: 'video/webm; codecs="vp09.00.10.08"',
width: 1920,
height: 1080,
bitrate: 2646242, // number of bits used to encode a second of video
framerate: 60
}
};
// check support and performance
function tryConfig(name, config) {
navigator.mediaCapabilities.decodingInfo(config).then(result => {
console.log(result);
window.alert(name + ' is ' +
(result.supported ? '' : 'not ') + 'supported, ' +
(result.smooth ? '' : 'not ') + 'smooth, and ' +
(result.powerEfficient ? '' : 'not ') + 'power efficient.');
});
}
tryConfig('H264', h264Config);
tryConfig('VP9', vp9Config);