I am working on a custom audio player. I am using a UISlider to adjust volume.It is working fine when I play on iPad. But when I use AirPlay volume does not adjust.
Here is my code to adjust volume.
UISlider* slide = sender;
NSArray *audioTracks = [myPlayer.currentItem.asset tracksWithMediaType:AVMediaTypeAudio];
NSMutableArray *allAudioParams = [NSMutableArray array];
for (AVAssetTrack *track in audioTracks) {
AVMutableAudioMixInputParameters *audioInputParams =[AVMutableAudioMixInputParameters audioMixInputParametersWithTrack:track];
[audioInputParams setVolume:slide.value atTime:myPlayer.currentTime];
[audioInputParams setTrackID:[track trackID]];
[allAudioParams addObject:audioInputParams];
}
AVMutableAudioMix *audioZeroMix = [AVMutableAudioMix audioMix];
[audioZeroMix setInputParameters:allAudioParams];
[myPlayer.currentItem setAudioMix:audioZeroMix];