Play sound with WatchKit 2

1.4k views Asked by At

I have tried this - with the sound file ShipBullet.m4a in the Watch App and Extensions (to make sure that it can be found):

if let url = NSBundle.mainBundle().URLForResource("ShipBullet", withExtension:"m4a") {
    let asset = WKAudioFileAsset(URL:url)
    let sound = WKAudioFilePlayerItem(asset:asset)
    audioPlayer = WKAudioFilePlayer(playerItem:sound)
}

audioPlayer.play()

However, audioPlayer is always nil and no sound is played. Why? Thanks for the help!

1

There are 1 answers

2
Rob McMorran On

Take a look at this reply to the same question I asked. Play sound on Watchkit

Let me know how you get on, I can't seem to get any sound to play on the watch itself however on the simulator it asks for a bluetooth headset.