Baseflow / XamarinMediaManager

Cross platform Xamarin plugin to play and control Audio and Video
https://baseflow.com
MIT License
769 stars 306 forks source link

Java.Lang.NoClassDefFoundError com.google.android.exoplayer2.source.ConcatenatingMediaSource #886

Closed Hobbit7 closed 1 year ago

Hobbit7 commented 1 year ago

🐛 Bug Report

I always get an error only a few seconds after starting my Android project on my Samsung tablet. I use the NuGet package Plugin.MediaManager 1.2.0 in my Android project. In addition, I use .NET 7.0, Target Android version 13.0 and Minimum Android version 12.0. Java.Lang.NoClassDefFoundError com.google.android.exoplayer2.source.ConcatenatingMediaSource

Error message image

I don't get this error when I use the NuGet package Plugin.MediaManager 1.1.1 in my Android project. Is this error a bug?

martijn00 commented 1 year ago

Try use the 1.2 version or later.

Hobbit7 commented 1 year ago

It's not always working in every Android project with version 1.2.2. I have created a new empty project and there it works on Android with version 1.2.2., but in another Android project where I execute MediaManager in a shared code project it never works and I still get the exception. I execute CrossMediaManager.Current.Init(this); in the working and the not working Android project in protected override async void OnCreate(Bundle bundle).

In the working Android project the code in (CrossMediaManager.Current.IsPrepared()) is executed and MediaPlayerState is Playing. Image when the song is played: https://ibb.co/qdmn613

In the not working Android project the code in (CrossMediaManager.Current.IsPrepared()) is not executed and MediaPlayerState is always Stopped. Image when the song is not played: https://ibb.co/C8htdFs

I get the exception in the not working Android project if I use this line of code before I start playing a song: CrossMediaManager.Current.RepeatMode = MediaManager.Playback.RepeatMode.Off; But in the working Android project I don't get the exception when I execute exactly the same line of code before I start playing the same song. Image of the exception: https://ibb.co/0sS34H2

I used this song for testing: await CrossMediaManager.Current.Play("https://ia800806.us.archive.org/15/items/Mp3Playlist_555/AaronNeville-CrazyLove.mp3");

In version 1.1.1 I don't get the exception and the song is playing. But I need to execute this line of code in version 1.1.1 before I start paying a song, without this code the song is not playing. CrossMediaManager.Current.RepeatMode = MediaManager.Playback.RepeatMode.Off;

Why is version 1.2.2 not working in every Android project? And why am I getting the exception in one of my Android projects when I use version 1.2.2?