iOS video streaming and storing on device afterwards

前端 未结 5 852
情书的邮戳
情书的邮戳 2020-12-23 17:27

So far I know how to stream a video and how to download it and afterwards stream it, but here\'s the tricky bit: streaming it once, storing it on the device and in the futur

5条回答
  •  抹茶落季
    2020-12-23 17:55

    ASIHttpRequest might make your life easier.

    ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:url];
    [request setDownloadDestinationPath:@"video.m4v"]; // use [NSBundle mainBundle] to find a better place
    

    From your delegate, handle this:

    - (void)request:(ASIHTTPRequest *)request didReceiveData:(NSData *)data;
    

    Do whatever data transcoding with data as you get it and push it off to your AVAssetWriter or movie player layer in real time, whatever you are using. When you're done, the asset should still be saved so you can get it later.

提交回复
热议问题