Baseflow / XamarinMediaManager

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

Cross Media Manager Init issue when change the android target SDK to 31 - mutability flag #845

Closed pasha-o closed 2 years ago

pasha-o commented 2 years ago

🐛 Bug Report

As soon as I updated the android target SDK to 31(Android S), a Missing PendingIntent mutability flag appeared on the line CrossMediaManager.Current.Init(this)

Java.Lang.IllegalArgumentException Message=[] Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent. Strongly consider using FLAG_IMMUTABLE, only use FLAG_MUTABLE if some functionality depends on the PendingIntent being mutable, e.g. if it needs to be used with inline replies or bubbles.

Expected behavior

should work without throwing an exception

Reproduction steps

change the target to target SDK to 31(Android S) compile and run

Configuration

Version: 1.0.9

Platform:

DetlefSauerbrei commented 2 years ago

Having the same issue. After updating device to API 31, all apps that use Mediamager crash while CrossmediaManager.Current.Init() is called. To reproduce simply run any app using Mediamanager.Forms on emulator or device running Android 12.

valentin-debris commented 2 years ago

I confirm the error comes from this plugin for my app, I removed the nuget and imported directly the code in my app, and when I starts the app, it shows me the error in MediaManager/Platforms/Android/MediaManagerImplementation.cs, line 95. I added "PendingIntentFlags.Immutable" instead of the last 0 and now it works.

So @martijn00 , can you provide a new version (/!\ it needs to be backward compatible, as the flag only exists since API 23) with this fix soon, as it will impact everyone as soon as they update to Android 12 ?

Thanks

valentin-debris commented 2 years ago

Hi @martijn00 , when do you think the new version of the nugget with this fix will be available ?

Regards

abdu292 commented 2 years ago

@martijn00 A release with this fix would be much appreciated.

@valentin-debris Thanks for the fix!

vincentchunwei commented 2 years ago

Hi @valentin-debris , I directly the code in my app too, but when I play the audio on Android 12, that doesn't have any sound. Did you occurred this problem?

pasha-o commented 2 years ago

hi, @martijn00 I opened this ticket in 2021, a simple compile shouldn't take this long for it to work on android 12 - any update on the nugget?

pasha-o commented 2 years ago

Hi @martijn00 is the issue fixed when you closed it? Is there a releasable nuget?

vincentchunwei commented 2 years ago

Hi @martijn00 , when I update to 1.1.1 version, I can't still hear any sound when I play the audio on Android 12. Did you ever occur this problem?

gamertrumpfi commented 2 years ago

the same issue was occuing for me @vincentchunwei . It now actually woked for me. I had one android 11 targeting xamarin csproj left and after that was raised to 12 i could hear audio again

DetlefSauerbrei commented 2 years ago

Same here. If I use the Sourcecode instead package and just go step-by-step thru, sound plays....


Gesendet mit der Telekom Mail App https://kommunikationsdienste.t-online.de/redirects/email_app_android_sendmail_footer

--- Original-Nachricht --- Von: gamertrumpfi Betreff: Re: [Baseflow/XamarinMediaManager] Cross Media Manager Init issue when change the android target SDK to 31 - mutability flag (Issue #845) Datum: 09. Mai 2022, 16:55 An: Baseflow/XamarinMediaManager Cc: DetlefSauerbrei, Comment

the same issue is occuing for me @vincentchunwei https://github.com/vincentchunwei . Thank you for pointing it out. It would be good if sound would acually work.

— Reply to this email directly, view it on GitHub https://github.com/Baseflow/XamarinMediaManager/issues/845#issuecomment-1121211044 , or unsubscribe https://github.com/notifications/unsubscribe-auth/AUV7DJQF4A3IULVJAJ2YHZLVJEROLANCNFSM5KXKYXYQ . You are receiving this because you commented.Message ID: @.***>

lobons commented 2 years ago

Hi @martijn00 after updating to version 1.1.1 I'm able to play the video on Android 12 only with a "trick" on debug mode (can't find a way for release) : Set a breakpoint and exploding "CrossMediaManager.Current.*" to look the properties , at that moment if I click on "continue" the streaming starts. There's no other way that worked for me on Android 12; the same code that doesn't work with 12 is working great with Android 11,10 and 9 and also with iOS.

I attach a short video to show what I mean with "trick"... https://user-images.githubusercontent.com/52449396/167838864-0ad037dc-99f5-41b0-a845-1d876cf9cb05.mp4

Anyone can help with this??