Daily iOS
iOS system design

Timestamp-synced audiobook

Design an "enhanced playback" feature for an audiobook app. For supported titles, the app has to show a specific image at set timestamps while the audio plays. How would you keep the audio clock and the image display in sync?

How would an interviewer hear this answer? You'll see whether they'd move on, dig in, or say no, and which sentences would trip you up. Your score doesn't change.
See the short answer

Use AVPlayer's boundary time observer (or a periodic observer plus binary search) to find the cue for the current time and show it, prefetching the next 1 or 2 images. On seek or rate change, recompute the active cue from the current position, and in the background stop image updates but resync by position on return.

Share a question