- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
在App启动后开启远程控制事件, 接收来自锁屏界面和上拉菜单的控制
[application beginReceivingRemoteControlEvents];
return YES;
}
- (void)applicationWillTerminate:(UIApplication *)application
{
在App要终止前结束接收远程控制事件, 也可以在需要终止时调用该方法终止
[application endReceivingRemoteControlEvents];
}
在具体的控制器或其它类中捕获处理远程控制事件
- (void)remoteControlReceivedWithEvent:(UIEvent *)event{
根据事件的子类型(subtype) 来判断具体的事件类型, 并做出处理
switch (event.subtype)
{
case UIEventSubtypeRemoteControlPlay:
case UIEventSubtypeRemoteControlPause: {
执行播放或暂停的相关操作 (锁屏界面和上拉快捷功能菜单处的播放按钮)
break;
}
case UIEventSubtypeRemoteControlPreviousTrack: {
执行上一曲的相关操作 (锁屏界面和上拉快捷功能菜单处的上一曲按钮)
break;
}
case UIEventSubtypeRemoteControlNextTrack: {
执行下一曲的相关操作 (锁屏界面和上拉快捷功能菜单处的下一曲按钮)
break;
}
case UIEventSubtypeRemoteControlTogglePlayPause: {
进行播放/暂停的相关操作 (耳机的播放/暂停按钮)
break;
}
default:
break;}
}
forked from liunianhuaguoyanxi/ZWTMusicPlayer
-
Notifications
You must be signed in to change notification settings - Fork 0
一款基于高分开源的音乐播放器基础上重构后的播放器
License
allan304/ZWTMusicPlayer
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
一款基于高分开源的音乐播放器基础上重构后的播放器
Resources
License
Stars
Watchers
Forks
Packages 0
No packages published
Languages
- Objective-C 99.7%
- Ruby 0.3%