【问题标题】:How to detect PTT button holding on Bluetooth PTT microphone iOS如何检测蓝牙 PTT 麦克风 iOS 上的 PTT 按钮按住
【发布时间】:2015-12-20 03:09:57
【问题描述】:

我有一个蓝牙 PTT 麦克风 (Delking PTT Bluetooth Mic)

现在我想在 iOS 的小型 PTT 应用中使用它,我的问题是我不知道如何检测 PTT 按钮是按住/释放,我可以看到 Zello 应用运行良好。

大家有什么想法吗?

【问题讨论】:

    标签: ios objective-c ios-bluetooth


    【解决方案1】:

    您可以使用耳机远程控制 API 来控制这个蓝牙麦克风

    - (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;
            }
        }
    }
    

    【讨论】:

    • @Muc Dong,我确实尝试过这个解决方案,但似乎永远不会调用 remoteControlReceivedWithEvent 方法
    • 您应该播放音频文件以使遥控器的事件工作。也许播放无声的 mp3 文件进行考试。
    猜你喜欢
    • 2015-07-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-09-05
    相关资源
    最近更新 更多