AVPlayer play audio from iOS 7 background notification

后端 未结 1 1189
太阳男子
太阳男子 2021-02-11 06:50

I have audio, fetch and remote-notification set in UIBackgroundModes and I successfully receive remote notifications with my

相关标签:
1条回答
  • 2021-02-11 07:31

    You cannot initiate audio in the background. The only thing the audio background mode allows you to do is to continue producing sound as the app goes from the foreground to the background.

    And this is a perfectly reasonable rule. It would be terrible if any app that happened to be running in the background could suddenly start producing sound out of the device whenever it likes, to the mystification and annoyance of the user!

    However, if your app is capable of receiving remote events, and if it has produced sound so that it is the remote event target, then, with audio background mode, it can go on being the remote event target and thus can produce sound in the background, as long as no other app becomes the remote event target in the meantime.

    The most reliable way to produce a sound while in the background is by attaching the sound to a local notification.

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