Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save kenchoong/9e4133c0a87b8ac1f29f3a3ed4579143 to your computer and use it in GitHub Desktop.
Save kenchoong/9e4133c0a87b8ac1f29f3a3ed4579143 to your computer and use it in GitHub Desktop.
Check if AVPlayer is currently playing an item
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