Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8372627
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T14:28:52+00:00 2026-06-09T14:28:52+00:00

I have an AVAudioPlayer that needs to continue in the background. Audio is set

  • 0

I have an AVAudioPlayer that needs to continue in the background.

Audio is set as the background mode in the plist & this runs on launch:

[[UIApplication sharedApplication] beginReceivingRemoteControlEvents];
[[RootController shared].view becomeFirstResponder];

AVAudioSession* session = [AVAudioSession sharedInstance];
[session setDelegate: self];
[session setActive:YES error:nil];
[session setCategory: AVAudioSessionCategoryPlayback error:nil];

- (BOOL)canBecomeFirstResponder { return YES; }

The Problem

Occasionally the AVAudioPlayer gets in this strange state where:

  • It’s playing, but the play icon in the status bar disappears
  • If I pause then play, the icon shows up for maybe a second, then disappears
  • Here’s the kicker – if I call setCurrentTime while playing, the play icon shows & stays

I’ve sunk about 20 hours into this & would love any ideas.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T14:28:53+00:00Added an answer on June 9, 2026 at 2:28 pm

    Description of the Bug

    If you are playing an AVAudioPlayer then you create an AVPlayer, the playing icon will disappear. Apparently AVPlayer immediately takes precedence & since it is not playing yet the play icon disappears from the status bar.

    This causes some serious issues:

    1. If the app is in the background, iOS will shut down your AVAudioPlayer within 5 seconds (because it doesn’t realize you’re playing audio)
    2. The iOS remote shows a play button even though audio is playing
    3. The play icon is not showing in the status bar

    The Workaround

    First off, if you don’t have to use AVPlayer, then don’t. I use it because I need to play a remote MP3 without downloading it first. I used to use this AudioStreamer class but gave up because it pops up an alert when the stream becomes disconnected along with a few other bugs that I couldn’t fix.

    So if you’re stuck with AVPlayer, there’s only one way to re-connect playing status with your AVAudioPlayer. If you call setCurrentTime on the AVAudioPlayer then it will magically re-associate itself as the current player for the app. So you’ll need to call it after any AVPlayer is initialized and anytime you resume playback on your AVAudioPlayer.

    I decided to subclass AVAudioPlayer so I could register it in a global list (when it is initialized) and unregister it when it is deallocated. I also overrode the play method so that any calls to resume playback would also call setCurrentTime. Then I subclassed AVPlayer so that any time one is initialized, all active AVAudioPlayers call setCurrentTime on themselves. Last thing – you’ll have to call setCurrentTime after a short, maybe 1 second, delay or else it will have no effect.

    No kidding, this is the result of nearly 40 hours of troubleshooting.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a class that plays a repeating background music loop with an AVAudioPlayer
I am using the AVAudioPlayer framework, and I have several sounds that play one
I have an Audio app using AVAudioPlayer on iOS. Whenever music is playing my
have a problem. At first look at this HTML <div id=map style=background-image: url(map.png); width:
I currently have this code that works. I have two questions. How do I
I have noticed since upgrading to iOS5 that an audio app I have been
Alright I have two problems. I'm using AVAudioPlayer to play a simple audio file
I have a 3rd party SDK that handles an audio recording. It has a
I'm trying to understand AVAudioPlayer and audio level metering. What I have below is
I have a codebase which plays audio and video perfectly. I have converted that

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.