When saving recorded video that is too long, app crashes

前端 未结 2 1591
Happy的楠姐
Happy的楠姐 2021-01-05 12:02

The problem:

When saving a video that is recorded in my app, if the video size/duration is too big/long, my app crashes without a log/exception.

2条回答
  •  攒了一身酷
    2021-01-05 12:22

    why bother pulling the entire contents of the media stream from
    [[info objectForKey:UIImagePickerControllerMediaURL] path] into an NSData* and then writing them back out? your media stream is going to be huge!

    the reason this is happening at save is because you are recording the data, it is going to "disk", and then you read it into memory to write it back out to another disk file.

    have you considered using NSFileManager to copy the file from [[info objectForKey:UIImagePickerControlMediaURL] path] to the name you create (fullPath) ? this should avoid pulling the whole thing into memory; it should be a "file-to-file" transfer.

提交回复
热议问题