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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T03:39:10+00:00 2026-06-07T03:39:10+00:00

I am creating a small fun application to play some mp3 files into a

  • 0

I am creating a small fun application to play some mp3 files into a PhoneGap app
I have managed to play the audio in the background, many thanks to help on StackOverflow

But now the problem is when the app runs in background, or the app is locked, the next songs does not play. I have written the code to play the next song

=======

$(".greyselected").each(function(i) {
if($(this).is(":visible"))
{
activetrackclass = $(this).attr("class").split(" ")[0];
return;
}
});


$("." + activetrackclass).each(function(i){
if($(this).hasClass("greyselected"))
{
fetchmp3($("." + activetrackclass + ":eq(" + parseInt(i+1) + ")").find(".partistname").text(), $("." + activetrackclass + ":eq(" + parseInt(i+1) + ")").find(".ptrackname").text(), $("." + activetrackclass + ":eq(" + parseInt(i+1) + ")").find(".ptrackurl").text(), $("." + activetrackclass + ":eq(" + parseInt(i+1) + ")").find(".spanduration").text(), "tracklist");

$("." + activetrackclass).removeClass("greyselected");
$("." + activetrackclass + ":eq(" + parseInt(i+1) + ")").addClass("greyselected");

$("#divplayer").slideDown("slow");
return false;
}
});

=======

greyselected is the song currently playing
activetrackclass is a variable that holds the class of the track item or track div
fetchmp3 is the function to call the next mp3 file in the list

All mp3 are hosted on a server

When the app is active it plays just fine, but as soon as it goes to background it just plays the song which was actively playing and then stops until the app is made visible again

Would appreciate your valuable help as always

  • 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-07T03:39:11+00:00Added an answer on June 7, 2026 at 3:39 am

    A background task only runs for a period of time, then the OS kills it. If your application is not active then it wont run forever and the ios will stop it after a while.

    http://www.macworld.com/article/1164616/how_ios_multitasking_really_works.html

    You can declare the support for background playback by specifying audio mode in UIBackgroundModes in Info.plist file. Check page 60 of iphone programming guide for more detail

    You have lot of options to configure the behavior of the audio if you application can use the native code. Check the Categories Express Audio Roles in below docs.

    http://developer.apple.com/library/ios/#documentation/Audio/Conceptual/AudioSessionProgrammingGuide/Introduction/Introduction.html#//apple_ref/doc/uid/TP40007875

    An old thread from Apple Developer Forum

    https://devforums.apple.com/message/264397#264397

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

Sidebar

Related Questions

I am creating a small Yahtzee game and i have run into some regex
I am creating small django application which holds some few questions (and answers for
I'm creating a small web application. The application have several screens (list, inner list,
I'm currently creating a small C# program that inserts data from files into a
I'm creating a small deb package to install a few files. Some of them
I'm creating a small application that I will distribute via NuGet. My web app
I'm creating a small app in ASP.NET MVC that generates ics (iCal) files based
I am creating a small application which will perform say 4 different, time consuming
I am creating a small (for now) stored procedure to insert some data. When
I'm creating a small vb.net application, and I'm trying trying to write a list

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.