iOS background audio stops when screen is locked

≡放荡痞女 提交于 2019-11-30 20:35:24

This article explains the problem:

Technical Q&A QA1606 Audio Unit Processing Graph - Ensuring audio playback continues when screen is locked

Basically, you just need to make sure you set all AudioUnits to support 4096 slices:

// set the mixer unit to handle 4096 samples per slice since we want to keep rendering during screen lock
UInt32 maxFPS = 4096;
AudioUnitSetProperty(
    mMixer,
    kAudioUnitProperty_MaximumFramesPerSlice,
    kAudioUnitScope_Global,
    0,
    &maxFPS,
    sizeof(maxFPS));
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!