ロック画面のコントロールを使用して曲を再生/一時停止/次の音楽ストリーミング アプリを使用しています。
アプリに Admob インタースティシャル広告があります。
ただし、ロック スクリーン コントロールを使用すると、アプリの音楽に合わせて動画広告の再生が開始されるため、動画広告にも渡されます。これを防ぐ方法はありますか?
ロック画面コントロールの処理方法は次のとおりです。このコードでは広告を操作しませんが、コントロールは admob のビデオ プレーヤーに渡されます。
- (void)remoteControlReceivedWithEvent:(UIEvent *)event {
////NSLog(@"CustomApp:remoteControlReceivedWithEvent:%@", event.description);
if (event.type == UIEventTypeRemoteControl)
{
switch (event.subtype)
{
case UIEventSubtypeRemoteControlPlay:
// play the video
dispatch_async(dispatch_get_main_queue(), ^{
[[[SoundEngine sharedInstance] audioPlayer] resume];
//[[SoundEngine sharedInstance] setLockScreenElapsedTime];
});
break;
case UIEventSubtypeRemoteControlPause:
// pause the video
dispatch_async(dispatch_get_main_queue(), ^{
[[[SoundEngine sharedInstance] audioPlayer] pause];
//[[SoundEngine sharedInstance] setLockScreenElapsedTime];
});
break;
case UIEventSubtypeRemoteControlNextTrack:
// to change the video
dispatch_async(dispatch_get_main_queue(), ^{
[[SoundEngine sharedInstance] nextClicked];
//[[SoundEngine sharedInstance] setLockScreenElapsedTime];
});
break;
case UIEventSubtypeRemoteControlPreviousTrack:
// to play the privious video
dispatch_async(dispatch_get_main_queue(), ^{
[[SoundEngine sharedInstance] prevClicked];
//[[SoundEngine sharedInstance] setLockScreenElapsedTime];
});
break;
default:
break;
}
}
}