zoukankan      html  css  js  c++  java
  • 语音保存 ,与下载,

     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;

  • 相关阅读:
    如何在Windows Forms应用程序中实现可组装式(Composite)的架构以及松耦合事件机制
    SQL Server 2008中的CDC(Change Data Capture)功能使用及释疑
    【VSTO】Office开发中遇到的兼容性检查问题
    SQL Server 2008 R2的StreamInsight 【文章转载】
    WCF技术的不同应用场景及其实现分析
    如何利用Interception简化MVVM中的Model和ViewModel的设计
    有关在SharePoint Server中Infopath表单无法呈现的问题及解决方案
    再谈谈ADO.NET Data Service 数据格式(xml和json)
    自定义Domain Service时遇到实体不能更新的问题及其解决方案
    如何在RIA Service中启用身份验证
  • 原文地址:https://www.cnblogs.com/guligei/p/3526570.html
Copyright © 2011-2022 走看看