y20k / transistor

Transistor - Simple Radio App for Android
http://y20k.org/transistor/
MIT License
435 stars 122 forks source link

Transistor will play 'old' buffered broadcasts when resumed in Android Auto. #354

Closed GijsTimmers closed 2 years ago

GijsTimmers commented 3 years ago

Describe the bug When going back home from work, I usually hit the play button on Android Auto (again). Transistor will resume playing 'old' broadcasts from this morning rather than new broadcasts. After a few minutes (probably when the buffer runs out), I will hear new broadcasts.

To Reproduce Start playing music on Android Auto, exit your car, go in again after eight hours and resume.

Expected behavior Transistor to pick up new broadcasts without clearing the old stuff first.

Device: Samsung Galaxy S10e

y20k commented 3 years ago

Hi @GijsTimmers

I observed that behavior as well. It's a bit annoying. I will see what I can do.

SkyBeam commented 3 years ago

It looks like the app just does "pause" the playback when media button is pressed. I do use Transistor when riding a motorcycle and using it on the intercom. When pressing the media button the playback stops but it seems to continue fetching the stream and buffering it. Also causing data volume to be used even if there is no playback. When resuming playback it will resume from beginning of the buffer. So when it was paused for 10 minutes I continue to listen to where it stopped. So essentially it implements a timeshift feature.

After a while of playback it suddenly might jump to to "live" again. Presumably this happens when the connection is lost and re-established while cleaning the internal buffer. I would personally prefer that pressing pause will stop playback, disconnect from the streaming server and flush the buffer. Resuming would require to re-connect and buffer of course so resume would not be as instant as it is right now.

Perhaps it would make sense to be able to configure in settings if the pause/stop button shall disconnect or just stop the stream.

I also noticed that after "pause" of the stream and then closing down the app (closing the notification, closing the app in app-switcher) it still seems to continue running in background. After 2 days my phone battery stats report Transistor to be the top battery consuming app with a background activity of almost 2 days while I was using it only yesterday for about 2-4 hours (with pause-interruptions).

So I think there is something fishy. The app might continue in the background to buffer the stream until a (quite large) buffer is full. Also the data usage reported is higher than expected which indicates the app might still keep streaming even if the stream is paused.

y20k commented 3 years ago

I think I found a solution for this issue. I will keep you updated. I am a bit busy at my real job, so progress might take a while.

GijsTimmers commented 3 years ago

Could you perhaps publish a new APK?

y20k commented 3 years ago

I am a bit busy at my real job

I could. Maybe tomorrow.

There might be one catch. I am not sure, if you can run an APK that is not from the Play Store on Android Auto. Have you done that before? If you are using the Android Auto app on your phone you need to enable Developer Mode and Unknown sources: https://developer.android.com/training/cars/testing#step1

Still interested ;-) ?

y20k commented 3 years ago

Here an APK based on c846891

Have fun :-)

GijsTimmers commented 3 years ago

That's lovely!

I ran your APK over the past couple of days on my phone and Android Auto, and everything seems to work well. Thanks for pushing the APK!

The only possibly unwanted side-effect I experienced was that some streams apparently first broadcast an ad when playing the stream. This resulted in having to hear an ad another time after resuming the stream.

y20k commented 3 years ago

Great. In the meantime I have been testing headphone controls (with this version) and there too were no issues. I think I will publish a new version of Transistor next week.

Thanks for your help!

GijsTimmers commented 3 years ago

Thank you!

Spielmops commented 2 years ago

It's Ok now. Try the newversion.

Spielmops