Play NSData with AVAudioPlayer XCode 7.1

You can play sounds of type NSData with AVAudioPlayer.


        do{
           try audioPlayer = AVAudioPlayer(data: soundData!)
           audioPlayer.play()
        }catch{
            
        }

where soundData is a variable of type NSData

Leave a Reply

Your email address will not be published. Required fields are marked *