melihercan / WebRTCme

A cross-platform framework for adding WebRTC support to .NET MAUI, Blazor, and Desktop applications by using a single unified .NET/C# API.
https://github.com/melihercan/WebRTCme
MIT License
232 stars 46 forks source link

android APIs 24-26 not supported and giving this error after giving permissions #1

Closed alzubitariq closed 3 years ago

alzubitariq commented 3 years ago

Java.Lang.NoSuchMethodError: 'no non-static method "Landroid/media/AudioManager;.getMicrophones()Ljava/util/List;"'

alzubitariq commented 3 years ago

to handle that backwards compatible , I think you have to check WebRTCme project => Android =>MediaStream class and replace this

var id = audioManager.Microphones[0].Id;

with this int id = 0; if (Build.VERSION.SdkInt >= BuildVersionCodes.P) { id = audioManager.Microphones[0].Id; } else { AudioDeviceInfo[] deviceInfo = audioManager.GetDevices(GetDevicesTargets.Inputs); id = deviceInfo[0].Id; }

melihercan commented 3 years ago

Thanks for the tip, I will add it to the code.