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 6364529
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T00:10:31+00:00 2026-05-25T00:10:31+00:00

I am trying to stream a remote mp3 using AVPlayer. I have set up

  • 0

I am trying to stream a remote mp3 using AVPlayer.

I have set up the Audio Session, and added the Plays Audio In Background to my info.plist file.

I am running this code:

self.timeObserver = [self->player addPeriodicTimeObserverForInterval:CMTimeMake(1, 1) queue:nil usingBlock:^(CMTime time) {
    [self updateControls];
}];

to add a time observer, that calls updateControls every second.

Thing is, when the sound buffer is low, the player just pauses, and this code in the background is stopped, so I have to manually press play in the app again. (and if I pause the player, this code doesn’t run either)

Am I doing anything wrong? How can I run a piece of code the whole time in the background without interruptions?

  • 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-05-25T00:10:31+00:00Added an answer on May 25, 2026 at 12:10 am

    You can’t run arbitrary code in the background indefinitely. You can keep the audio playing, but you shouldn’t be expecting to update your UI if you’re not the frontmost app. You can update the UI when your app moves back into the foreground.

    As long as you set your AVAudioSession properly and make it active, and you have the UIBackgroundModes set, you should be good to go on the audio front.

    see http://developer.apple.com/library/iOS/#documentation/Audio/Conceptual/AudioSessionProgrammingGuide/Configuration/Configuration.html

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

Sidebar

Related Questions

I'm trying to stream sound from my soundcard using sox's default audio device and
I'm trying to stream an audio file from a server protected by session-based authentication,
I'm trying to stream video to a server from another machine using Java and
I'm trying to set up a remote backup server for dar, along these lines
I'm using remote git repository. I successfully commit my files and now I'm trying
I'm trying to send a video stream to a Red5 server using Flex. My
I'm trying to establish an interactive SSH connection to a remote server using PHP
I'm trying to stream binary data to the standard output in .NET. However you
I am currently trying to stream content out to the web after a trans-coding
I'm generating a MJpeg Stream and trying to stream it to VLC and play

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.