Closed puckey closed 2 years ago
Along with this, we should clarify if it is required to listen and react to remote-duck
events in order to make an application at minimum play nice with other audio apps.
Without using any duck related settings or code, what is the expected behavior of RNTP audio when other apps try to play audio?
I've been thinking about changing the behavior on Android to match iOS, I don't see any use-case where you want to do something other than pausing or lowering the volume, but I'd love to know whether there is one.
I should also point that remote-duck
doesn't sound intuitive either, maybe we should also rename it to remote-interruption
?
I'm pretty sure what controls ducking or pausing on iOS is the iosCategoryOptions
option, which lets you set the mixWithOthers
and duckOthers
properties. Should we unify those two options for both platforms?
On iOS, iosCategory
, iosCategoryOptions
, and iosCategoryMode
can also affect the default behavior that controlled by iOS. For instance, some mode pause for other audio, while other automatically lower the volume.
Are there similar settings on Android that we should expose through the API?
The android audio-focus guide includes a relevant example: an app with spoken word audio might want to pause playback instead of lowering volume during an interruption: https://developer.android.com/guide/topics/media-apps/audio-focus#automatic-ducking
Yeah, and that's it. Android lets you control the behavior, there's in fact a setting like the category one, but it's not used for that. We can also add those categories on Android and hardcode the ducking behavior.
Yes agreed, that would be a really good solution.
Let's find a common ground for both platforms. On Android, there are:
Besides the content type, we also have the usage type:
I don't think any of those usages fit other than the USAGE_MEDIA and USAGE_UNKNOWN
On iOS, according to the docs, there is:
I think only the default and spokenAudio modes fit.
There is also the category:
I think we can map them as such:
Unset should fall back to music instead of unknown for backwards compatibility. With that option, we can remove alwaysPauseOnInterruption
, iosCategory
, iosCategoryMode
and maybe even iosCategoryOptions
. What do you think?
I think this would be a great improvement.
Also, at least on iOS, we will need to add a bit of extra logic to completely automatically duck/pause. For instance, in my production app, I am using spokenAudio/playback, and everything works automatically except that I have to manually resume by responding to remote-duck.
I think the goal is that developers don't have to implement any logic for remote-duck, unless they want to do something out of the ordinary, or update UI or something, correct?
I'm not sure we should remove iosCategoryOptions
.
Do you see this as a breaking change, v2 feature, @Guichaguri ?
I think we should still keep remote-duck
for resuming the track. There are a few cases where resuming is not desirable. The only difference is that I'd make Android behave just like iOS.
@Guichaguri is this still relevant? Thank you :)
Closing this due to inactivity. If someone finds this is still an issue in v2 let us know and we'll reopen it!
As reported in the Discord, I was confused by the
alwaysPauseOnInterruption
setting. I expected it to pause the music on every interruption.. but when I set it, it does not seem to have any effect.. After checking the docs, I found it controls whether the remote-duck event is emitted.. in which case, it is up to me to either pause or stop the audio depending on the parameters in the event object..some proposals from chat:
triggerRemoteDuck
listenRemoteDuck
emitRemoteDuck
activateRemoteDuckEvent
enableRemoteDuckTriggering
enableRemoteDuck
willRemoteDuck
some aspects the name should cover:
remote-duck
events, which you need to subscribe to and handleI would suggest
emitDuckEvents
ormanualDucking
.