Continue to play music with screen locked?

Discussion in 'iOS Programming' started by fishkorp, Feb 8, 2009.

  1. fishkorp macrumors 68020

    fishkorp

    Joined:
    Apr 10, 2006
    Location:
    Ellicott City, MD
    #1
    I've been trying for 2 days now and I'm probably missing something simple, but I can't get my app to keep playing music when the screen is locked (like AOL Radio, Pandora, etc). I tried various things in the Delegate's applicationWillResignActive and I tried using a sharedInstance of my music player, but nothing seems to work. Is there some bit of magic somewhere to get audio to continue with a locked screen?
     
  2. dejo Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #2
    What class/method or framework are you using to start the music playing?
     
  3. fishkorp thread starter macrumors 68020

    fishkorp

    Joined:
    Apr 10, 2006
    Location:
    Ellicott City, MD
    #3
    AudioToolbox, I'm streaming audio from a web location. As soon as the screen is locked it stops playing, but if I click the home button it will start playing again until the screen blacks out. So it keeps queuing the audio I think, but it's not audible. I'm not sure if I should look in my audio stuff or if I need to do something to preserve network status on lock maybe?
     
  4. fishkorp thread starter macrumors 68020

    fishkorp

    Joined:
    Apr 10, 2006
    Location:
    Ellicott City, MD
    #4
    Fixed it. Using a CFReadStream instead of NSURLConnection did the trick.
     

Share This Page