8

我正在尝试实现对控制中心中可用的播放控件的支持。对于播放/暂停等,我正在处理UIEventTypeRemoteControl事件并寻找子类型UIEventSubtypeRemoteControlPlay/UIEventSubtypeRemoteControlPause等。

但是,当我尝试拖动播放位置时,我没有收到任何事件。是否有不同的方法来处理寻找?

4

2 回答 2

9

您不能像使用音乐应用程序时那样使用音轨搜索栏来查找音轨位置。要使搜索栏与您的应用程序一起使用,曲目应位于设备的音乐库中。我注意到很多支持锁屏/控制中心曲目搜索的应用程序,它们从设备中的音乐库中获取曲目。SoundCloud 之类的应用目前不支持寻找音轨定位

支持向前和向后搜索的唯一方法是通过上一个/下一个按钮在长按时发送开始/结束搜索通知。

UIEventSubtypeRemoteControlBeginSeekingBackward, UIEventSubtypeRemoteControlBeginSeekingForward, 
UIEventSubtypeRemoteControlEndSeekingBackward, UIEventSubtypeRemoteControlEndSeekingForward

根据其他答案,现在似乎不可能寻求。 https://stackoverflow.com/a/21555847/1781918 , https://stackoverflow.com/a/20909875/1781918

于 2014-11-24T07:02:59.370 回答
0

活动列表:

   UIEventSubtypeRemoteControlPlay
   UIEventSubtypeRemoteControlPause
   UIEventSubtypeRemoteControlStop
   UIEventSubtypeRemoteControlTogglePlayPause
   UIEventSubtypeRemoteControlNextTrack
   UIEventSubtypeRemoteControlPreviousTrack
   // may be it is what you want
   UIEventSubtypeRemoteControlBeginSeekingBackward
   UIEventSubtypeRemoteControlEndSeekingBackward
   UIEventSubtypeRemoteControlBeginSeekingForward
   UIEventSubtypeRemoteControlEndSeekingForward 

MPNowPlayingInfoCenter 也有这个键:

MPNowPlayingInfoPropertyElapsedPlaybackTime; 
于 2014-11-18T17:09:01.560 回答