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

  • Home
  • SEARCH
  • 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 6852857
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T01:26:31+00:00 2026-05-27T01:26:31+00:00

I used AVQueuePlayer to play several items in background. And code worked perfect in

  • 0

I used AVQueuePlayer to play several items in background. And code worked perfect in iOS4. And in iOS5 AVQueuePlayer changed its behavior, so player stops playing after first item is ended.

Matt Gallagher wrote a hint in this post. “As of iOS 5, it appears that AVQueuePlayer no longer pre-buffers. It did pre-buffer the next track in iOS 4.”

So my question is how to play several items in background using AVPlayer or AVQueuePlayer in iOS5.

  • 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-27T01:26:31+00:00Added an answer on May 27, 2026 at 1:26 am

    Matt Gallagher’s answer in his blog:
    “You must observe the current item in the AVQueuePlayer. When it changes, you must use UIApplication to start a backgroundTask and only end the background task when you receive a ready to play notification for the next file.”

    Actually, this did not helped me.

    So my solution is:

    [[UIApplication sharedApplication] beginReceivingRemoteControlEvents];
    

    I can’t explain why, but this line of code put before adding new AVPlayerItem made my code work.
    Also for those one who adds next track in background and uses method

    - (void)loadValuesAsynchronouslyForKeys:(NSArray *)keys completionHandler:(void (^)(void))handler;
    

    You must add AVPlayerItem to player on the main thread.
    like this:

    - (void)addAsset:(AVAsset*)as
    {
        [player insertItem:[AVPlayerItem playerItemWithAsset:as] afterItem:[player currentItem]];
    }
    
    .........
    
    //adding new track 
    
    AVURLAsset* as = [[self createAsset:urlString] retain];
    NSArray *keys = [NSArray arrayWithObject:@"tracks"];
    [as loadValuesAsynchronouslyForKeys:keys completionHandler:^(void) {
    NSError *error = 
    AVKeyValueStatus trackStatus = [as statusOfValueForKey:@"tracks" error:&error];
    switch (trackStatus) {
        case AVKeyValueStatusLoaded:
                [self performSelectorOnMainThread:@selector(addAsset:) withObject:as waitUntilDone:YES];
                [as release];
        break;
        case AVKeyValueStatusFailed:
                [as release];
        break;
        case AVKeyValueStatusCancelled:
                [as release];
        break;
        default:
        break;
        }
    
    }];
    

    UPDATE:
    Matt Gallagher was right, but it works only if you do not use asynchronous loading.

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

Sidebar

Related Questions

I used this code to add the data in the mysql table. But I
I used this code to select top 5 users from jQuery grid on button
Used one hidden element to capture changed value and change the element value using
I used the following code to display the event details fetched from the database.
I used the following code to display a rich list. import net.rim.device.api.ui.*; import net.rim.device.api.ui.container.*;
Used this tutorial I have installed jogl, jocl, gluegen, joal libs and added its
I used to have a code that checks any previous element with a corresponding
I used to code in C language in the past and I found the
I used to compile my asm code with TASM (on winXP) but I had
used to Apache in Linux where each domain name using ssl requires its own

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.