iPod mini controls disabled when certain audio session parameters are set

后端 未结 3 2118
无人共我
无人共我 2021-02-18 20:47

I\'m working on a music visualizer for the iPhone/iPad, under iOS 3 you could double-tap the home button and get iPod controls. With the latest version 4.1-4.2, these controls a

3条回答
  •  傲寒
    傲寒 (楼主)
    2021-02-18 21:13

    Here's where I've got to so far:

    AudioSessionInitialize(NULL, NULL, NULL, self);
    UInt32  sessionCategory = kAudioSessionCategory_AmbientSound;
    AudioSessionSetProperty(kAudioSessionProperty_AudioCategory, sizeof(sessionCategory), &sessionCategory);
    
    devicetwo = alcOpenDevice(NULL);
    contexttwo = alcCreateContext(devicetwo, 0);
    
        //The following two lines are the lines that gray out iPod controls:
    
    alcMakeContextCurrent(contexttwo); 
    AudioSessionSetActive(YES);
    

    The iPod controls remain grayed out even once the app quits... And removing the two culprit lines of code result in no sound being produced in the app.

提交回复
热议问题