简体   繁体   中英

Play audio files from sqlite database Objective-C

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM