Luke
Luke

Reputation: 9700

Distinguish between headset remote and Control Center music controls?

Simple question really: is there a way to tell whether a user double-tapped their headset remote to skip a track, or whether they pushed the skip button in Control Center, for example?

I realise they both use the RemoteControl UIEvent, but I’m wondering if I can discern. I’d like to play a little auditory “beep” much like Spotify does upon skip or pause, but only when performed via a headset.

Can this be done?

Upvotes: 0

Views: 55

Answers (1)

adhumi
adhumi

Reputation: 485

The method - remoteControlReceivedWithEvent: gives a UIEvent with a type and a subtype property. The type property gives the same result when you press the button on the headset or on the lockscreen.

For me, there is no method to differenciate the events, except if you want to check if a headset is plugged to the device, but it is not perfect...

Upvotes: 1

Related Questions