我正在使用AVPlayer
可以通过双击主页按钮或技术术语来控制播放、暂停功能的地方remoteControlledEvents
。我想知道如何实现它,这样我就可以进入remoteControlledEvents
.
谢谢
-(void)remoteControlReceivedWithEvent:(UIEvent *)event {
switch (event.subtype) {
case UIEventSubtypeRemoteControlTogglePlayPause:
if (avplayer.rate == 0.0) {
[avplayer play];
} else {
[avplayer pause];
}
break;
case UIEventSubtypeRemoteControlPlay:
[avplayer play];
break;
case UIEventSubtypeRemoteControlPause:
[avplayer pause];
break;
}
}