1

我正在为我的学校开发一个简单的广播应用程序,因为它是一个流,我认为我们不需要 seekforward 和 seekrewind。我看到您可以更改这些按钮的含义,但我无法将其从命令中心/锁定屏幕中完全删除。这是可能的还是我被非工作、无用的按钮困住了?

4

1 回答 1

1

我不确定我的回答是否会对您有所帮助,因为我不知道您是否将 AVPlayer 用于您的应用程序。我将 AV Player 用于应用程序并以编程方式设置 CommandCenter。

例如:

func updateCommandCenter() {
  let commandCenter = MPRemoteCommandCenter.sharedCommandCenter()

  commandCenter.playCommand.addTarget(self, action:   #selector(MusicPlayerVC.playCurrentItem))
  commandCenter.pauseCommand.addTarget(self, action: #selector(MusicPlayerVC.pauseCurrentItem))
  commandCenter.togglePlayPauseCommand.addTarget(self, action: #selector(MusicPlayerVC.playPauseButtonPressed(_:)))

//    commandCenter.skipForwardCommand.preferredIntervals = [15]
//    commandCenter.skipForwardCommand.addTarget(self, action: #selector(MusicPlayerVC.forward(_:)))

  commandCenter.bookmarkCommand.addTarget(self, action: #selector(MusicPlayerVC.save(_:)))
}

我刚刚注释掉了skipForard,它就从主屏幕上消失了。因此,如果您将其放开,则不应显示它。

希望我能帮助你。

截屏:

在此处输入图像描述

于 2016-06-19T15:07:32.063 回答