I'm trying to play a sound through the watchkit extension using WKAudioFilePlayer however no sound gets played. I'm using the haptic feedback code as a sort of debug to be sure it executes it (which it does). As a side note, mute is not on and the filename is correct.
NSURL *falcon = [NSURL fileURLWithPath:[[NSBundle mainBundle]
pathForResource:@"falcon"
ofType:@"mp3"]];
WKAudioFileAsset *asset = [WKAudioFileAsset assetWithURL:falcon];
WKAudioFilePlayerItem *sound = [WKAudioFilePlayerItem playerItemWithAsset:asset];
audioPlayer = [WKAudioFilePlayer playerWithPlayerItem:sound];
[audioPlayer play];
WKInterfaceDevice *device = [WKInterfaceDevice currentDevice];
[device playHaptic:WKHapticTypeClick];
I implemented as follows and it worked fine. (Sorry, it's Swift)
1) Define a property for the player object
2) Setup the asset and player when it's awaking
3) Play if the player is ready to play.
In addition, it needed to connect a Bluetooth Headset with watch.