1
我有一個音頻播放器應用程序,使用Cordova和本機AudioStreamer插件調用創建。一切正常,但是,現在我想要使用remoteControlReceivedWithEvent事件來使用本地遠程控制。應用程序在後臺..在iOS上使用cordova插件的remoteControlReceivedWithEvent
當我打電話給我的科爾多瓦插件啓動本地球員,我也呼籲..
- (void)startStream:(CDVInvokedUrlCommand*)command
streamer = [[[AudioStreamer alloc] initWithURL:url] retain];
[streamer start];
[[UIApplication sharedApplication] beginReceivingRemoteControlEvents];
[self canBecomeFirstResponder];
當我停止流:
- (void)stopStream:(CDVInvokedUrlCommand*)command
[streamer stop];
[streamer release];
streamer = nil;
[[UIApplication sharedApplication] endReceivingRemoteControlEvents];
各項工作完美,但我不知道在哪裏把遠程事件...
- (void)remoteControlReceivedWithEvent:(UIEvent *)event {
switch (event.subtype) {
case UIEventSubtypeRemoteControlTogglePlayPause:
NSLog(@"PAUSE!!!");
break;
case UIEventSubtypeRemoteControlPlay:
NSLog(@"PAUSE!!!");
break;
case UIEventSubtypeRemoteControlPause:
NSLog(@"PAUSE!!!");
break;
case UIEventSubtypeRemoteControlStop:
NSLog(@"PAUSE!!!");
break;
default:
break;
}
}