Search code examples
iosobjective-cios-bluetooth

How to detect PTT button holding on Bluetooth PTT microphone iOS


I have a Bluetooth PTT mic (Delking PTT Bluetooth Mic)

Now I want to use it in my small PTT app in iOS, and my problem is I don't know how to detect the PTT button is hold/release, I could see Zello app works great.

Can you all have any ideas?


Solution

  • You can use Headset remote control API to control this bluetooth microphone

    - (void) remoteControlReceivedWithEvent: (UIEvent *) receivedEvent {
        if (receivedEvent.type == UIEventTypeRemoteControl) {
            switch(receivedEvent.subtype) {
                case UIEventSubtypeRemoteControlTogglePlayPause:
                    //Insert code
    
                case UIEventSubtypeRemoteControlPlay:
                    //Insert code for HOLDING BUTTON
                    break;
                case UIEventSubtypeRemoteControlPause:
                    // Insert code for RELEASE BUTTON
                    break;
                case UIEventSubtypeRemoteControlStop:
                    //Insert code.
                    break;
                default:
                    return;
            }
        }
    }