草庐IT

MPRemoteCommandCenter

全部标签

ios - MPRemoteCommandCenter 控制中心暂停按钮即使在音频文件暂停后也不会更新

我正在开发一个处理MPRemoteCommandCenter类的录音应用程序。我已经设置了命令中心来播放和暂停命令。下面添加了代码片段。我遇到了pauseCommand的问题。我从应用程序开始播放音频文件,它更新了控制中心以及正在播放的文件,播放按钮更改为暂停按钮。现在,当文件正在播放时,我从控制中心选择暂停按钮暂停音频。这是在应用程序中调用pauseCommand处理程序,音频文件已暂停,但控制中心继续更新搜索栏,暂停按钮不会更改为播放按钮。-(void)setupRemoteControls{MPRemoteCommandCenter*commandCenter=[MPRemote

ios - 使用 MPMusicPlayerController 时无法修改 MPRemoteCommandCenter 操作

我的应用使用MPMusicPlayerController.systemMusicPlayer()播放音频,效果很好。用户可以设置自定义currentPlaybackRate。这按预期工作。如果用户在锁定屏幕(MPRemoteCommandCenter)上按下一个Action,currentPlaybackRate将重置为1。这是因为事件直接发送到系统音乐播放器,而不是应用程序Controller。为了将currentPlaybackRate设置为正确的值,我尝试覆盖MPRemoteCommandCenter事件:overridefuncviewDidLoad(){super.view

ios - 更新 MPRemoteCommandCenter 播放/暂停按钮

我有一个iOS9应用程序,它使用AudioGraph播放类似MIDI的歌曲。我已经使用MPRemoteCommandCenter设置了远程控制命令,并使用MPNowPlayingInfoCenter设置了信息,这样当前正在播放的歌曲就会显示在控制中心中,并对控制中心按钮按下或耳机按钮按下做出响应.点击ControlCenter中的暂停按钮可暂停我的歌曲,但ControlCenter中的播放头会继续移动并且该按钮仍保持为暂停图标。再次点击它只会继续调用暂停。有没有办法更新MPNowPlayingInfoCenter或MPRemoteCommandCenter状态,以便控制中心知道歌曲已暂

ios - MPRemoteCommandCenter 不生成远程控制事件 MPMusicPlayerController.applicationMusicPlayer()

我在iPhone上使用MPRemoteCommandCenter和MPMusicPlayerController.applicationMusicPlayer。我正在尝试在用户播放音乐并双击耳机按钮时接收远程控制事件。如果我使用AVAudioPlayer,则可以完美接收远程命令。但是,如果我将MPMusicPlayerController与其任何播放器(systemMusicPlayer、applicationMusicPlayer或applicationQueuePlayer)一起使用,则不会收到命令。他们似乎被吞噬了。例如,当我双击Remote时,音乐会在播放和停止之间切换。相反,

ios - 如何在 MPRemoteCommandCenter 中切换播放/暂停

我不知道如何切换播放和暂停按钮。我试过TogglePlayPauseCommand。但它不起作用。 最佳答案 您能否发布有关如何尝试实现TogglePlayPauseCommand的代码?我认为它会像这样完成:publicoverridevoidViewDidLoad(){base.ViewDidLoad();varcommandCenter=MPRemoteCommandCenter.Shared;commandCenter.TogglePlayPauseCommand.AddTarget(ToggledPlayPauseButt

ios - 使用 MPRemoteCommandCenter 时未调用播放/暂停回调

我正在构建一个音乐播放器应用,一切正常。到目前为止,我一直在使用系统音乐播放器,但现在想改用应用程序音乐播放器,这就是我遇到问题的地方——我这辈子都不知道如何获得我的音乐播放器从iOS控制中心调用播放/暂停回调。这是我在主视图Controller中使用的代码:overridefuncviewDidLoad(){super.viewDidLoad()self.musicPlayer=MPMusicPlayerController.applicationMusicPlayer()self.registerForMediaPlayerNotifications()UIApplication.

swift - swift 4 中的 MPRemoteCommandCenter 错误

我正在尝试设置我的应用程序以使用MPRemoteCommandCenter。我从文档编程指南中得到了这个例子。我导入了AVFoundation,甚至尝试导入AVKIT,我收到错误消息Useofunresolvedidentifier'MPRemoteCommandCenter'。当我创建MPRemoteCommandCenter.shared()的实例时。任何帮助将不胜感激。funcsetupRemoteTransportControls(){//GetthesharedMPRemoteCommandCenterletcommandCenter=MPRemoteCommandCente

ios - MPRemoteCommandCenter 暂停/播放按钮不切换?

我在MPRemoteCommandCenter中切换播放和暂停按钮时遇到问题。无论出于何种原因,音频和事件都将正常工作,但命令中心不会将播放按钮更改为暂停按钮。这是我的代码...-(void)setupMPRemoteCommandCenter{MPRemoteCommandCenter*commandCenter=[MPRemoteCommandCentersharedCommandCenter];MPRemoteCommand*play=[commandCenterplayCommand];[playsetEnabled:YES];[playaddTarget:selfaction
12