2

I'm storing about 40 000 audio files, 5K-7K each, in an sqlite database. I fetch the blob as an NSData object. What's the best way to play the audio file? I've been using ObjectAL to play audio files from disk, but I can't get it to play files from memory.

Opptatt Jobber
  • 319
  • 5
  • 13

1 Answers1

1

You can use the AVAudioPlayer class.
It has an initWithData: method:

- ( id )initWithData: ( NSData * )data error: ( NSError ** )outError;

Since you already have NSData objects, it should be pretty straightforward.

Alternatively, you may also create a temporary file with the data.

Community
  • 1
  • 1
Macmade
  • 52,708
  • 13
  • 106
  • 123