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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T11:17:46+00:00 2026-05-28T11:17:46+00:00

there’s an audio application which streams files via network, everything works fine but one

  • 0

there’s an audio application which streams files via network, everything works fine but one thing. To play the next track automatically in the background the CFReadStream is initialized (i can see it in the log) after the AudioQueueStop is called, but the callback is never called (edit: actually is called once) until the app enters foreground. Piece of code for stream init:

    //also tried main runloop just for test, no luck 
CFReadStreamScheduleWithRunLoop(stream, CFRunLoopGetCurrent(), kCFRunLoopCommonModes);

The wired thing is that the app is functional after the queue is stopped, the stream is being initialized but the callback is properly called only if the stream was initialized in the foreground mode. Here is a piece of code for callback:

    CFReadStreamSetClient(stream,
                      kCFStreamEventHasBytesAvailable | kCFStreamEventErrorOccurred | kCFStreamEventEndEncountered,
                      MyReadStreamCallBack,
                      &context);

On the other hand, the callback is called when the application is in the background and the next track is triggered not automatically but with the app-delegate (with the same function).

I don’t completely understand the difference between that three cases, please help.

Edit.

OSStatus status = AudioFileStreamOpen(self, MyAudioListener ...

MyAudioListener callback is being called while MyReadStreamCallBack is called just once.

Edit 2

the ReadStream callback is most often not being called even once, one time is the maximum of what i was able to see.

On the other hand, and that drives me to misunderstanding of what’s happening, after the previous AudioQueue is stopped and the next track is a local file, then another AudioQueue is opened, it reads the file with AudioFileReadPackets and i don’t have to awake the application from background to start the next track playback as it plays itself in the background.

  • 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-28T11:17:46+00:00Added an answer on May 28, 2026 at 11:17 am

    An Audio Queue will continue run in the background, given the approprate background modes. But once stopped, it seems that an Audio Queue will not start running in the background. The one callback is probably just to prime the buffer so the the queue can start immediately after being brought to the foreground.

    The only solution I’ve found is to not stop the previous Audio Queue when in the background, but to somehow feed new audio data to the old Audio Queue left running, without underflowing any callbacks in between.

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

Sidebar

Related Questions

There are several shading languages available today like GLSL, HLSL, CG, which one to
There is an application written in PHP which I am converting to Ruby. When
There are numerous Agile software development methods. Which ones have you used in practice
There's a bug in FireBug: I accidentally clicked where the line numbers are, which
There's a few previous questions on StackOverflow questioning how one goes about accessing local
There is a shared folder in my D drive as works ( D:\works ).
There is a div (form) which opens on the click of a button. There
There is no doubt that MonoTouch is one of the great cross-compiler(s). Similarly, SenchaTouch
There are many tutorials that talk about deleting index.php from the url. But I
There must be a simple solution to this, but after 4 hours of browsing

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.