iphone - AVPlayer volume control while playing Video -


i working on custom video player using avplayer class in want implement volume control using uislidercontrol.

i have done this:

nsmutablearray *allaudioparams = [nsmutablearray array]; avmutableaudiomixinputparameters *audioinputparams =[avmutableaudiomixinputparameters audiomixinputparameters]; [audioinputparams setvolume:volumeslider.value attime:kcmtimezero]; [allaudioparams addobject:audioinputparams]; avmutableaudiomix *audiozeromix = [avmutableaudiomix audiomix]; [audiozeromix setinputparameters:allaudioparams]; [self.playeritem setaudiomix:audiozeromix]; 

but not working me can please suggest me other solution have done r&d not able find proper solution.

thanks.

you can use below code change volume :

nsarray *audiotracks = [asset trackswithmediatype:avmediatypeaudio];  nsmutablearray *allaudioparams = [nsmutablearray array]; (avassettrack *track in audiotracks) {   avmutableaudiomixinputparameters *audioinputparams =      [avmutableaudiomixinputparameters audiomixinputparameters];   [audioinputparams setvolume:volume attime:kcmtimezero];   [audioinputparams settrackid:[track trackid]];   [allaudioparams addobject:audioinputparams]; }  avmutableaudiomix *audiomix = [avmutableaudiomix audiomix]; [audiomix setinputparameters:allaudioparams];  [playeritem setaudiomix:audiomix]; 

Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -