-
-
Save kenchoong/9e4133c0a87b8ac1f29f3a3ed4579143 to your computer and use it in GitHub Desktop.
Check if AVPlayer is currently playing an item
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
import AVFoundation | |
extension AVPlayer { | |
var isPlaying: Bool { | |
if (self.rate != 0 && self.error == nil) { | |
return true | |
} else { | |
return false | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment