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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T12:42:57+00:00 2026-05-25T12:42:57+00:00

Firstly, I understand this is a copy of a similar objective C based question,

  • 0

Firstly, I understand this is a copy of a similar objective C based question, but it wasn’t answered.

Im using AVPlayer for the audio in my app. I have it playing audio, setting up its audio session correctly (I think, the play icon appears in the status bar when I play audio tracks within my app, and my app icon appears beside the player transport controls in the multitasking dock). However, I cannot get it to continue playing in the background when I press the Home button. The music just fades out and stops.

I have the following key in my info.plist:

<key>UIBackgroundModes</key>
<array>
<string>audio</string>
</array>

In my class that handles playback, I have:

AVAudioSession audioSession = AVAudioSession.SharedInstance();
NSError error;
audioSession.SetCategory(AVAudioSession.CategoryPlayback.ToString(),out   error);
audioSession.SetActive(true,out error);

UIApplication.SharedApplication.BeginReceivingRemoteControlEvents();

int taskID = 0;
taskID = UIApplication.SharedApplication.BeginBackgroundTask(delegate
{
    if(taskID !=0)
    {
        UIApplication.SharedApplication.EndBackgroundTask(taskID);
        taskID = 0;
    }
});


PlaylistManager = new ApolloPlaylistManager();
AudioPlayer = new AVPlayer();

Not sure if I need that BeginBackgroundTask part, but it doesn’t work if its in or out, im actually pretty sure I dont need it. Any tips at all greatly appreciated, as I’ve been stuck on this for a few days 🙁

  • 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-25T12:42:58+00:00Added an answer on May 25, 2026 at 12:42 pm

    Ok, I feel a little stupid. It turns out my key UIApplicationModes had a space in front of it. Doh!

    Well, to anyone having similar problems, ensure your info.plist looks like this

    <key>UIBackgroundModes</key>
    <array>
     <string>audio</string>
    </array>
    

    and setup your playback code like this (remember, this is Monotouch):

    AVAudioSession audioSession = AVAudioSession.SharedInstance();
    NSError error;
    audioSession.SetCategory(AVAudioSession.CategoryPlayback.ToString(),out error);
            audioSession.SetActive(true,out error);
    
            UIApplication.SharedApplication.BeginReceivingRemoteControlEvents();
    
            AudioPlayer = new AVPlayer();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Firstly, I'm aware of this question , but I don't believe I'm asking the
Firstly, I do not have any malicious intent out of this question. I would
Firstly apologies if this a very basic question, I'm just curious to know the
Firstly - Z is Up in this problem. Context: Top down 2D Game using
Firstly I am using this for the ListView control itself: ItemsSource={Binding AllEffects} So would
Firstly, this is just an Object Oriented Programming question and does not apply to
Please understand firstly that I fully understand that Java will return a String when
I am not able to understand few things on the Garbage collection. Firstly, how
Firstly: I am totally a newbie for this kind of work. I have a
Firstly I know that there are many question and solutions to correct thread marshalling

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.