How can I access the hardware volume buttons in Ionic?

I have a radio solution that uses the Media Plugin. Everything works great except when you use the setVolume method it doesn’t apply to the volume of the device and vice versa – adjusting the volume using the hardware buttons doesn’t affect the Media Plugin’s volume only the overall device so you end up with two separate volume controls.

Is there anyway to link these two together? Can you get the current volume level the hardware is set to?

Have you investigated this plugin?

There’s no iOS support for that plugin it seems

Did you guys find a solution?

is there no solution for IOS yet?

Any solution on this for both android and ios?

I used the broadcaster for accessing the hardware volume buttons. Wrote a small amount of native code. The broadcaster can communicate with the native code. so in iOS i used the code used here:

Use this to get access to the volume button. You need to send this volumeLevel with the broadcaster to the ionic app.

Hey can you please share your code for ios !!

Sorry for the late response. Never used the code anymore. In the link you can find iOS code on how to read the volume buttons. Add a listener in you appdelegate that uses the broadcaster. In your Typescript you can use the broadcaster to listen to the send message from your appdelegate.

Can u pls share us the code which u have as a plugin to fix this.

I wasnt able to run the code any more but i found something which might help you.


 AVAudioSession* audioSession = [AVAudioSession sharedInstance];
[audioSession setActive:YES error:nil];
[audioSession addObserver:self

-(void) observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context {

  if ([keyPath isEqual:@"outputVolume"]) {
      float volumeLevel = [[MPMusicPlayerController applicationMusicPlayer] volume];
      NSLog(@"%f", volumeLevel);
      NSDictionary * payload = @{
          @"data": @(volumeLevel).stringValue,
          @"valid": [NSNumber numberWithBool:YES],

      [[NSNotificationCenter defaultCenter] postNotificationName:@"VOLUME.EVENT"


    this.broadCaster.addEventListener('VOLUME.EVENT').subscribe(data => {

Hopefully you can do something with this. If you have more questions tell me.