SwiftAudioPlayer
SwiftAudioPlayer copied to clipboard
how to play audio background, when switch to another app or lock screen
currently my code is:
let url = URL(string: msg!)!
SAPlayer.shared.startRemoteAudio(withRemoteUrl: url)
SAPlayer.shared.play()
this package just plays the audio. you need to set a few options to continue playing when your app is not open. see: https://stackoverflow.com/a/30280699
also see this, if you also want the lockscreen music controls