0

I am making an app which is used to connect to a custom made wearable. I am not using the MFi program and is simply using the CoreBluetooth Framework. I have also made use of the ANCS on the hardware side to handle all kinds of notifications.

The problem here is that I am not able to find any means to control the music player of iPhone through the wearable. Does iOS provide this control under CoreBluetooth as Pebble has implemented it or we need to specifically register for the MFi Program to use this feature.

I have not been able to find any relevant article or post regarding controlling the music player. So any help will be highly appreciated.

Thanks in advance.

Shikhar varshney
  • 816
  • 1
  • 9
  • 23
  • You either need your wearable to communicate with a helper app on the phone and have that app issue the music control,commands or implement the legacy AVRCP profile in your wearable - which may be tricky as I believe most bt chipsets only operate in one mode at a time (BLE or 2.1/3) – Paulw11 Jan 09 '15 at 20:39
  • 1.What I understand is that you are asking me to create an app which has play, pause button in the app itself.Please correct me if needed. 2.Also for the second point that these two profiles can't exist simultaneously then how is Pebble operating both these things at the same time? 3.Do implementing AVRCP requires MFI program. 4.On implementing AVRCP does it require anything from the app side to control the music player. Hope its not much to ask but I am having a great curiosity about all these restrictions. Thanks a lot in advance Paul – Shikhar varshney Jan 10 '15 at 04:20
  • @Paul;- Can u just comment on the fact that is it necessary to go through the MFi program to implement AVRCP 1.4 in my wearable. – Shikhar varshney Jan 10 '15 at 06:29
  • No, it shouldn't be. Standard audio profiles are supported without MFI – Paulw11 Jan 10 '15 at 07:52
  • Thanks. The doubt was only due to your other answer as mentioned in this link:- http://stackoverflow.com/questions/23177887/what-specs-do-i-need-to-know-to-develop-bluetooth-avrcp-1-4-iphone-app Can you pls clarify this? – Shikhar varshney Jan 10 '15 at 08:04
  • Sorry, yes, that is misleading. Here is the list of profiles supported without MFi http://support.apple.com/en-au/HT3647 – Paulw11 Jan 10 '15 at 08:13
  • Hey @Shikharvarshney I want to do the same , did you find any solution? please help me out , I am stuck at this – va05 Jul 11 '18 at 19:16

1 Answers1

1

It sounds to me like all you need is to monitor something on your wearable (button or whatever you use) using CoreBluetooth, and to use the standard iOS MediaPlayer framework to play/pause your music when triggered by the wearable device. If you don't know how to monitor a characteristic on your wearable, check out the CoreBluetooth Programming Guide: Performing Common Central Role Tasks.

The music player is very easy to use. You use the MPMusicPlayerController class to play and pause music. Below is a basic example where I've used aViewController and a UIButton to activate the play/pause functionality. It should be fairly easy to adapt to a CoreBluetooth implementation.

#import "ViewController.h"
@import MediaPlayer;

@interface ViewController ()
@property (strong, nonatomic) MPMusicPlayerController *musicPlayer;
@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];

    self.musicPlayer = [MPMusicPlayerController systemMusicPlayer];
}

- (BOOL)isPlaying
{
    if ([self.musicPlayer playbackState] == MPMusicPlaybackStatePlaying) {
        return YES;
    } else {
        return NO;
    }
}

- (IBAction)play
{
    if ([self isPlaying]) [self.musicPlayer pause];
    else                  [self.musicPlayer play];
}
vegather
  • 470
  • 4
  • 14