【问题标题】:How to implement seeking from ControlCenter?如何实现从 ControlCenter 搜索?
【发布时间】:2014-11-14 22:49:45
【问题描述】:

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

但是,当我尝试拖动播放位置时,我没有收到任何事件。是否有其他处理搜索的方法?

【问题讨论】:

    标签: ios control-center


    【解决方案1】:

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

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

    UIEventSubtypeRemoteControlBeginSeekingBackward, UIEventSubtypeRemoteControlBeginSeekingForward, 
    UIEventSubtypeRemoteControlEndSeekingBackward, UIEventSubtypeRemoteControlEndSeekingForward
    

    根据其他答案,目前似乎无法进行搜索。 https://stackoverflow.com/a/21555847/1781918, https://stackoverflow.com/a/20909875/1781918

    【讨论】:

      【解决方案2】:

      事件列表:

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

      MPNowPlayingInfoCenter 也有这个键:

      MPNowPlayingInfoPropertyElapsedPlaybackTime; 
      

      【讨论】:

        猜你喜欢
        • 2019-01-07
        • 2011-04-08
        • 2021-01-08
        • 2012-12-13
        • 2016-10-05
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多