gpt4 book ai didi

ios - iOS APP音乐设置

转载 作者:行者123 更新时间:2023-11-28 22:02:04 25 4
gpt4 key购买 nike

我有一个关于 iOS 系统和 iOS 应用程序的问题。

当我播放 iPhone 的音乐时,某些应用程序会在我打开它时停止音乐。

例如:Line Ranger。一些应用程序会让音乐

像 Facebook 一样连续播放。

如果我制作了一个应用程序,我该如何进行设置?

谢谢

最佳答案

你可以为你正在使用的 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;

关于ios - iOS APP音乐设置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24878641/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com