0

我有一个具有音频和视频文件下载功能的 ios 应用程序问题是我应该在哪里下载这些文件以及如何下载?

4

1 回答 1

0

you can use <AudioToolbox/AudioToolbox.h>

create file like this

NSString *filePath = NSTemporaryDirectory();

filePath = [filePath stringByAppendingPathComponent:@"fileName.mp3"];

NSURL *fileURL = [NSURL fileURLWithPath:filePath];

write your audiostream description like this

AudioStreamBasicDescription des;
des.mSampleRate = 44000;
des.mBitsPerChannel = 16;
des.mChannelsPerFrame = 1;
des.mFramesPerPacket = 1;
des.mBytesPerFrame = 2;
des.mBytesPerPacket = 2;

create audio file like this

AudioFileID audioFile;
audioErr = AudioFileCreateWithURL((CFURLRef)fileURL, 
                                 kAudioFileWAVEType,   
                                  &des,
                                  kAudioFileFlags_EraseFile,
                                  &audioFile);

use AudioFileWriteBytes(audioFile)method to write it

于 2013-02-24T10:17:46.223 回答