I play sound using AVAudioPlayer .
The sound on iPod (iOS7 and iOS8 both) is good.
But when I play the same sound on the iPhone, the sound plays at a very low volume.
Here is my code:
var audioPlayer: AVAudioPlayer? var soundURL:NSURL? = NSURL(fileURLWithPath: NSBundle.mainBundle().pathForResource("sound", ofType: "mp3")!) audioPlayer = AVAudioPlayer(contentsOfURL: soundURL, error: nil) audioPlayer?.prepareToPlay() audioPlayer?.volume = 1 audioPlayer?.play()
The AudioToolbox.framework library is already included in my project.
How to improve sound in iPhone6 ββand 6+?
EDIT
I recently noticed that the sound automatically increased by a couple of seconds, but I donβt know what happened.
ios swift avaudioplayer
Zaid pathan
source share