S'rCat S'rCat - 27 days ago 18
iOS Question

In iOs AVPlayer, addPeriodicTimeObserverForInterval seems to be missing

I'm trying to setup AVPlayer.addPeriodicTimeObserverForInterval(). Has anyone used this successfully?

I'm using Xcode 8.1, Swift 3

Answer

Check this func addPeriodicTimeObserver(forInterval interval: CMTime, queue: DispatchQueue?, using block: @escaping (CMTime) -> Void) -> Any

It is in the documents also for example check this code snippet

let timeObserverToken = player.addPeriodicTimeObserver(forInterval: interval, queue: DispatchQueue.main) { [unowned self] time in 
}

Referenced from here

Comments