日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

语音保存 ,与下载,

發布時間:2025/5/22 编程问答 24 豆豆
生活随笔 收集整理的這篇文章主要介紹了 语音保存 ,与下载, 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

?1,先有文件名,然后給 這個路徑 寫入音頻數據,這就算保存到本地了,

??self.recordFilePath = [VoiceRecorderBaseVCgetPathByFileName:recordFileNameofType:@"wav"];

? ??self.recorder = [[[AVAudioRecorderalloc]initWithURL:[NSURLURLWithString:recordFilePath]

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? settings:[VoiceRecorderBaseVC getAudioRecorderSettingDict]

?? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? error:nil]autorelease];

2,targetPath,下載到指定路徑,

? ??AFDownloadRequestOperation *downloadOperation = [[AFDownloadRequestOperation alloc] initWithRequest:request targetPath:targetPath shouldResume:shouldResume];

3,生成一個?NSOperationQueue隊列,只有向其中 添加?AFDownloadRequestOperation,那么便會自動調用,

? ? ? ??[downloadQueue addOperation:downloadOperationOri];

? ? ? ? AFDownloadRequestOperation

4,這玩意 據說是 監聽下載進程的,比如下載了 10%,11% etc,

[downloadOperation setProgressiveDownloadProgressBlock:^(AFDownloadRequestOperation *operation, NSInteger bytesRead, long long totalBytesRead, long long totalBytesExpected, long long totalBytesReadForFile, long long totalBytesExpectedToReadForFile) {

? ? ? ? [selfdownloadOperation:operation progressTotalBytesReadForFile:totalBytesReadForFile totalBytesExpectedToReadForFile:totalBytesExpected];

? ? }];

上傳進程,

- (void)setUploadProgressBlock:(void (^)(NSUInteger bytesWritten, long long totalBytesWritten, long long totalBytesExpectedToWrite))block {

? ? self.uploadProgress = block;

}

下載進程,

?- (void)setDownloadProgressBlock:(void (^)(NSUInteger bytesRead, long long totalBytesRead, long long totalBytesExpectedToRead))block {

? ? self.downloadProgress = block;

}

5,AFNetWorking,

AFJSONRequestOperation,

NSMutableURLRequest,

NSOperationQueue,

6,nsrequest,nsconnection

7,nsoperation,nsoperationqueue,

8,socket,stream,

9,流程

支持協議:??? ??文件傳輸協議(ftp://) ??超文本傳輸協議(http://) ??安全128-bit超文本傳輸協議(https://) ??本地文件路徑(file:///) 訪問URL步驟: ??構造NSURL,,使用NSURL構造一個URL ??生成一個NSURLRequest,使用NSURLRequest構造一個請求 ??通過NSURLConnection發送請求,使用NSURLConnection發送一個請求,并返回數
??通過返回的NSURLResponse和NSError分析結果 ,使用NSURLResponse和NSError來監測響應和錯誤信息 10,

-(void)network

{

? ? NSURLConnection *connection;

? ? connection = [connection initWithRequest:[NSURLRequestrequestWithURL:[NSURLURLWithString:@"http://baidu.com"]] delegate:self];

? ? [connection start];

}

- (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error

{? ??

}

11,pragma

/* The file type to record is inferred from the file extension. Will overwrite a file at the specified url if a file exists */

- (id)initWithURL:(NSURL *)url settings:(NSDictionary *)settings error:(NSError **)outError;

轉載于:https://www.cnblogs.com/guligei/p/3526570.html

總結

以上是生活随笔為你收集整理的语音保存 ,与下载,的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。