Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting the AVURLAsset of a local audio file

i'm currently writing an iOS app that works with audio files, and one part of the app is to create the waveform of an audio file. Therefore i need an AVURLAsset object so that the AVAssetReader can get the data of the audio file.

No problem there with songs from the iPod library on the iPhone/iPad, but when i try to get the AVURLAsset object for an audio file in the documents folder of the app, something goes wrong.

I have the NSURL of the local song, and playback with AVAudioPlayer works, but when trying to read the AVURLAsset with AVAssetReader, the App crashes.

Does anyone know why this error occurs?

Thanks!

chris

like image 855
chritaso Avatar asked Nov 21 '12 13:11

chritaso


Video Answer


1 Answers

Got it, after a little bit of reserach. It's very important to use fileURLWithPath instead of URLWithString.

like image 99
chritaso Avatar answered Oct 17 '22 01:10

chritaso