アプリでいくつかのビデオを再生するために AV Player を使用していますが、コントロール センターを開いてビデオを再生および一時停止しようとすると、再生中および一時停止中ですが、その機能は必要ありません。この機能を無効にしたいので、このために、私はこれが好きでした...
MPRemoteCommandCenter *remoteCommandCenter = [MPRemoteCommandCenter sharedCommandCenter];
remoteCommandCenter.playCommand.enabled = NO;
remoteCommandCenter.pauseCommand.enabled = NO;
remoteCommandCenter.previousTrackCommand.enabled = NO;
remoteCommandCenter.nextTrackCommand.enabled = NO;
これはうまくいきませんでした
MPRemoteCommandCenter *remoteCommandCenter = [MPRemoteCommandCenter sharedCommandCenter];
remoteCommandCenter.playCommand.enabled = YES;
[remoteCommandCenter.playCommand addTarget:self action:@selector(test)];
remoteCommandCenter.pauseCommand.enabled = YES;
[remoteCommandCenter.pauseCommand addTarget:self action:@selector(test)];
remoteCommandCenter.previousTrackCommand.enabled = NO;
remoteCommandCenter.nextTrackCommand.enabled = NO;
- (void)test {
// Not doing anything
}
それから私が試した別の方法、
MPRemoteCommandCenter *remoteCommandCenter = [MPRemoteCommandCenter sharedCommandCenter];
remoteCommandCenter.playCommand.enabled = NO;
[remoteCommandCenter.playCommand addTarget:self action:@selector(test)];
remoteCommandCenter.pauseCommand.enabled = NO;
[remoteCommandCenter.pauseCommand addTarget:self action:@selector(test)];
remoteCommandCenter.previousTrackCommand.enabled = NO;
remoteCommandCenter.nextTrackCommand.enabled = NO;
- (void)test {
// Not doing anything
}
でも使い物にならない..
ターゲットとして追加したテストメソッドにブレークポイントを設定すると、コールバックを取得していますが、使用できません。それでも、再生ボタンと一時停止ボタンは機能しています
これらのボタンを無効にする方法はありますか?