AVAudioPlayer, using AmbientSound session, is not playing when app is in background

前端 未结 1 1032
-上瘾入骨i
-上瘾入骨i 2020-12-21 14:36

If this is in the apple doc then I\'ve not been able to find it - hoping someone can help:

My app plays occasional short audio clips - I want the audio to mix in wit

1条回答
  •  礼貌的吻别
    2020-12-21 15:13

    Had to submit a tech support request for this in the end.

    According to Apple background playback is not supported by the AmbientSound category - you have to use MediaPlayback.

    They claim this is in the documentation - I've looked again and I could not find it.

    Ok so getting background sounds to mix into MediaPlayback is easy enough using kAudioSessionProperty_OverrideCategoryMixWithOthers - but I am now going to have to jump through some other hoops to replicate the other AmbientSound functionality (obeying the mute switch and not playing when locked). I really don't understand why AmbientSound is not supported playing in background - but there we go.

    0 讨论(0)
提交回复
热议问题