I have an AVAudioPlayer
stored in a property called "player". When the user clicks a button, it triggers this code:
@IBAction func restartPressed(sender: AnyObject) {
player.play()
}
The problem is happening when the user clicks the button twice in a row very quickly.
If the sound from the first click is still playing, it seems like the second call is ignored.
Instead, I'd like to either:
a) restart the player from the beginning when the button is clicked a second time; or
b) have two "instances" of the sound playing at the same time.
How would I go about achieving either or both of these options?