AVAudioPlayer with MPMusicPlayerController

前端 未结 2 499
不思量自难忘°
不思量自难忘° 2021-02-06 09:39

I have music playing within my application using a MPMusicPlayerController, using iPodMusicPlayer (also tried applicationMusicPlayer). When I play a so

2条回答
  •  日久生厌
    2021-02-06 10:21

    Hey, found the solution on the web.

    Write these 2 lines somewhere, I did it in application:didFinishLaunchingWithOptions

    // Set sounds not to stop music
    [[AVAudioSession sharedInstance] setCategory: AVAudioSessionCategoryAmbient error: nil];
    [[AVAudioSession sharedInstance] setActive: YES error: nil];
    

    Must admit I didn't delve into the details, but it works...

    Good luck!

    Oded.

提交回复
热议问题