Swift: Keep playing sounds when the device is locked

后端 未结 4 1003
眼角桃花
眼角桃花 2021-01-15 04:50

I\'m using the following code to play a sound off a URL from the internet:

var audioPlayer = AVPlayer()

...

let audioSessio         


        
4条回答
  •  悲哀的现实
    2021-01-15 05:19

    Open your app info.plist as Source code (to edit in text mode) and add the following just after dict:

    UIBackgroundModes
    
        audio
    
    

提交回复
热议问题