You can load your audio file or system sound and play it with your Apple Watch speaker. Using WKAudioFilePlayer for playing audio file required bluetooth headphones connected to your Apple Watch to play the sound.
To play any of the few haptic feedback sounds with vibration using WKInterfaceDevice:
[[WKInterfaceDevice currentDevice] playHaptic:WKHapticTypeFailure]
To play any audio file, use AVAudioEngine:
1) Add AVFoundation.framework to your Frameworks list.
2) In .h file, put
#import <AVFoundation/AVFoundation.h>
@property (nonatomic) AVAudioEngine *audioEngine;
@property (nonatomic) AVAudioPlayerNode *playerNode;
@property (nonatomic) AVAudioFile *audioFile;
@property (nonatomic) AVAudioPCMBuffer *audioPCMBuffer;
3) In .m file, put
NSError *error = nil;
NSURL *fileURL = [[NSBundle mainBundle] URLForResource:@"alarm" withExtension:@"wav"];
self.audioFile = [[AVAudioFile alloc] initForReading:fileURL error:&error];
if (error) {
NSLog(@"error");
return;
}
self.audioEngine = [[AVAudioEngine alloc]init];
AVAudioFormat *audioFormat = self.audioFile.processingFormat;
AVAudioFrameCount length = (AVAudioFrameCount)self.audioFile.length;
self.audioPCMBuffer = [[AVAudioPCMBuffer alloc] initWithPCMFormat:audioFormat frameCapacity:length];
[self.audioFile readIntoBuffer:self.audioPCMBuffer error:nil];
AVAudioMixerNode *mixerNode = [self.audioEngine mainMixerNode];
self.playerNode = [[AVAudioPlayerNode alloc] init];
[self.audioEngine attachNode:self.playerNode];
[self.audioEngine connect:self.playerNode to:mixerNode format:self.audioFile.processingFormat];
[self.audioEngine startAndReturnError:&error];
[self.playerNode scheduleFile:self.audioFile atTime:nil completionHandler:nil];
[self.playerNode play];
You can use these classes from watchOS 2.0 further. There is a documentation for playHaptic: and AVAudioEngine classes.
I hope this will help you to solve your problem.