Play sound from Apple Watch speaker
Is there a way to play sound out of the Apple Watch’s speaker? I have been unable to find any documentation online.
4 Solutions Collect From Internet About “Play sound from Apple Watch speaker”
This is now possible as of watchOS 2 using
NSURL *assetURL = [[NSBundle mainBundle] URLForResource:@"file" withExtension:@"wav"];
WKAudioFileAsset *asset = [WKAudioFileAsset assetWithURL:assetURL]; WKAudioFilePlayerItem *playerItem = [WKAudioFilePlayerItem playerItemWithAsset:asset]; WKAudioFilePlayer *audioFilePlayer = [WKAudioFilePlayer playerWithPlayerItem:playerItem]; [audioFilePlayer play];
[self presentMediaPlayerControllerWithURL:assetURL options:nil completion:nil];
It is not possible to play sound out of the Apple Watch’s speaker, but you can trigger playing a sound file on the iPhone, here is thread about it
(New in watchOS 2.0)
The URL of the media file you want to play. The URL must specify a file; streamed media is not supported. The file may contain audio, video, or both.
If you specify a URL for a file on a remote server, this method downloads the file first and displays a progress indicator showing the progress of the operation. Because WatchKit uses App Transport Security (ATS) when downloading files from a web server, the file must be on a secure server, and the URL must use the https scheme. If your server does not support ATS–level security, download the file yourself before playing it.
Use sharedcontainer, watch extensions, for storing the file.
Any audio you play using this method is routed to a paired Bluetooth audio device if one is available. If no Bluetooth audio device is available, audio is routed to to the Apple Watch speaker.
For WatchOS3 the answer to the original question is WKInterfaceInlineMovie
You can hide the widget so it does not alter your interface design. It plays audio files through the watch’s speaker if no bluetooth speaker is connected.
- openssl libs in Xcode 4
- Add new templates in Xcode
- How to check if a font is available in version of iOS?
- Custom operator to simplify If-Let
- Could not cast value of type PFFile to NSURL
- Static function variables in Swift
- how to properly use autoreleasepool for an nsoperationqueue
- Mobile safari position:fixed z-index glitch when scrolling
- iOS App testing: No Code signature found
- Objective-C iOS Crop Image Using Zoom?
- Non repeating random numbers in iphone?
- Add extra row to a UITableView managed by NSFetchedResultsController
- Keyboard not shown under iOS 8
- How to fill a UIView like this (with some diagonally drawn white lines)
- Objective C: How to switch from one Tab bar to another via program