Reputation: 2210
I have a fully working audio player that uses AVPlayer
to play music. I used MPVolumeView
in order to control volume. But as an extra feature I wanted users to control volume in some situations with a settings pane, which doesn't require user to manually set volume via MPVolumeView
.
At this point I am well aware that I cannot change value of MPVolumeView
, therefore hardware volume without user being interacted with.
But I want to know is there a way I can change volume of currently playing track of AVPLayer
or AVPlayer
itself (example: keeping current hardware volume as the maximum volume value).
Can I accomplish this with AVAudioPlayer
, MPMusicPlayerController
if not with AVPlayer
?
Upvotes: 0
Views: 94
Reputation: 79
You can use :
[yourAVPlayer setVolume: 0.0]
,
Ranging from 0.0 through 1.0 (0.0 -> Muted , 1.0 -> Max Vol).
Then you can have multiple AVPlayer with differents volumes
(Sorry for my english :) )
Upvotes: 1