Vidyo Android SDK and cycle microphone/speaker - vidyo

When I register a callback for speaker and/or microphone, I can get only 1 device for each, named as "Speaker"(onLocalSpeakerAdded()) and "Micro Phone"(onLocalMicrophoneAdded()) respectively. I also received callbacks for onLocalSpeakerSelected() and onLocalSpeakerStateUpdated() for that identified devices mentioned above. After that, I do not receive any callbacks for onLocalSpeakerAdded() or onLocalMicrophoneAdded() in the event other devices get added.
When I execute the functions below:
vidyoConnector.CycleMicrophone() OR vidyoConnector.CycleSpeaker()
then there is no change in localMicroPhone or localSpeaker selection. Also I was not received callback for "onLocalSpeakerSelected" when calling CycleSpeaker() function.
Another result:
I was connected with Bluetooth headPhone while calling, I was able to hear from that Bluetooth device. Then I disconnected my Bluetooth headphone while still on the call, the call switches to the phone speaker automatically when the Bluetooth headPhone is disconnected but I no callback is invoked.
Query:
- Can you help me on that I am missing?
- Is there any way to find all available devices (i.e.Speaker & microPhone)?
- Also, can we differentiate between them to identify Bluetooth Speaker, Phone's Loud Speaker or default calling speaker etc.?

Related

Accept or reject a call on bluetooth device (like smart watch) from iPhone?

In some of the Smart watches like pebble and meta watch,it is possible to accept and reject calls on the smart watch.how the call related info be transferred between iPhone and bluetooth device using MAP or PBAP. I would like to accept the call from the bluetooth device similar to earphone where I can accept the call via bluetooth.
Is there any legitimate api or any pointers to accomplish this ?
EDIT
Metawatch has inbuilt microphone and speaker and it implements HFP and PBAP.If smart watch has in built microphone and speaker and if it implements HFP,calls can be accepted from the watch,but Pebble does not have in built microphone and speaker. Still Pebble is able to accept the call and route it to headset. Pebble supports HFP,MAP,AVRCP and SPP on iOS and it is an MFi.How can the same be implemented in an app?
You can write your own application to intercept incoming call events and using your own communication mechanism (over Bluetooth) communicate this info to your device (i.e. watch)
With this you can fairly easily pass incoming call indication to the watch,
Accepting call is more involved as you need to have the ability to intercept an ongoing bluetooth profile connection, Android has the BluetoothHeadset Class that provides some capability, with iOS there is no straight forway way (but it is possible)

Detecting when Bluetooth is disabled on iOS5

I'm developing blog speaker app.
I wanna pause the audio when bluetooth is disabled like iPod app. I thought it's not possible without using private api after reading this.
Check if Bluetooth is Enabled?
But, my customer told me that Rhapsody and DI Radio apps both support it.
Then I found iOS5 has Core Bluetooth framework.
https://developer.apple.com/library/ios/documentation/CoreBluetooth/Reference/CoreBluetooth_Framework/CoreBluetooth_Framework.pdf
CBCentralManagerStatePoweredOff status seems like the one.
But, the description says this api only supports Bluetooth 4.0 low energy devices.
Did anyone try doing the same thing?
I want to support current popular bluetooth headsets, or bluetooth enabled steering wheel on the car. I don't know if it's worth trying when it only supports some brand new bluetooth.
For audio, focusing on Bluetooth specifically sounds like the wrong approach.
I think what you're looking for is Handling Audio Hardware Route Changes.
You'll notice that all of the following cause the the built-in iPod app to pause:
Bluetooth device is removed (possibly because bluetooth has been disabled).
Headphones are unplugged.
Device is removed from docking station.
You get all that correct behavior when you use the Audio Session API.
On BLE you will get an update on the manager containing the state:
enum {
CBCentralManagerStateUnknown = 0, // State unknown,
update imminent.
CBCentralManagerStateResetting, // The connection with the system service was momentarily lost,
update imminent.
CBCentralManagerStateUnsupported, // The platform doesn't support Bluetooth Low Energy.
CBCentralManagerStateUnauthorized, // The app is not authorized to use Bluetooth Low Energy.
CBCentralManagerStatePoweredOff, // Bluetooth is currently powered off.
CBCentralManagerStatePoweredOn, // Bluetooth is currently powered on and available to use.
};
which you can check on the mandatory callback with e.g
centralManager:didUpdateState...{
if ([manager state] == CBCentralManagerStatePoweredOff)
{
[musicPlayer pause]
}
}

