Rohit
Rohit

Reputation: 23

Converting NSData back to Audio File

i have converted my .caf audio file to NSData object using the following line of code:

NSData *audioData = [NSData dataWithContentsOfFile:[MyRecorderFilePathURL path] options: 0 error:&err];

I am doing so to upload the binary object to a server through a web service. How do i convert audioData back to a .caf file which can be played using AVAudioPlayer?

Upvotes: 2

Views: 6068

Answers (1)

Ali3n
Ali3n

Reputation: 1244

AVAudioPlayer has a method for playing sound from NSData object . You can use

- (id)initWithData:(NSData *)data error:(NSError **)outError method of AVAudioPlayer

Upvotes: 6

Related Questions