diff --git a/Application/MediaKeysApplication.m b/Application/MediaKeysApplication.m index c02ebc463..f2e73f2a9 100644 --- a/Application/MediaKeysApplication.m +++ b/Application/MediaKeysApplication.m @@ -43,16 +43,18 @@ [remoteCommandCenter.playCommand setEnabled:YES]; [remoteCommandCenter.pauseCommand setEnabled:YES]; [remoteCommandCenter.togglePlayPauseCommand setEnabled:YES]; + [remoteCommandCenter.stopCommand setEnabled:YES]; [remoteCommandCenter.changePlaybackPositionCommand setEnabled:YES]; [remoteCommandCenter.nextTrackCommand setEnabled:YES]; [remoteCommandCenter.previousTrackCommand setEnabled:YES]; - [[remoteCommandCenter playCommand] addTarget:[self delegate] action:@selector(clickPlay)]; - [[remoteCommandCenter pauseCommand] addTarget:[self delegate] action:@selector(clickPause)]; - [[remoteCommandCenter togglePlayPauseCommand] addTarget:[self delegate] action:@selector(clickPlay)]; + [[remoteCommandCenter playCommand] addTarget:self action:@selector(clickPlay)]; + [[remoteCommandCenter pauseCommand] addTarget:self action:@selector(clickPause)]; + [[remoteCommandCenter togglePlayPauseCommand] addTarget:self action:@selector(clickPlay)]; + [[remoteCommandCenter stopCommand] addTarget:self action:@selector(clickStop)]; [[remoteCommandCenter changePlaybackPositionCommand] addTarget:self action:@selector(clickSeek:)]; - [[remoteCommandCenter nextTrackCommand] addTarget:[self delegate] action:@selector(clickNext)]; - [[remoteCommandCenter previousTrackCommand] addTarget:[self delegate] action:@selector(clickPrev)]; + [[remoteCommandCenter nextTrackCommand] addTarget:self action:@selector(clickNext)]; + [[remoteCommandCenter previousTrackCommand] addTarget:self action:@selector(clickPrev)]; } else { keyTap = [[SPMediaKeyTap alloc] initWithDelegate:self]; if([SPMediaKeyTap usesGlobalMediaKeyTap]) { @@ -63,8 +65,34 @@ } } -- (void)clickSeek: (MPChangePlaybackPositionCommandEvent*)event { +- (MPRemoteCommandHandlerStatus)clickPlay { + [(AppController *)[self delegate] clickPlay]; + return MPRemoteCommandHandlerStatusSuccess; +} + +- (MPRemoteCommandHandlerStatus)clickPause { + [(AppController *)[self delegate] clickPause]; + return MPRemoteCommandHandlerStatusSuccess; +} + +- (MPRemoteCommandHandlerStatus)clickStop { + [(AppController *)[self delegate] clickStop]; + return MPRemoteCommandHandlerStatusSuccess; +} + +- (MPRemoteCommandHandlerStatus)clickNext { + [(AppController *)[self delegate] clickNext]; + return MPRemoteCommandHandlerStatusSuccess; +} + +- (MPRemoteCommandHandlerStatus)clickPrev { + [(AppController *)[self delegate] clickPrev]; + return MPRemoteCommandHandlerStatusSuccess; +} + +- (MPRemoteCommandHandlerStatus)clickSeek: (MPChangePlaybackPositionCommandEvent*)event { [(AppController *)[self delegate] clickSeek:event.positionTime]; + return MPRemoteCommandHandlerStatusSuccess; } - (void)sendEvent: (NSEvent*)event