AVAssetReader and Audio Queue streaming problem

后端 未结 3 1939
北海茫月
北海茫月 2021-01-07 03:14

I have a problem with the AVAssetReader here to get samples from the iPod library and stream it via Audio Queue. I have not been able to find any such example so I try to im

3条回答
  •  清酒与你
    2021-01-07 03:35

    I was getting this same mystifying error. Sure enough, "setting up" an audio session made the error go away. This is how I set up my audio session.

    - (void)setupAudio {
        [[AVAudioSession sharedInstance] setDelegate:self];
        [[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryAmbient error:nil];
        NSError *activationError = nil;
        [[AVAudioSession sharedInstance] setActive: YES error:&activationError];
    
        NSLog(@"setupAudio ACTIVATION ERROR IS %@", activationError);
        [[AVAudioSession sharedInstance] setPreferredIOBufferDuration:0.1 error:&activationError];
        NSLog(@"setupAudio BUFFER DURATION ERROR IS %@", activationError);
    }
    

提交回复
热议问题