diff options
| -rw-r--r-- | DomeKey/AppDelegate.m | 1 | ||||
| -rw-r--r-- | DomeKey/HeadphoneKey.h | 2 | ||||
| -rw-r--r-- | DomeKey/HeadphoneKey.m | 19 | 
3 files changed, 22 insertions, 0 deletions
| diff --git a/DomeKey/AppDelegate.m b/DomeKey/AppDelegate.m index 318aeee..fab5171 100644 --- a/DomeKey/AppDelegate.m +++ b/DomeKey/AppDelegate.m @@ -14,6 +14,7 @@  {      _headphone_key = [[HeadphoneKey alloc] init];      [_headphone_key startMonitoringBluetoothEvents]; +    [_headphone_key mpmediaplayerBS];  }  @end diff --git a/DomeKey/HeadphoneKey.h b/DomeKey/HeadphoneKey.h index 586c40b..61c4864 100644 --- a/DomeKey/HeadphoneKey.h +++ b/DomeKey/HeadphoneKey.h @@ -7,6 +7,7 @@  //  #import <Foundation/Foundation.h> +#import <MediaPlayer/MediaPlayer.h>  #import <DDHidLib/DDHidAppleMikey.h>  #import "dome_key_map.h" @@ -30,5 +31,6 @@ static const unsigned int TIMEOUT_MILLISECONDS = 1000;  - (void)handleDeadKey:(HeadphoneButton)button;  - (void)runAction;  - (void)startMonitoringBluetoothEvents; +- (void)mpmediaplayerBS;  @end diff --git a/DomeKey/HeadphoneKey.m b/DomeKey/HeadphoneKey.m index 5a062fc..e1588eb 100644 --- a/DomeKey/HeadphoneKey.m +++ b/DomeKey/HeadphoneKey.m @@ -96,6 +96,25 @@          }];  } +- (void)mpmediaplayerBS +{ +    MPRemoteCommandCenter *center = [MPRemoteCommandCenter sharedCommandCenter]; + +    [[center togglePlayPauseCommand] addTarget:self action:@selector(mpmediaplayerplaypauesss:)]; +// pauseCommand +// playCommand +// togglePlayPauseCommand +// nextTrackCommand +// previousTrackCommand +} + +- (MPRemoteCommandHandlerStatus) mpmediaplayerplaypauesss: (MPRemoteCommandEvent*) event +{ +    NSLog(@"Played from MPMediaPlayer"); + +    return MPRemoteCommandHandlerStatusSuccess; +} +  - (void)handleDeadKey:(HeadphoneButton)button  {      NSNumber *storable_button = [NSNumber numberWithUnsignedInteger:button]; | 
