Play sound on Apple Watch from iPhone - ios

Can't find a clear answer on the internet.
I want to make an iOS App, which can play a sound on the Apple Watch, like you can play a sound on your iPhone from the Apple Watch (by swiping up from the watch face.)
Anyone knows if thats possible?
Cheers!
Matthijs

Related

How to check apple watch mute status?

I am working on application where i need to check apple watch mute button is On or off.
In iPhone we can detect it using AudioToolbox framework but in watch OS there is no framework with name AudioToolbox.
So my question is how could we detect apple watch mute button is On or off .
After searching around i concluded that currently there is no way to check apple watch mute status.

Playing sound from Apple Watch through iPhone

I'm trying to incorporate sound effects into an Apple Watch application I've been working on (written in Objective-C), but I was disappointed by the fact that third party applications are not permitted to play sounds directly from the watch. As a workaround, I was looking to see if there was a way to play a specified sound through the paired device's speakers. I found one such thread here:
Play sound from Apple Watch speaker
however the link in the verified answer seems to be down at this time. In short, how can I play a sound effect triggered by the Apple Watch through its paired iPhone's speakers? Also, is it possible to make the device vibrate from the watch? Any help is greatly appreciated.
Unfortunately, AppleWatch doesn't allow developers to play or to record audio. You can play sound from iPhone speaker, as the simulator does. If you implement AVAudioPlayer on you WatchKit extension, you are going to listen in your Mac because the iPhone simulator is playing for you.
Taken from Apple Developer Forum:
Since the code simplegames showed is running on the iPhone simulator, not the watch simulator, and the button press on the watch simulator is causing the iPhone simulator code to activate the audio player, your mac is simulating sound from the iPhone.
No. It is not possible to play sounds with WatchKit on the Apple Watch.
I got the watch to play audio like this. It does however present the media player. Its not ideal but it works.
#import <Foundation/Foundation.h>
NSURL *yourURL = [myBundle URLForResource:#"yourAudioFile" withExtension:#"wav"];
NSDictionary *options = #{WKMediaPlayerControllerOptionsAutoplayKey : #YES};
[self presentMediaPlayerControllerWithURL:yourURL options:options completion:^(BOOL didPlayToEnd, NSTimeInterval endTime, NSError * __nullable error) {if (error)NSLog(#"Error: %#", [error description]);}];

Playing a sound through iPhone from Apple Watch

As we get closer to the launch of the Apple Watch I am currently preparing an app for it. However what I want to do is be able to play a sound from the Apple Watch such as a song. Searching around I can see you need to play it through the iPhone but I can't figure out how to actually do it.
Any help will be greatly appreciated!
Objective-C is my preferred language however I can work with Swift.
Apple watch can play music , It is not currently possible to play sounds using the latest build of WatchKit.

Is the sound coming from the iphone or the watch?

I have two simulated apple devices. One is an iphone the other is simulated watch connected to the same phone.
Is there anyway to indicate or determine if a played sound is coming from the simulated iphone or the watch?
No. It is not possible to play sounds with WatchKit on the Apple Watch.
This is in Apple's Watchkit FAQ in their Developer Forums.
You could trigger a sound to play on the iPhone from a button press on the Watch but you can't play a sound directly from the Watch.
cant you just log an output when the sound is played to see which one its played from ?
You could try an audio hijack application to capture the audio of a particular app. "Audio Hijack" is one, there are many.
The accepted answer is no longer true. You can use WKInterfaceInlineMovie to play sound on the watch using a button tap on the watch, for example.
For a fuller explanation, see my response to this question:
Is there REALLY no way to play short sounds on Apple watch without a UI?

Is it possible to play sound from one iOS device to another?

I'd like to somehow play music from one iOS device simultaneously on another, sort of like AirPlay, but from device to device.
It seems that by leveraging existing BT tech I should be able to make this happen, but I just haven't seen any examples nor have I read anything that suggests it's possible.
Check the following threads which might help to answer your question.
iOS Stream Audio from one iOS Device to Another
How do I stream AVAsset audio wirelessly form one iOS device to another?

Resources