Automattic / pocket-casts-ios

Pocket Casts iOS app 🎧
Mozilla Public License 2.0
1.65k stars 131 forks source link

Watch app should pause play during announcements from other apps #2245

Open ajkessel opened 1 week ago

ajkessel commented 1 week ago

Description

Other Watch-based podcast apps pause (or can be configured to pause) when another app interrupts with an announcement, for example, a fitness app milestone or a GPS app instruction. With Pocketcasts, the third-party app speaks over the podcast, making it difficult to hear both. I believe it would be a better UX to have Pocketcasts pause when another app is speaking, or at least have the option to enable that behavior.

Screenshots or screen recording

No response

Did you search for existing list?

rviljoen commented 3 days ago

For some reason we set the AVAudioSessionMode for the phone to AVAudioSessionModeSpokenAudio, but for the watch it is set it to AVAudioSessionModeDefault:

https://github.com/Automattic/pocket-casts-ios/blob/159985d691e1085556ab3d8536fce3a4facc12ad/podcasts/PlaybackManager.swift#L1268-L1275

According to the Apple documentation, the correct option is AVAudioSessionModeSpokenAudio:

This mode is appropriate for apps that play continuous spoken audio, such as podcasts or audio books. Setting this mode indicates that your app should pause, rather than duck, its audio if another app plays a spoken audio prompt. After the interrupting app’s audio ends, you can resume your app’s audio playback.

Looking at the code history, this distinction between Watch and Phone has been there since the first open source submission. The Changelog does reference this functionality in v6.0 Build 338, which predates the open source code base:

  • App now supports pausing for navigation instead of having it duck so that you miss your podcast

@leandroalonso Can someone from the team please check the earlier commit history to see if there is a reason for the distinction between the two platforms?

danielebogo commented 3 days ago

@rviljoen the change was made in 2020 but there's no specific reason explained in the PR or commit, except for modify watch audio session methods to suit

Image

rviljoen commented 3 days ago

@danielebogo Thanks! Was this part of a bigger watch project, or isolated commit? There must have been a good reason for the change.

danielebogo commented 3 days ago

It's hard to say as I don't have access to other data. But my guess is that the PR was about making the PlaybackManager compatible for watchOS. So it wasn't a change but a direct addition of the setCategory with default for the watchOS. And I think it has been set like that since that day.

rviljoen commented 3 days ago

That was my initial thought as well, but AVAudioSessionModeSpokenAudio was introduced in WatchOS 2 back in 2015, so it's strange that it was changed back to default.

ajkessel commented 3 days ago

Happy to test a build with this setting changed and report any issues. I'm already on TestFlight for the app.