Skip to end of metadata
Go to start of metadata

Due to the bug 17292753 mentioned here it is impossible to mute playback volume using device hardware buttons. The following methods are added since build 2.6.26 to mute

[[FPWCSApi2 getAudioManager] muteAudio];

and unmute audio playback

[[FPWCSApi2 getAudioManager] unmuteAudio];

It is necessary to subscribe to voluem change events to workarond the bug and allow to mute sound with hardware buttons (code)

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(volumeChanged:) name:@"AVSystemController_SystemVolumeDidChangeNotification" object:nil];

and mute audio when current volume value reaches the certain value, and unmute when this value is exceeded (code)

- (void)volumeChanged:(NSNotification *)notification
{
    float volume =
    [[[notification userInfo]
      objectForKey:@"AVSystemController_AudioVolumeNotificationParameter"]
     floatValue];
    
    currentVolume = volume;
    
    if (volume <= 0.0625) {
        [[FPWCSApi2 getAudioManager] muteAudio];
    } else {
        [[FPWCSApi2 getAudioManager] unmuteAudio];
    }
    
}
  • No labels