0

I have a question about iOS system and iOS app.

When I playing iPhone’s music, some app will stop the music when I open it.

For example: Line Ranger. Some app will let the music

playing continuously, like Facebook.

If I made an app, how do I set the settings?

Thanks

Popeye
  • 11,839
  • 9
  • 58
  • 91
Atimis
  • 66
  • 1
  • 11
  • possible duplicate of [iOS how to don't stop music when the app start launching](http://stackoverflow.com/questions/18762544/ios-how-to-dont-stop-music-when-the-app-start-launching) – Black Frog Jul 22 '14 at 12:23
  • Thanks for the help Now I am studying the relative code. – Atimis Jul 22 '14 at 13:28

1 Answers1

2

You can set the category you want to AVAudioSession you are using.

/* set session category */  
- (BOOL)setCategory:(NSString *)category error:(NSError **)outError;

Available categories are:

#pragma mark -- Values for the category property --  

/*  Use this category for background sounds such as rain, car engine noise, etc. Mixes with other music. */  
AVF_EXPORT NSString *const AVAudioSessionCategoryAmbient;  

/*  Use this category for background sounds.  Other music will stop playing. */  
AVF_EXPORT NSString *const AVAudioSessionCategorySoloAmbient;  

/* Use this category for music tracks.*/  
AVF_EXPORT NSString *const AVAudioSessionCategoryPlayback;  

/*  Use this category when recording audio. */  
AVF_EXPORT NSString *const AVAudioSessionCategoryRecord;  

/*  Use this category when recording and playing back audio. */  
AVF_EXPORT NSString *const AVAudioSessionCategoryPlayAndRecord;  

/*  Use this category when using a hardware codec or signal processor while not playing or recording audio. */  
AVF_EXPORT NSString *const AVAudioSessionCategoryAudioProcessing;  
Popeye
  • 11,839
  • 9
  • 58
  • 91
Simon
  • 237
  • 1
  • 7