How to manage volume with SwiftUI on a real device?
I'm finishing up an app update and I realized that the code I'm using to lower the volume only works on the simulator, it does not work on when I test my app on a real device. Below is my code summarized: func playSoundEffect(soundName:String) { var soundExtension:String = "mp3" guard let url = Bundle.main.url(forResource: soundName, withExtension: soundExtension) else { return } let player: AVAudioPlayer do { player = try AVAudioPlayer(contentsOf: url) } catch { return } // THIS HAS NO EFFECT ON A REAL DEVICE player.volume = 0.10 audioQueue.async { player.play() } player.delegate = self playe
0 upvotes
View original discussion ↗
Comments
Sign in or sign up to comment and upvote.
No comments yet.