The docs for Audio.setAudioModeAsync
are a bit confusing. For example, the ‘Returns’ section contains this sentence:
Note that these are the only legal AudioMode combinations of (
playsInSilentModeIOS
,allowsRecordingIOS
,staysActiveInBackground
,interruptionModeIOS
), and any other will result in promise rejection:
and then it lists a number of combinations, which raise a couple questions/confusions for me:
- It’s kind of hard to read, or to see at a glance whether the combination I was planning to set (mostly via omission/defaults) is valid or not.
- It turns out that the simple approach I expected to use to enable background audio,
{ staysActiveInBackground: true }
, is not valid. This is because:playsInSilentModeIOS
isfalse
by default- There’s no valid combination where
playsInSilentModeIOS
isfalse
andstaysActiveInBackground
istrue
.
- It’s not at all clear why some combinations are valid and others are not.
Can anyone shed light on these issues?