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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T14:47:03+00:00 2026-05-27T14:47:03+00:00

I need to: play a sound loop continue to play in background All works

  • 0

I need to:

  • play a sound
  • loop
  • continue to play in background

All works fine with AVAudioPlayer, but now I have to use AVPlayer to play also music songs from the iPod library. But there is a big problem: AVPlayer has no numberOfLoops property like in AVAudioPlayer.

Ok, you can register a notification to the NSNotificationCenter for AVPlayerItemDidPlayToEndTimeNotification (or you can also use the addBoundaryTimeObserverForTimes method with specified times equal to the song duration) to be notified when a song has played to the end.
But this works only if the app is in the foreground, in the background the song continues to play, but stops at the end.

The notification is received also in the background (checked with a NSLog), but the selector’s code:

AVPlayerItem *playerItem = [notification object];  
[playerItem seekToTime:kCMTimeZero];

…has no effect, the song doesn’t loop.

Any suggestions?

  • 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-27T14:47:04+00:00Added an answer on May 27, 2026 at 2:47 pm

    The problem you have is the second the player does a seektotime your app looks like it’s done playing audio, and so it’s thrown on the bonfire. 🙂

    I spent days creating this workaround:

    1. Add “App plays audio” to “Required background mode” in info.plist

    2. Create another AVplayer that plays a one second mp3 file at 0.00000001f rate (silentMp3Player.rate=0.0000001f) which starts when your app enters background and stops when it re-enters foreground.

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

Sidebar

Related Questions

I need to play a background sound all the time as long as my
I need to play a sound when a button is clicked, I have this:
I have a need to play sound via the sound card of server PC
I need to play .vox files on my web page. Does anyone have any
I need to play an MP3 in the background while generating animation. The audio
I'm using nicEdit but it doesn't play well with our CMS. I need to
I'm trying to use the playSoundEffect () method to play a sound effect when
I have a sound effect that I want to only play when the slider
I have an app that I need to play a wav file when a
I'm currently working on a project in which i need to play a background

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.