I want to create a button that mutes the audio from an AVPlayer.
Why can´t I use .volume with AVPlayer, only with AVAudioPlayer? Is there another way to change the v
best way is as following
AVAssetTrack* assetTrackAudio = [arrayTracks objectAtIndex:0];
AVMutableAudioMixInputParameters* audioInputParams = [AVMutableAudioMixInputParameters audioMixInputParameters];
[audioInputParams setVolume:currentVolume atTime:playerCursorStartPosition];
[audioInputParams setTrackID:[assetTrackAudio trackID]];
NSArray* audioParams = [NSArray arrayWithObject:audioInputParams];
AVMutableAudioMix* audioMix = [AVMutableAudioMix audioMix];
[audioMix setInputParameters:audioParams];
AVPlayerItem* item = [player currentItem];
[item setAudioMix:audioMix];