I am getting mp3 url as a response of api calling. I want to play that audio, so how can i do that? (ios swift)
here is my response
{ content =
Swift 4
func playSound(soundUrl: String) { let sound = URL(fileURLWithPath: soundUrl) do { let audioPlayer = try AVAudioPlayer(contentsOf: sound) audioPlayer.prepareToPlay() audioPlayer.play() }catch let error { print("Error: \(error.localizedDescription)") } }