3
votes

The scenario as follows.......

  1. Play a background mp3 using AVAudioPlayer,
  2. While background music is playing play a video( video without audio ) using AVPlayer,
  3. Now if try to mute the audio by device mute the background audio doesn't mute,

Strangely it works fine with video which has audio....

1

1 Answers

2
votes
- (void)mute { //it only work device,not work in simulator
    //check condition
    if(condition){
        //volume mute
        [[MPMusicPlayerController applicationMusicPlayer] setVolume:0];
    } else {
        //volume unmute
        [[MPMusicPlayerController applicationMusicPlayer] setVolume:your value];
    }
}