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 =
To play a sound in swift2 is
func playSound(soundUrl: String) { let sound = NSURL(soundUrl) do{ let audioPlayer = try AVAudioPlayer(contentsOfURL: sound) audioPlayer.prepareToPlay() audioPlayer.play() }catch { print("Error..") } }
Let me know if it working.