Closed Bug 1570825 Opened 5 years ago Closed 3 years ago

navigator.mediaCapabilities.decodingInfo fails when testing for audio/ogg support

Categories

(Core :: Audio/Video: Playback, defect, P4)

68 Branch
defect

Tracking

()

RESOLVED FIXED

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.

Hi,
I'm setting the component in order to involve the development team to review this issue.

Component: Untriaged → Audio/Video: Playback
Product: Firefox → Core

I can confirm this behavior.

@drno, any thoughts on who should take a look?

Status: UNCONFIRMED → NEW
Ever confirmed: true
Flags: needinfo?(drno)
Priority: -- → P2
Blocks: media-triage
Flags: needinfo?(drno)
Severity: normal → S4
Priority: P2 → P4
No longer blocks: media-triage

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.
Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.