Audiobooks Mobile App Development
Audiobooks player — one of technically dense media apps on mobile. Combines: precise playback control, aggressive caching of large files, DRM for content protection, chapter navigation, sleep timer and position sync between devices. Each item is concrete implementation, not just "media player."
File Format and Streaming Playback
Audiobooks usually formats: MP3 (most widely), M4B (AAC in MP4 container with chapter markers, Apple standard), M4A, OGG/Opus. M4B preferred for new catalogs — natively contains chapters, cover and metadata without sidecar.
Streaming playback (don't download fully before playing): AVPlayer on iOS opens HTTP URL and starts playing without full load. ExoPlayer (Media3) on Android — similarly via DefaultDataSource.Factory. For long files (15 hours = ~800 MB) critical.
Chapters from M4B: AVAsset.loadChapterMetadataGroups(bestMatchingPreferredLanguages:) returns AVTimedMetadataGroup[] with timestamps and names. On Android — MediaMetadataRetriever.extractMetadata + MP4 box structure parsing for chapter atoms, or use ExoPlayer with custom MetadataRetriever.
Precise Position Saving
User listens to book in car, closes app — next opening should land exactly on that spot. To the second.
Save currentTime (Double, seconds) + bookId + timestamp of save in UserDefaults/SharedPreferences on each background transition, applicationDidEnterBackground and via Timer every 5 seconds during playback. Timer every 5 seconds — not every second, redundant.
On restore: player.seek(to: CMTime(seconds: savedPosition, preferredTimescale: 1000)) with .seconds precision. Not MSEC — sufficient for audio.
Sync between devices: CloudKit CKRecord (iOS) or Firebase Firestore with userId/bookId key. On opening book on new device offer "Continue from 1:23:45" — user decides.
Sleep Timer
Popular feature: playback stops after N minutes. Trivial — DispatchQueue.main.asyncAfter (iOS) or Handler.postDelayed (Android). Non-trivial variant: "stop at end of current chapter" — get current chapter endTime from metadata and schedule stop at that time.
Smooth fade before stop: 30 seconds before end reduce player.volume linearly to 0 via CADisplayLink / ValueAnimator. Not abrupt stop — annoying.
Playback Speed and Pitch Correction
player.rate = 1.5 (AVPlayer) speeds playback but raises pitch — voice becomes squeaky. iOS automatically applies pitch correction for AVPlayer at rate ≠ 1.0 from iOS 16. On older — AVAudioUnitTimePitch in AVAudioEngine pipeline.
Android ExoPlayer: playbackParameters = PlaybackParameters(speed = 1.5f) — pitch correction built-in. Flutter just_audio: player.setSpeed(1.5) with default pitchCorrectionMethod.
Useful speed range: 0.75x (for complex technical content), 1.0x, 1.25x, 1.5x, 2.0x. Above 2x — intelligibility drops critically.
Offline Download and DRM
Offline download — URLSessionDownloadTask + URLSessionConfiguration.background (iOS): works even without app running, progress saved on crashes. Android: WorkManager + DownloadManager or OkHttp with custom progress.
For paid content need DRM. FairPlay Streaming (iOS) — integrates with AVContentKeySession. Widevine L3 (Android) — ExoPlayer with DefaultDrmSessionManager. Encryption key requested from license server on each playback. Without DRM user copies file from /Library/Application Support and listens without subscription.
Alternative without full DRM: AES-256 encryption of file on disk with key tied to account and DeviceID. Cheaper to implement, less protection.
Catalog and Search
User library: purchased and downloaded books. Store catalog: search, genres, new releases, recommendations. Pagination via cursor (Alchemy-style next token or offset/limit). Covers — via SDWebImage/Coil/cached_network_image with aggressive disk cache (covers rarely change).
| Feature | MVP | Full |
|---|---|---|
| MP3/M4B playback | yes | yes |
| Chapters and navigation | no | yes |
| Offline download | no | yes |
| Position sync | no | yes |
| DRM | no | yes |
| Sleep timer | yes | yes |
Timeline: MVP player with catalog and basic playback — 3-4 weeks. Full product with DRM, offline, sync and subscription — 8-12 weeks.







