I am making a background audio for my current App. The audio is playing by initializing a AVAudioPlayer instance, like the following code:
var audioPlayer = AVAudioPlayer()
I have been reading the AVAudioPlayer's documents.
My question is : how to mute/unmute the audioPlayer and it is still playing in the background? Should I do it via volume control or any function that can swift on and off audio instantly? Thanks in advance.
The volume will be controllable by the person's volume buttons on the side of their device or you can set the volume via the volume
property if you have a UI control visible for the person to mute it with.
https://developer.apple.com/documentation/avfoundation/avaudioplayer/1389330-volume