Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to implement seeking from ControlCenter?

I'm trying to implement support for the playback controls available in Control Center. For play/pause etc I'm handling UIEventTypeRemoteControl events and looking for subtype UIEventSubtypeRemoteControlPlay / UIEventSubtypeRemoteControlPause, etc.

However when I try and drag the playback position I don't get any events. Is there a different method for handling seeking?

like image 877
Roland Rabien Avatar asked Nov 14 '14 22:11

Roland Rabien


1 Answers

You can't seek track position using the track seek bar like it does when using Music app. For seek bar to work with your app, the track should be in the device's music library. I noticed quite a few apps which support lock screen/control center track seeking, they get their tracks from the Music Library in the device. Apps like SoundCloud don't support seeking track to position at this point of time

The only way to support forward and backward seeking is by the previous/next buttons which send a begin/end seeking notification when long pressed.

UIEventSubtypeRemoteControlBeginSeekingBackward, UIEventSubtypeRemoteControlBeginSeekingForward, 
UIEventSubtypeRemoteControlEndSeekingBackward, UIEventSubtypeRemoteControlEndSeekingForward

According to the other answers it seems that seeking is not possible right now. https://stackoverflow.com/a/21555847/1781918, https://stackoverflow.com/a/20909875/1781918

like image 93
Anuj Rajput Avatar answered Nov 04 '22 00:11

Anuj Rajput