I was recently trying to make a WatchKit App play a background sound effect from the Apple Watch’s speakers.
From what I experienced (correct me if I’m wrong!) this is not possible as I either need to connect a Bluetooth headset to use WKAudioFilePlayer or work with additional interface elements to play the sound (WKInterfaceMovie or presentMediaPlayerControllerWithURL:options:completion).
Now, instead, I would like to use WKAudioFilePlayer to have the audio played only if a Bluetooth headset is connected in order to avoid getting a „Pair a Bluetooth headset to listen to music“-alert every time no headset is available.
Is there any way to find out whether a Bluetooth Headset is connected, so I could make the audio playback conditional on that?
Still now there is no api available to check whether bluetooth headset is paired with apple watch or not
Related
How can we detect ibeacons from a android phone without explicitly switching on the bluetooth or location...?
I want to design an app which detects for the beacon even when the bluetooth is off...please suggest the answer
Sorry, this is not possible. Bluetooth must be turned on to detect t beacons as it requires using the Bluetooth radio to do a scan.
With BLUETOOTH_ADMIN permission (required for scanning anyway), it is possible to detect if bluetooth is off, then turn it on long enough to do a scan, then turn it back off again. The user will see the Bluetooth icon when this happens, and the user will be told at install time that the app requires this permission.
I am using eddystone beacons to transmit my business url. How can I make the url notification received to alert thru sound on the users device? Any idea?
Understand that Eddystone-URL beacon advertisements don't automatically do anything on a user's phone unless they have an app installed to detect them.
Chrome for iOS and Android (installed on many newer Android devices, but very few iOS devices) will automatically detect Eddystone-URL advertisements and display a notification from Chrome if the user has opted-in. However, no sound is played. Bottom line: on a phone without a custom app, detecting an Eddystone-URL will not cause a sound to play.
If you build a custom app and get it installed on users' devices, you can certainly make it play a sound on Android devices when the beacon is detected. On iOS devices, you could also display a local notification on the device that will play a sound, but only if the user has the volume turned up on the device, does not have do not disturb on, and has opted-in to receiving notifications from the app.
I have created an app that records audio from the user-- but I am having a problem when if the user plugs into the headphone jack with a headset that contains a microphone, it kills my recording. I theorize that my app is still trying to listen on the built in microphone, and when the new microphone is plugged in the computer only allows input from that microphone.
I'm not too sure, but I figure if I can create a listener that tells me when a headphone is plugged in, that should help me a lot in finding where the issue lies.
Has anybody seen this problem before?
Turns out you can just check the AVCaptureDeviceInputSource, and when a headphone with a mic is plugged in, that property is changed from imic to emic (internal to external). The AVCaptureDevice remains as "built-in", but the key is that the InputSource changes.
On a newer Mac, it appears that OS X treats the 'microphone' as a special device. When no headset is attached, it uses the "internal mic". When I add a headset it transparently switches over to the headset mic (in this case from an iPhone headset).
Is there any way (low-level code perhaps?) I can have it record from the internal mic AND the headphone mic concurrently? I have an application where this is essential.
I could probably use a USB mic instead of the headset, then they would be two separate devices - but I'd like to support headset style devices (or any line-in input) as well.
I'm working on an application that plays audio on OsX. I'm able to list the available output devices with CodeAudio, but I have issues with a bluetooth headset; Even though the device is powered off and not connected, it's still listed in the OsX sound pref pane, and therefore picked up by CoreAudio as a valid output.
I'd like not to display bluetooth outputs if the corresponding device isn't connected already.
I've tried to check CoreAudio properties like those:
kAudioDevicePropertyDeviceIsAlive
kAudioDevicePropertyDeviceIsRunning
kAudioDevicePropertyDeviceIsRunningSomewhere
but there's no difference between the default output and the bluetooth output.
Is this kind of detection something doable with Coreaudio?
For the benefit of future searchers the way I've done it in the past is to:
Enumerate the detected devices
Query the kAudioDevicePropertyTransportType property for each AudioDeviceID
which will return a transport type ID constant.
Match for the
kAudioDeviceTransportTypeBluetooth or
kAudioDeviceTransportTypeBluetoothLE type
That way you can determine the type of connection the device is using (USB, Firewire etc). You can find the full list of transport types in AudioHardwareBase.h