I\'m searching for a way to get notified the exact moment when AVPlayer
starts playing. There\'s the \"rate\" property, but currently I am checking it periodically
1)Add below (observer)code to your avPlayer Object
self.player?.addObserver(self, forKeyPath: "rate", options: [], context: nil)
2)And below delegate for that
override func observeValue(forKeyPath keyPath: String?, of object: Any?, change: [NSKeyValueChangeKey : Any]?, context: UnsafeMutableRawPointer?) {
if (keyPath == "rate") {
if ((player?.rate) == 1) {
print("Plyaing")
} else {
print("Pause")
}
}
}