I'm trying to play an audio file using WatchKit with no success. It plays well on the simulator but doesn't play on the real Watch.
I'm recording audio on the iPhone to .m4a and then use WKAudioFilePlayer or AVAudioPlayer or WKAudioFileQueuePlayer to play it. Neither of them works on the Watch.
For example the following code works on the simulator:
NSMutableArray<WKAudioFilePlayerItem *> *items = [NSMutableArray array];
WKAudioFileAsset *asset = [WKAudioFileAsset assetWithURL:[NSURL fileURLWithPath:fileName]]; // path to the .m4a file in Caches folder
WKAudioFilePlayerItem *item = [WKAudioFilePlayerItem playerItemWithAsset:asset];
[items addObject:item];
soundPlayer = [WKAudioFileQueuePlayer queuePlayerWithItems:items];
[soundPlayer play];
It outputs sound to the speakers on the computer. But it doesn't work on the real Watch with/without Bluetooth headphones. Apple music works on the headphones without a problem. I keep my file (fileName) in the Caches folder, might that be the case? Also does the .m4a format/bitrate matter?
Thanks!