2014-11-14 18 views
8

我正試圖實現對Control Center中可用的播放控件的支持。播放/暫停等我處理UIEventTypeRemoteControl事件和尋找亞型UIEventSubtypeRemoteControlPlay/UIEventSubtypeRemoteControlPause如何實施從ControlCenter尋找?

然而,當我試圖拖動播放位置我沒有得到任何事件。處理尋找是否有不同的方法?

回答

9

使用尋道酒吧喜歡用音樂應用時,確實不能尋求軌道位置。爲了使用搜索欄與您的應用程序一起工作,該軌道應位於設備的音樂庫中。我注意到很多支持鎖屏/控制中心軌道搜索的應用程序,他們從設備中的音樂庫中獲取它們的軌道。諸如SoundCloud之類的應用不支持在此時間尋求定位

支持向前和向後尋找的唯一方法是通過上一個/下一個按鈕發送長按時的開始/結束搜索通知。

UIEventSubtypeRemoteControlBeginSeekingBackward, UIEventSubtypeRemoteControlBeginSeekingForward, 
UIEventSubtypeRemoteControlEndSeekingBackward, UIEventSubtypeRemoteControlEndSeekingForward 

根據其他答案,似乎尋求是不可能的現在。 https://stackoverflow.com/a/21555847/1781918https://stackoverflow.com/a/20909875/1781918

0

事件列表:

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

而且MPNowPlayingInfoCenter此密鑰:

MPNowPlayingInfoPropertyElapsedPlaybackTime;