Auto playback on BT connect

Issue description:

I’m not sure if the is an issue or not, but am struggling with automatic playback when starting a BT device, or switching devices.

Logs:

Upload description: telrod11

Additional information:

 
I’ve had this intermittently since Android 15.

I’ve turned off internal DSP thinking that might be the cause.

As stated, this is intermittent, and per usual, could just be something I’m doing wrong on my end.

 

Reproduction steps:

 
The logs uploaded show playback that was started with a manual reload (my term) of the queue. It wouldn’t start automatically with a BT headset connect
 

Media provider:

Local device

Screenshots:

     

Well it’s you again :frowning:

2024-10-17 05:43:10.374 Verbose PlayerService  Manifest ACTION_CONNECTION_STATE_CHANGED received
2024-10-17 05:43:10.374 Verbose PlaybackController  Play

Symfonium works perfectly fine then :

2024-10-17 05:44:04.408 Verbose ApiReceiver  API call: app.symfonium.api.MEDIA_COMMAND - RANDOM : -1277503866
 Verbose  - COMMAND : playpause
2024-10-17 05:44:04.419 Verbose PlaybackController  Play/Pause
2024-10-17 05:44:04.455 Verbose MusicPlayer  New audio focus: 2
2024-10-17 05:44:05.814 Verbose ApiReceiver  API call: app.symfonium.api.MEDIA_COMMAND - RANDOM : -1277503866
 Verbose  - COMMAND : playpause
2024-10-17 05:44:05.817 Verbose PlaybackController  Play/Pause
2024-10-17 05:44:05.846 Verbose MusicPlayer  New audio focus: 2
2024-10-17 05:44:06.617 Verbose ApiReceiver  API call: app.symfonium.api.MEDIA_COMMAND - RANDOM : -1277503866
 Verbose  - COMMAND : playpause
2024-10-17 05:44:06.620 Verbose PlaybackController  Play/Pause
2024-10-17 05:44:06.663 Verbose MusicPlayer  New audio focus: 2
2024-10-17 05:44:07.754 Verbose ApiReceiver  API call: app.symfonium.api.MEDIA_COMMAND - RANDOM : -1277503866
 Verbose  - COMMAND : playpause
2024-10-17 05:44:07.764 Verbose PlaybackController  Play/Pause
2024-10-17 05:44:07.792 Verbose MusicPlayer  New audio focus: 2
2024-10-17 05:44:08.344 Verbose ApiReceiver  API call: app.symfonium.api.MEDIA_COMMAND - RANDOM : -1277503866
 Verbose  - COMMAND : playpause
2024-10-17 05:44:08.352 Verbose PlaybackController  Play/Pause

You send 5 times the play/pause command via the API
And I’ll let you do the math, but 1 play followed by 5 play/pause toggle ends with a paused status …

Yep, me again.

Different device
Different OS (v15)

So, you believe these are coming from an outside app?

I do have Tasker doing some BT stuff on connection. That’s the only thing I can think of that might be interacting. I’ll disable Tasker and see if it is the culprit, and report back .

It cames from external app or widgets.

But in all cases the app is killed in background it’s restarted and loading it’s queue then those commands arrive before it’s finished loading ending up in a paused state.

Ok, it’s not Tasker.

I disabled it and rebooted, and am getting the same.

I don’t have any other interactions with SF other than Tasker, and the SF widgets themselves, that I know of.

I had this when I first got the new pixel, and I reinstalled SF, and have been struggling with auto play since.

Can you think of anything else that could be sending those, that might be totally unrelated to SF?

So I just told you it can come from the widget and you say you use the widgets :slight_smile:

I explained you what happened in those logs too.

So if the app is killed and you plug then you need to wait for the app to restore it’s states and everything, there’s no need to spam buttons on the widgets.

I do “use” the widgets, but that’s not what I am hitting when it won’t play…

(If this is what you’re saying here…)

All i do is :
Turn on the BT device
Wait 30+ seconds

When no playback, I then hit the “Play” button on the headset.

Well then you need to find out why those API calls are sent.

Remove the widgets and test again with new logs?

All I can see is the logs.

Well, thanks for looking at this .

Deleted the Symfonium widgets from my screens

Took the headset from the case 4X, with a small pause in between.

Never hit play, and never got any playback

New logs telrod11-1

Ok so I missed the impact of some stupid change by Google on Android 15 …

Restrictions on requesting audio focus
Apps that target Android 15 (API level 35) must be the top app or running a foreground service in order to request audio focus. If an app attempts to request focus when it does not meet one of these requirements, the call returns AUDIOFOCUS_REQUEST_FAILED.

You can learn more about audio focus at Manage audio focus.

So we should request the focus before playing and going foreground according the docs but we also need to go foreground before requesting focus at the same time.

And of course we are not allowed to go foreground from the background …

So fucked up …

I so fucking hate Google stupid changes that removes features on each releases.

I’ll see what I can do, but basically it will require that users disable battery restriction on the app to allow to go foreground from background, and a rewrite to go foreground before requesting focus on Android 15 so stupid as use more battery and ressources for nothing if we can’t get the focus.
Google really never think of actual usages and does not see the aberration in it’s docs.

1 Like

I’m sorry to be the one to dump this on you.

If it makes you feel any better, the Tasker dev has had to write code (in a separate GitHub download) that we now have to use to "get around " the Google restrictions that take away every day usability

Thanks again for this.

So no the Google docs are wrong, even with a foreground services we can’t request focus without user interaction …

So for the moment no real solution, you’ll probably need to click the widgets or the play command on your bt devices.

I’m sure these are different Google libraries, but just reporting that auto play works as it should with android auto.

Yes unrelated, AA is in foreground and bind so Symfonium is then foreground and have no problem.

1 Like

Figured as much, thanks

[Symfonium support] [Changelog] Version 11.4.0 Beta 5

Changed:

Back to targeting Android 14, due to Android 15 bug with AudioFocus. Hopefully they’ll fix to avoid loosing features when we are forced to target Android 15.

Is this the fix for my Android 15 Autoplay? :slight_smile: (fingers crossed)

This is not a fix, this is a temporary workaround, Google will force me to target Android 15 later :slight_smile:

Google → Tolriq ← Users

Seems to me your always the target :slight_smile:

You have no idea :slight_smile:

Next month I need to validate my account and ton of things and if it fails due to stupid reviewer or bots then I’m banned and loose everything and all the apps are removed. Fun right ? :slight_smile:

During the addition of Google Drive, Google decided that apps required a full validation of all the code that took months but was free so I still did it.
And now they have changed their mind and I’ll need to pay 550$ every years to a random company for the validation and loose a ton of times just because they do not offer the proper API.

So I’ll actually loose money to keep supporting Google Drive + loosing money in the long run for the ko-fi licences + + + + +

This is really not fun to have to deal with Google.

I wonder if its any easier on the IOS side?

Used to be, everyone wanted Android, because of its open-ness, and now, G is locking everything up just like Apple does.