Automattic / pocket-casts-android

Pocket Casts Android 🎧
https://forums.pocketcasts.com
Mozilla Public License 2.0
2.57k stars 219 forks source link

Playback stopping when download of playing episode finishes #1306

Open mchowning opened 1 year ago

mchowning commented 1 year ago

Description

We've had a user (6677308-zd-a8c) report that playback is getting stopped for them when downloading a playing episode is completed. I can't recreate this, but I want to log this to see if anyone else is experiencing this.

It sounds like this is a change in behavior for them because it didn't use to happen.

We've had a few people try to recreate this without any success.

Step-by-step reproduction instructions

These are the steps reported by the user

  1. You navigate to New Releases filter (also occurs playing from a podcast screen)
  2. You tap play on the episode
  3. The podcast starts playing
  4. Pocket Cast starts download (the user has auto download episodes added to up next turned on)
  5. Episode download hits 100%
  6. Episode stops playing
  7. You hit the play button again to play and episode starts

Screenshots or screen recording

No response

Did you search for existing bug reports?

Device, Operating system, and Pocket Casts app version

Pixel 4a (5G) bramble, Android 13, Pocket Casts 7.44 (9120)

mchowning commented 1 year ago

Looking at their logs, it looks like we're getting a call from the Android media controller to stop playback after the download is finished. For example, here you can see that when the download is finished we stopped playback because of "Event from Media Session to stop", and the user then almost immediately tapped play to continue playback (this is why I think this is probably an instance of the bug).

Logs ``` I 16/8 12:38:56 Opening episode. What’s behind the increase in overdose deaths for Black Americans? Downloaded: false Downloading: false Audio: true File: https://chrt.fm/track/284E6C//traffic.megaphone.fm/BUR9303285652.mp3 Uuid: 7c50dafa-f7d2-4aac-8f16-6ddfa8a1ee1a I 16/8 12:38:56 Trying to gain audio focus I 16/8 12:38:56 Audio focus gained I 16/8 12:38:56 Audio device added: Pixel 4a (5G), Built-in speaker (safe) I 16/8 12:38:56 Audio device added: Pixel 4a (5G), Rerouting audio between mixes and system apps I 16/8 12:38:56 Play 0.000 System Player. What’s behind the increase in overdose deaths for Black Americans? Downloaded: false Downloading: false Audio: true File: https://chrt.fm/track/284E6C//traffic.megaphone.fm/BUR9303285652.mp3 Uuid: 7c50dafa-f7d2-4aac-8f16-6ddfa8a1ee1a I 16/8 12:38:56 startForeground state: 6 I 16/8 12:38:56 startForeground state: 6 I 16/8 12:39:01 UpNextSyncJob - scheduled I 16/8 12:39:01 UpNextSyncJob - onStartJob I 16/8 12:39:01 Adding What’s behind the increase in overdose deaths for Black Americans? to auto download from up next auto download I 16/8 12:39:01 Added episode to downloads. 7c50dafa-f7d2-4aac-8f16-6ddfa8a1ee1a podcast: 57aac7b0-1bdd-012e-00e0-00163e1b201c from: up next auto download I 16/8 12:39:01 UpNextSyncJob - jobFinished - 338 ms I 16/8 12:39:02 Worker Downloading episode What’s behind the increase in overdose deaths for Black Americans? 7c50dafa-f7d2-4aac-8f16-6ddfa8a1ee1a I 16/8 12:39:05 Downloaded episode What’s behind the increase in overdose deaths for Black Americans? 7c50dafa-f7d2-4aac-8f16-6ddfa8a1ee1a I 16/8 12:39:05 Episode was streaming but was now downloaded, switching to downloaded file I 16/8 12:39:05 Opening episode. What’s behind the increase in overdose deaths for Black Americans? Downloaded: true Downloading: false Audio: true File: https://chrt.fm/track/284E6C//traffic.megaphone.fm/BUR9303285652.mp3 Uuid: 7c50dafa-f7d2-4aac-8f16-6ddfa8a1ee1a I 16/8 12:39:05 LocalPlayer seekToToTimeMs 8.412 I 16/8 12:39:05 Trying to gain audio focus I 16/8 12:39:05 We already had audio focus I 16/8 12:39:06 Play 7.884 System Player. What’s behind the increase in overdose deaths for Black Americans? Downloaded: false Downloading: false Audio: true File: https://chrt.fm/track/284E6C//traffic.megaphone.fm/BUR9303285652.mp3 Uuid: 7c50dafa-f7d2-4aac-8f16-6ddfa8a1ee1a **** We get an event from the OS telling us to stop I 16/8 12:39:06 Event from Media Session to stop. Controller: au.com.shiftyjelly.pocketcasts pid: 2104 uid: 10308 I 16/8 12:39:06 Giving up audio focus I 16/8 12:39:06 Giving up audio focus. Request granted I 16/8 12:39:06 Paused - Not transient I 16/8 12:39:06 LocalPlayer onSeekComplete 7.884 I 16/8 12:39:06 Saved time in database 7.884 I 16/8 12:39:06 Saved time in database 7.884 I 16/8 12:39:06 stopForeground state: 2 (update notification) I 16/8 12:39:06 Event from Media Session to stop. Controller: au.com.shiftyjelly.pocketcasts pid: 2104 uid: 10308 I 16/8 12:39:06 Giving up audio focus I 16/8 12:39:06 Giving up audio focus. Request granted I 16/8 12:39:06 Paused - Not transient I 16/8 12:39:06 Saved time in database 7.884 I 16/8 12:39:07 Play clicked in mini player ```

I'm not aware of any other reports of this.

I do see in these logs that we somehow go from reporting that the episode has been downloaded when we're "opening" it after it is downloaded to the episode not being downloaded when we then "play" the now-opened episode. I think this is just an issue with the logs though and not related to the issue this user is seeing because I also see those same logs (first downloaded then not downloaded even though it is downloaded) when I unsuccessfully try to recreate the issue on my device.

This is a shot in the dark, but I wonder if they might be using Android Auto because some cars can sometimes send some unexpected events.

erricgunawan commented 1 year ago

Just wanted to link the report from 6677308-zen, is continued on 6703610-zen

I asked if they were using Android Auto, but realized later they had already included a screen recording that looked like from their phone. 🤦🏻‍♂️

erricgunawan commented 1 year ago

User from 6703610-zen first reported that a complete uninstall and reinstall fix the issue.

However, they followed up again and it's still an issue:

it's still stops playing after the download completes. In fact I just noticed that if I'm playing a podcast and then add another podcast to the queue, which forces a download of that podcast, once the podcast in the queue downloads it stops playing the other podcast. So it seems like anytime I download completes playback stops.

Latest report here: 6736899-zen

crowleysimon commented 2 months ago

Hi @erricgunawan @mchowning this issue has been happening to me for awhile (I've just been sort of ignoring it since it hasn't impacted me too much) but I randomly checked the github issues and stumbled upon this. Is there anyway I can help?

I can confirm some of the details mentioned here, I'm not using android auto when it happens, and it doesn't have to be the currently playing episode that downloads to cause the episode to stop. I also have essentially the same log output.

I'm on a Pixel 6a running the Android 15 beta but it would have started while I was on Android 14.