Switching between WiFi/4G

MAFA version: 1.9.2
Android version: 13
Device model: Sony Xperia 5 III
MPD version: 23.5

Hi,
The app works well with both WiFi and 4G, but the music always stops when switching. For example when exit our house to work with our garden, as I get to far from the router and the phone switches to 4G (or 5G) the music stops and I have to push the play button. It also stops the other way when I come close to the house again. To avoid this, I have to stop the WiFi connection manually and be connected to my MPD server over Internet. I have not this problem with other apps. I do not think that it is something with my MAFA or MPD settings, but I’m not completely sure.
Best regards
Peter

Hi Peter,

Are you using HTTP streaming when it happens?

The only cases when MAFA sends a “stop” command to MPD without user interaction are in HTTP streaming. One case is when MAFA is losing audio focus (another app needs to use audio), and the other is when “Becoming noisy” (a headphone or external speaker is disconnected, this can be changed in the settings).

I was unable yet to reproduce what you described. Just turning on/off cellular or Wi-Fi networks doesn’t cause it. So I’ll have to test what happens when going out of range of Wi-Fi, and why it is different.

Hi Alex, thanks for your fast reply, yes I’m using HTML and it’s not “becoming noisy”. Is it possible to give MAFA exclusive permission to use the android audio when using the app?

I’m still not sure what causes what you describe.

Are you using the internal player for HTTP streaming or an external player?

What I can try for next version is to make audio focus loss optionally pause instead of stop the player.

Normally I use the internal player but it is the same when I am using VLC. Today I found out that the same problem appears when my Xperia changes between 4G and 5G. Our house is on the limit of 5G coverage so the phone only sometimes get a 5G connection.

It would be nice if you add the option “audio focus loss optionally pause” for next version. I hope that will solve my problem.

When using an external player MAFA doesn’t maintain audio focus (it’s the responsibility of the external player), which makes the audio focus loss less of a probable cause for MPD to stop playing like you described.

In all my testing I could not make network switching cause MAFA to stop MPD playing. It always resumes streaming after re-connecting (MPD playing is not stopped).

I’ll have to keep investigating this.

Just to be clear: are you connecting to the same MPD instance by the same address/hostname in both cellular network and Wi-Fi ?

Yes, it is the same MPD instance by the same address/hostname". My ISP don’t offer static IP so I’m using “No-Ip” to reach the PC running my MPD installation. The OS is Ubuntu 22.04 LTS. I’m using portforward in my router to reach “the MPD PC”.

Please try version 1.9.3 (released 2023-07-09T21:00:00Z).

The change in this version is that HTTP streaming will detect network availability to reconnect and resume playing after network loss (assuming the problem was connection loss and not that playback was stopped).

Hi Alex,
Just gave it a try and it seems to work fine now. Thank you very much for your support and your efforts!