Search code examples
iosaudiokit

iOS AudioKit: How to observe currently elapsed time while recording


I'm using AudioKit for recording and playback purposes in my app. I'm wanting to reflect the current elapsed recording time from the AKNodeRecorder so the user can see how long the recording is in real time. How can I accomplish this?

There are no delegate or callback functions exposed, and KVO isn't an option because the value I want to observer recordedDuration isn't @objc annonated. Is this possible or do I need to approach this from a different angle?


Solution

  • After combing through the source, I came across this class AKPeriodicFunction, which is passed in the AudioKit.start() call. This will fire a closure at a given interval so you can do whatever.