2

Is there a way to check what WebRTC audio and video codecs are supported by the browser?

I have searched around but I can't seem to find a solution.

UPDATE

To be more precise, I want to be able to get a list of browser-supported audio and video codecs automatically.

Something like the pseudo-code below:

const supportedAudioCodecs = getBrowserAudioCodecs()
// supportedAudioCodecs => { 'mp3', ... }

const supportedVideoCodecs = getBrowserVideoCodecs()
// supportedVideoCodecs => { 'mp4', ... }

I don't want to have to check if a specific codec exists. I just want to be able to get the supported ones. Since these things change, I always want to have updated supported codecs from the browser in some way.

I hope this is clearer.

Cacious
  • 137
  • 1
  • 14
  • 1
    Does This Help? https://github.com/robymus/webrtc-codec-support – mrtechtroid Apr 14 '22 at 14:29
  • @mrtechtroid I tried that but it didn't work, check the following link: Maybe I am making a mistake somewhere. All the code there is from the link you provided. You can find my code here: https://codesandbox.io/s/typescript-playground-export-forked-8xcw1k – Cacious Apr 14 '22 at 16:19
  • Your code works for me in Chrome `Version 100.0.4896.75 (Official Build) (x86_64)`. Console logs "supported true". What browser are you using? – giavac Apr 15 '22 at 09:39
  • @Cacious See if [this Answer](https://stackoverflow.com/a/71924560/2057709) is helpful to you (or inspires a possible solution). – VC.One Apr 28 '22 at 00:46

1 Answers1

2

Not really an out of the box answer, but I think this link is quite usefull : codec capabilities

There is a 10 mins video, explaining the code used to find the codecs supported and some good comments. You can also find there the fiddle link for the code they are using.

The code generate a list of all codecs supported on the browser on send and receive end, not the same at my surprise. I am very new to all of this ^^

In the video/fiddle they are mainly talking about video codec capabilities but it is really easy to adapt this for audio codec too You can see in the script.js file of this link

I tested it on different browser / hardware it seems coherent.

Hope it helps

Loulou BadWeed
  • 146
  • 1
  • 6
  • While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. - [From Review](/review/late-answers/31949241) – TikTaZ Jun 07 '22 at 13:28