AVAudioPlayer with MPMusicPlayerController

前端 未结 2 498
不思量自难忘°
不思量自难忘° 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:06

    Oded Ben Dov's solution does the job, but you might not want to change your session category. For example, if you want your audio to keep playing while the screen is locked, you need the Playback category.

    In that case, you can apply this category override instead:

    UInt32 mixWithOthers = YES;
    AudioSessionSetProperty(kAudioSessionProperty_OverrideCategoryMixWithOthers, sizeof(mixWithOthers), &mixWithOthers);
    

提交回复
热议问题