My code is designed to stop the avplayer if it is playing and segue to the next view controller. The problem is if I hit the button without hitting the button to start the avplayer it causes a run time error. If the avplayer is not playing i need to be able to segue to the next avplayer.
@IBAction func stop () {
//what to do if player is not playing.
if player.isPlaying == true {
player.stop()
}
}
@IBAction func stop () {
//what to do if player is not playing.
if player.isPlaying == true {
player.stop()
} else { //meaning player.isPlaying is false...
performSegue(withIdentifier identifier: String, sender: Any?)
}
Would something like that work for you? Just wondering.