我对iOS系统和iOS应用有疑问。
当我播放iPhone的音乐时,某些应用会在我打开它时停止播放音乐。
例如:Line Ranger。 有些应用会让音乐
像Facebook一样持续播放。如果我制作了应用,如何设置设置?
由于
答案 0 :(得分:2)
您可以设置您想要使用AVAudioSession的类别。
/* set session category */
- (BOOL)setCategory:(NSString *)category error:(NSError **)outError;
可用类别包括:
#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;