我使用 MPMusicPlayerController
在我的应用程序中播放音乐,使用 iPodMusicPlayer
(也尝试过 applicationMusicPlayer)。当我使用 AVAudioPlayer
播放声音时,来自 MPMusicPlayerController
的音乐将停止。有没有办法让 MPMusicPlayerController
和 AVAudioPlayer
同时播放声音?
最佳答案
嘿,在网上找到了解决方案。
将这两行写在某个地方,我在 application:didFinishLaunchingWithOptions 中做到了
// Set sounds not to stop music
[[AVAudioSession sharedInstance] setCategory: AVAudioSessionCategoryAmbient error: nil];
[[AVAudioSession sharedInstance] setActive: YES error: nil];
必须承认我没有深入研究细节,但它确实有效...
祝你好运!
奥德。
关于iphone - AVAudioPlayer 与 MPMusicPlayerController,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3224269/