【发布时间】:2013-09-04 19:31:38
【问题描述】:
在我设法使用 MPMoviePlayerController 在后台播放音频并尝试使其接收远程控制之后。但是当我点击播放/暂停按钮时,没有反应,音频继续播放。 然后我尝试显示是否有日志输出但没有输出。
这是我的代码:
-(void)viewDidAppear:(BOOL)animated{
...
[[UIApplication sharedApplication] beginReceivingRemoteControlEvents];
[self becomeFirstResponder];
}
- (void)viewWillDisappear:(BOOL)animated {
[super viewWillDisappear:animated];
[[UIApplication sharedApplication] endReceivingRemoteControlEvents];
[self resignFirstResponder];
}
- (void)remoteControlReceivedWithEvent:(UIEvent *)event {
NSLog(@"remoteControlReceivedWithEvent: %@", event);
if (event.type==UIEventTypeRemoteControl) {
if (event.subtype==UIEventSubtypeRemoteControlPlay) {
NSLog(@"Play");
} else if (event.subtype==UIEventSubtypeRemoteControlPause) {
NSLog(@"Pause");
} else if (event.subtype==UIEventSubtypeRemoteControlTogglePlayPause) {
NSLog(@"Play Pause");
}
}
}
感谢您的努力。
【问题讨论】:
标签: ios events audio controls mpmovieplayercontroller