Detect Bluetooth answer/end-call button on iPhone

Is it possible to detect and respond to the answer/end-call button presses from an HFP Bluetooth device on iOS? Has anyone seen this? Where should I look for answers? I understand one could get access to lower level bluetooth if you register for the device manufacturer (MFI) program but I'm hoping I don't have to dive this deep. I also know that you can respond to AVRCP commands but I am not wanting to use this option. Can anyone help?
UIResponder has a -remoteControlReceivedWithEvent: method that you can use to receive events from external devices, possibly including Bluetooth headsets. From the docs:
Remote-control events originate as commands from external accessories, including headsets. An application responds to these commands by controlling audio or video media presented to the user. The receiving responder object should examine the subtype of event to determine the intended command—for example, play (UIEventSubtypeRemoteControlPlay)—and then proceed accordingly.
To allow delivery of remote-control events, you must call the beginReceivingRemoteControlEvents method of UIApplication; to turn off delivery of remote-control events, call endReceivingRemoteControlEvents.
It’s not clear whether the answer/end button on a headset is considered equivalent to the play/pause button on, say, the earbuds’ remote, but this might be worth a try.
Sadly, there are no available bluetooth public APIs for developers, so no way to get that access in the conventional means.
As of my research, some person received some event from their bleu-tooth devices via "remoteControlReceivedWithEvent" but not all of them! Some are receiving none! And very few are receiving all of them!
I also tried Core Bluetooth but it only supports LEB (Low Energy Bluetooth devices)!
https://developer.apple.com/library/ios/documentation/NetworkingInternetWeb/Conceptual/CoreBluetooth_concepts/CoreBluetoothOverview/CoreBluetoothOverview.html#//apple_ref/doc/uid/TP40013257-CH2-SW1
Also, some posts suggest it is possible to use Classic bleutooth instead of "Low Energy":
How to use bluetooth classic instead of le
But it has limitation as well (the post is taking about "MFi accessory"! MFi is it for "made for iphone" ?!?!?!)
from the post above:
"A non-LE Bluetooth device needs to be MFi-approved to be used with the External Accessory framework (it needs to use a specific Apple chip and a proprietary communication protocol). You won't be able to build applications to access this device unless it either uses the more open Bluetooth LE or has this chip in it for standard Bluetooth. There might be ways to do this via jailbreak, but pretty much everyone I know has moved over to Bluetooth LE." !
more post: Connecting to a Bluetooth device from iOS, no MFi
Regards.

iOS SDK Disable Internal Microphone

I am developing an iOS application that receives data through the auxiliary port (microphone).
We got oscilloscopes hooked up and are at the point where we can measure frequencies and amplitudes on a testing iPhone.
However, even with the auxiliary cable connected, the iPhone still listens to the internal microphone in addition to our external AUX input thus watering down our measurements.
The iPhone definitely recognizes the connected AUX cable (internal speakers are turned off).
Is there any way to programmatically disable the built-in microphone?
or
Is there some special signal we can send through the AUX port to disable the internal microphone?
After much research on this topic, there is no way to do it at this moment in time.
If you look at the Audio Session Programming Guide and the AVCaptureDevice Class Reference, all the properties relating to the devices input sources and audio routes are readonly.
If it's of any use, you can detect whether or not headphones or an external mic are plugged in. Here's a question relating to that.
I don't believe you can disable the built-in microphone without the user physically pressing the silent switch, but maybe you could store the data recorded by the built-in mic and then filter it out of the measurements taken by the oscilloscopes? I don't know how you would go about implementing this; it's just a theory.
Hope this helps!

CoreAudio AudioQueue i/o redirect to/from phone app?

I've been reading up on some of the iPhone audio services in considering an audio recording/playback app, but ideally I'd like to be able to use the other end of a phone connection as inputs and outputs, i.e. remote speaker and remote microphone via cellular (or VoIP, but for now cellular's the question), when it's on, as input and output targets for redirect... I can't seem to find any documentation saying this is possible or impossible... obviously apple phone app is closed source, and I can't modify it, but can I just hook up to either or both of its streams? Does it make any difference if it's a call initiated by my app or not?
I'm afraid that is not possible to reroute the audio source and sink of a phone call on iPhone. It is possible on other smartphone platforms.
You could route the local mic and speaker over a network connection that would use the default network route (either WiFi or cellular data) to achieve your goals.