openWorkout icon indicating copy to clipboard operation
openWorkout copied to clipboard

Can't play music during training.

Open Day-OS opened this issue 4 years ago • 4 comments

When starting any training while listening to music, it stops the music app. If then I restart the music, it just stops again when the exercise is over.

To Reproduce Steps to reproduce the behavior:

  1. Play a song in any music app.
  2. Start the training session.

Expected behavior Simply playing both at the same time.

Day-OS avatar Dec 01 '20 03:12 Day-OS

Indeed, just a quick research this is unfortunately not easy to implement.

oliexdev avatar Dec 02 '20 10:12 oliexdev

Maybe every time audio needs to be played, it could call a system pause, play its own sound, and then call a system play/resume? I'm not familiar enough with android dev to know if there is any kind of system call like that, but I would imagine it would be possible since in a key mapper app "Play/Pause Media Playback," "Pause Media Playback," and "Resume Media Playback" are all possible actions

jm355 avatar Dec 03 '20 15:12 jm355

Seems has to do with Audio Focus but my first try didn't work. Any help are welcome.

oliexdev avatar Dec 07 '20 13:12 oliexdev

When starting any training while listening to music, it stops the music app. If then I restart the music, it just stops again when the exercise is over.

I was having this problem also and found a fix in adjusting the settings of the audio player being silenced. In my case this was a podcast app (https://github.com/AntennaPod/). In the playback settings it has a choice between pausing audio for interruptions or just lowering volume. After switching from pausing to lowering volume I've had no problems.

I guess this a workaround as the bug in OpenWorkout seems to be that it somehow doesn't return focus after the "interruption"? But hopefully you have a similar setting in your music app, @Day-OS .

I also use a metronome app - similar to OpenWorkout in using intermittent noises - which doesn't have this issue of stopping audio playback even with the "pause for interruptions" setting. That app is Chubby Click (https://codeberg.org/agrigolo/chubby-click), in case it's useful to look at how it handles audio.

I love OpenWorkout, BTW, it's helping a lot with my rehab from a prolapsed cervical disc. Thanks so much @oliexdev for your work. I'd contribute if I knew anything about programming. But maybe I'm right in guessing the app is originally in German? Wenn ja, könnte ich zukünftig etwas übersetzen...

polyonymous avatar Jan 11 '21 14:01 polyonymous