Closed adiamante closed 4 weeks ago
I'm going to test START_NOT_STICKY
and see if that fixes the issue. If it does I will create a PR. TY @adiamante for the troubleshooting :)
I have had the community toolkit sample app running in background, with chrome open in the foreground. It has been running for 10 min looping a video from sample app. It has no issues with background playback. Have u tested on a physical device? I am going to test on that now.
@ne0rrmatrix I'm able to replicate on an Android 13 Motorola Edge. Which emulator did try with?
Was able to replicate with both Pixel 5 emulator and physical device just now
I'm running it on a Samsung a34 with android 14. It has been looping through video for 10 min now while I have this open and the phone screen off for most of the time. I am using the sample app from community toolkit to test.
Can u try the toolkit sample and see if I can replicate the behavior u described?
You're refering to CommunityToolkit.Maui.Sample?
@ne0rrmatrix I don't think ShouldLoopPlayback changes the Source. Can you try my sample app?
I figured it out. I will have a fix out later today. The service ends each time you switch source. The service can't restart when not in foreground. If it is backgrounded and service exit's it cannot restart unless in foreground. I tested the fix. It appears to work.
@ne0rrmatrix Thank you sir 🙏
Is there an existing issue for this?
Did you read the "Reporting a bug" section on Contributing file?
Current Behavior
When automatically changing MediaElement Source when app is not in the foreground, media playback notification disappears and I get the following error:
Expected Behavior
When automatically changing MediaElement Source when app is not in the foreground, medi playback notification does not disappear.
Steps To Reproduce
Link to public reproduction project repository
https://github.com/adiamante/mediaelementtest
Environment
Anything else?
I did some digging around and it's possible that this is an issue with OnStartCommand returning StartCommandResult.Sticky : google issue tracker 307329994
https://github.com/CommunityToolkit/Maui/blob/cc1fb686815587076bbad45a1903f3ec3039315d/src/CommunityToolkit.Maui.MediaElement/Services/MediaControlsService.android.cs#L66