How to Load NSData from AudioBufferList into AVAudioPlayer

I am able to get AudioBufferList from the remote audio stream.
Now i want to save this audio stream in my local file which i can play later.

I have tried this code


NSMutableData *data= [NSMutableData data];


Float32 *frame = (Float32*)audio_buffer->mData;

[data appendBytes:frame length:audio_buffer->mDataByteSize];


self.audioPlayer = [[AVAudioPlayer alloc] initWithdata : data error: &error];


But it is not working for me.

Post not yet marked as solved Up vote post of vidhi123 Down vote post of vidhi123
662 views