navigator.mediaCapabilities.decodingInfo fails when testing for audio/ogg support
Categories
(Core :: Audio/Video: Playback, defect, P4)
Tracking
()
People
(Reporter: mark, Unassigned)
Details
User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Firefox/68.0
Steps to reproduce:
I ran the sample code from here:
https://developer.mozilla.org/en-US/docs/Web/API/MediaCapabilities/decodingInfo
which looks like this:
<script>
//Create media configuration to be tested
const mediaConfig = {
type : 'file', // or 'media-source'
audio : {
contentType : "audio/ogg", // valid content type
channels : 2, // audio channels used by the track
bitrate : 132700, // number of bits used to encode 1s of audio
samplerate : 5200 // number of audio samples making up that 1s.
},
};
// check support and performance
navigator.mediaCapabilities.decodingInfo(mediaConfig).then(result => {
console.log('This configuration is ' +
(result.supported ? '' : 'not ') + 'supported, ' +
(result.smooth ? '' : 'not ') + 'smooth, and ' +
(result.powerEfficient ? '' : 'not ') + 'power efficient.')
});
</script>
Actual results:
Running Firefox 68.0.1 64-bit under both Linux and OS X, the following exception is raised:
TypeError: The expression cannot be converted to return the specified type.
Expected results:
If I change "audio/ogg" to "audio/mp3", I see the expected:
This configuration is supported, smooth, and power efficient.
If I change to an invalid mime type like "audio/foobar", I also see the expected:
This configuration is not supported, not smooth, and not power efficient.
Comment 1•5 years ago
|
||
Hi,
I'm setting the component in order to involve the development team to review this issue.
Comment 2•5 years ago
|
||
I can confirm this behavior.
@drno, any thoughts on who should take a look?
Updated•3 years ago
|
Updated•3 years ago
|
Updated•3 years ago
|
I believe this is now working as intended. Running code from comment 0 gives:
Uncaught (in promise) TypeError: The provided type 'audio/ogg' does not have a 'codecs' parameter.
I assume because in the case of ogg, Gecko cannot provide an appropriate determination without knowing the codec (where in the case of "audio/mp3" the codec can be inferred).
Using
const mediaConfig3 = {
type : 'file', // or 'media-source'
audio : {
contentType : "audio/ogg; codecs=vorbis", // valid content type
channels : 2, // audio channels used by the track
bitrate : 132700, // number of bits used to encode 1s of audio
samplerate : 5200 // number of audio samples making up that 1s.
},
};
and
navigator.mediaCapabilities.decodingInfo(mediaConfig3).then(result => {
console.log('This configuration is ' +
(result.supported ? '' : 'not ') + 'supported, ' +
(result.smooth ? '' : 'not ') + 'smooth, and ' +
(result.powerEfficient ? '' : 'not ') + 'power efficient.')
});
in my browser console reports as expected:
This configuration is supported, smooth, and power efficient.
Created https://github.com/mdn/content/pull/8537 to track correcting the MDN page.
Description
•