Audio player in mobile app

TRUETECH is engaged in the development, support and maintenance of iOS, Android, PWA mobile applications. We have extensive experience and expertise in publishing mobile applications in popular markets like Google Play, App Store, Amazon, AppGallery and others.
Development and support of all types of mobile applications:
Information and entertainment mobile applications
News apps, games, reference guides, online catalogs, weather apps, fitness and health apps, travel apps, educational apps, social networks and messengers, quizzes, blogs and podcasts, forums, aggregators
E-commerce mobile applications
Online stores, B2B apps, marketplaces, online exchanges, cashback services, exchanges, dropshipping platforms, loyalty programs, food and goods delivery, payment systems.
Business process management mobile applications
CRM systems, ERP systems, project management, sales team tools, financial management, production management, logistics and delivery management, HR management, data monitoring systems
Electronic services mobile applications
Classified ads platforms, online schools, online cinemas, electronic service platforms, cashback platforms, video hosting, thematic portals, online booking and scheduling platforms, online trading platforms

These are just some of the types of mobile applications we work with, and each of them may have its own specific features and functionality, tailored to the specific needs and goals of the client.

Showing 1 of 1 servicesAll 1735 services
Audio player in mobile app
Medium
~2-3 business days
FAQ
Our competencies:
Development stages
Latest works
  • image_mobile-applications_feedme_467_0.webp
    Development of a mobile application for FEEDME
    756
  • image_mobile-applications_xoomer_471_0.webp
    Development of a mobile application for XOOMER
    624
  • image_mobile-applications_rhl_428_0.webp
    Development of a mobile application for RHL
    1054
  • image_mobile-applications_zippy_411_0.webp
    Development of a mobile application for ZIPPY
    947
  • image_mobile-applications_affhome_429_0.webp
    Development of a mobile application for Affhome
    862
  • image_mobile-applications_flavors_409_0.webp
    Development of a mobile application for the FLAVORS company
    445

Implementing Audio Player in Mobile Applications

When user minimizes the app, audio should keep playing — and lock screen should show control buttons. This is not "extra feature" but expected behavior. Exactly here most implementations break.

Background Playback

iOS. Add UIBackgroundModes: audio to Info.plist. AVAudioSession:

try AVAudioSession.sharedInstance().setCategory(
    .playback,
    mode: .default,
    options: []
)
try AVAudioSession.sharedInstance().setActive(true)

.playback — category for player. Without it, iOS stops playback 3 seconds after background transition. But more important: AVAudioSession must be activated before playback starts, not after.

Android. MediaSessionCompat + MediaBrowserServiceCompat or, for new projects, media3 ExoPlayer with MediaSessionService. Declare service in AndroidManifest.xml with android:foregroundServiceType="mediaPlayback". Without foreground service, Android 8+ kills process.

ExoPlayer vs AVPlayer

ExoPlayer (androidx.media3:media3-exoplayer) — standard for Android. Supports MP3, AAC, FLAC, OGG, WAV, M4A, OPUS out of the box. Control via Player.Listener. Playlist — MediaItem.Builder().setUri(uri).setMediaMetadata(metadata).build().

AVPlayer (iOS) — for single track. For queue — AVQueuePlayer with AVPlayerItem. Add observation via AVPlayerItem.status KVO and AVPlayerItemDidPlayToEndTimeNotification.

Seeking

AVQueuePlayer on iOS: seek(to: CMTime, toleranceBefore: .zero, toleranceAfter: .zero) — precise seek. toleranceBefore/After: .zero slower but precisely hits target frame. For slider with drag, CMTime(seconds: 0.5, ...) suffices — faster.

ExoPlayer: player.seekTo(positionMs). With SEEK_PRECISE strategy — precise but more CPU-intensive.

Track Queue and Metadata

Pass track metadata (title, artist, artwork) to Lock Screen via MPNowPlayingInfoCenter (iOS) or MediaSession.setMetadata() (Android).

MPNowPlayingInfoCenter.default().nowPlayingInfo = [
    MPMediaItemPropertyTitle: track.title,
    MPMediaItemPropertyArtist: track.artist,
    MPMediaItemPropertyPlaybackDuration: track.duration,
    MPNowPlayingInfoPropertyElapsedPlaybackTime: player.currentTime,
    MPMediaItemPropertyArtwork: MPMediaItemArtwork(boundsSize: artworkSize) { _ in artworkImage }
]

Without MPMediaItemPropertyArtwork, Lock Screen displays gray rectangle.

Handling Interruptions

Phone call, another app with audio — interruptions happen. iOS: AVAudioSession.interruptionNotification. Android: AudioFocusRequest with OnAudioFocusChangeListener. On AUDIOFOCUS_LOSS_TRANSIENT — pause with auto-resume. On AUDIOFOCUS_LOSS — pause without resume (another app hijacked focus long-term).

Crossfade Between Tracks

Smooth track transition — detail that music app users notice. On iOS: create two AVAudioPlayer (or AVPlayerNode in AVAudioEngine), apply fade out to current and fade in to next via AVAudioEngine.mainMixerNode.volume with AVAudioTime. On Android: ExoPlayer doesn't natively support crossfade — implement via AudioMixer (API 31+) or parallel ExoPlayer with gradual volume decrease/increase via Handler.postDelayed.

Playback Speed

Podcasts and audiobooks often play at 1.25x or 1.5x. iOS: AVPlayer.rate = 1.5. Android/ExoPlayer: player.playbackParameters = PlaybackParameters(1.5f). Above 1.5x, audio without processing sounds unnatural (chipmunk effect) — ExoPlayer automatically applies pitch correction via SonicAudioProcessor. On iOS above 2.0x, explicitly set AVAudioTimePitchAlgorithm.timeDomain on AVPlayerItem.

Flutter: just_audio

just_audio (pub.dev) — most full-featured audio player for Flutter. Supports queue, loops, shuffle, speed, background playback via audio_service. AudioPlayer.createProgressiveAudioSource() for progressive URLs, AudioPlayer.createHlsAudioSource() for HLS streams.

Timeline

Audio player with queue, background playback and media controls — 2–3 days. Custom UI with waveform progress bar and animation — plus 1–2 days.