Converting NSData back to Audio File

纵然是瞬间 提交于 2019-12-22 12:16:31

问题


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?


回答1:


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

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



来源:https://stackoverflow.com/questions/9157916/converting-nsdata-back-to-audio-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!