I am using AVPlayer for live playback (m3U8 file). It works great with AVPlayer, but I can't turn it off.
I use the following code to mute.
NSMutableArray *allAudioParams = [NSMutableArray array]; for (AVPlayerItemTrack *track in _player.currentItem.tracks) { if ([track.assetTrack.mediaType isEqual:AVMediaTypeAudio]) { AVMutableAudioMixInputParameters *audioInputParams = [AVMutableAudioMixInputParameters audioMixInputParameters]; [audioInputParams setVolume:0.0 atTime:kCMTimeZero]; [audioInputParams setTrackID:[track.assetTrack trackID]]; [allAudioParams addObject:audioInputParams]; } } AVMutableAudioMix *audioZeroMix = [AVMutableAudioMix audioMix]; [audioZeroMix setInputParameters:allAudioParams]; [[_player currentItem] setAudioMix:audioZeroMix];
Using the same code, I can disable local video files as well as progressive videos that I play in the same AVPlayer code.
(maybe for live video, the tracks available in the AVPlayer instance can be set as a ZERO volume, but the following buffering tracks are fresh with the volume, am I right or for any other reasons?)
Anyone have an idea on this issue. Any help on this is very noticeable.
source share