I am interested is there a way to play mp3 files from the phone internal memory using the built in native audio player. I am asking this, because I want to implement an equalizer too, so I am guessing I will have to work with streams.
I know for the MediaPlayer, and the Plugin.Maui.Audio, but I don't know how could I integrate the equalizer in the process.
Any nuget package that can be used as equalizer?
UPDATE:
Reading and search lead me to this plugin. I imported it to my project an tried to add an equalizer to the constructor. For test I wanted to adjust the frequency what I did at the end, but cant figure it out which band does what. Tried to read the documentation of the java implementation, but not got any smarter.
internal AudioPlayer(Stream audioStream)
{
player ??= new MediaPlayer();
player.Completion += OnPlaybackEnded;
if (OperatingSystem.IsAndroidVersionAtLeast(23))
{
stream = new MemoryStream();
audioStream.CopyTo(stream);
var mediaDataSource = new StreamMediaDataSource(stream);
equalizer ??= new Equalizer(0, player.AudioSessionId);
equalizer.SetEnabled(true);
//what am I setting here, because this works the sound changed ???
//equalizer.SetBandLevel(0, -1000);
//equalizer.SetBandLevel(1, -500);
//equalizer.SetBandLevel(2, -250);
//equalizer.SetBandLevel(3, 500);
//equalizer.SetBandLevel(4, 1000);
player.SetDataSource(mediaDataSource);
player.Prepare();
}
else
{
PreparePlayerLegacy(audioStream);
} }