而要修改这些信息的代码如下: #import <MediaPlayer/MPNowPlayingInfoCenter.h> #import <MediaPlayer/MPRemoteCommandCenter.h 中的属性可以控制对应功能是否打开,而响应事件的处理有两种方法: 方法一,通过remoteControlReceivedWithEvent:方法,响应对应事件 方法二:通过MPRemoteCommandCenter beginReceivingRemoteControlEvents]; [self becomeFirstResponder]; - (void)setupCommandCenter { MPRemoteCommandCenter *commandCenter = [MPRemoteCommandCenter sharedCommandCenter]; [commandCenter.playCommand removeTarget *commandCenter = [MPRemoteCommandCenter sharedCommandCenter]; // 播放 [commandCenter.playCommand
UIEventSubtypeRemoteControlEndSeekingForward: NSLog(@"前进"); break; default: break; } }]; 在iOS7.1之后,出现了MPRemoteCommandCenter 官方文档:https://developer.apple.com/documentation/mediaplayer/mpremotecommandcenter //锁屏界面开启和监控远程控制事件 - { /**/ //远程控制命令中心 iOS 7.1 之后 详情看官方文档:https://developer.apple.com/documentation/mediaplayer/mpremotecommandcenter MPRemoteCommandCenter *commandCenter = [MPRemoteCommandCenter sharedCommandCenter]; MPRemoteCommandCenter对象提供feedback对象用于对媒体文件进行喜欢, 不喜欢, 标记的操作.
UIEventSubtypeRemoteControlEndSeekingForward: NSLog(@"前进"); break; default: break; } }]; 在iOS7.1之后,出现了MPRemoteCommandCenter 官方文档:https://developer.apple.com/documentation/mediaplayer/mpremotecommandcenter //锁屏界面开启和监控远程控制事件 - { /**/ //远程控制命令中心 iOS 7.1 之后 详情看官方文档:https://developer.apple.com/documentation/mediaplayer/mpremotecommandcenter MPRemoteCommandCenter *commandCenter = [MPRemoteCommandCenter sharedCommandCenter]; MPRemoteCommandCenter对象提供feedback对象用于对媒体文件进行喜欢, 不喜欢, 标记的操作.
但是在Carplay的情况下,当异常暂停问题出现的时候,上面的播放状态区域会变成下面的“未在播放”: 这个显示区域是由MPRemoteCommandCenter管理,工程中主要有两个方法会控制该类,分别是
使用MPRemoteCommandCenter可以接收远程命令。如果你使用MPNowPlayingInfoCenter,你可以通知系统元数据关于在设备上播放的音轨。