21
22

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

swiftのAVPlayerでbackgroud再生

Posted at
AVAudioSession.sharedInstance().setCategory(AVAudioSessionCategoryPlayback, error: nil)
AVAudioSession.sharedInstance().setActive(true, error: nil)

上記のコードをplay()する前に設置。

あとはinfo.plistに
スクリーンショット 2014-08-06 1.59.36.png
Key:Required background modes
Value:App plays audio or streams audio/video using AirPlay
として保存すれば、バックグラウンドの実現が可能。

参考:http://stackoverflow.com/questions/24393495/playing-a-sound-with-avaudioplayer-swift

21
22
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
21
22

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?