Ridney Ridney - 3 years ago 72
Swift Question

Record video with custom camera UI but prevent save

I'm using AVCaptureFileOutputRecordingDelegate - didFinishRecordingToOutputFileAt inside my custom camera UI, but I don't want to pass for this method because the video is been saved when it finish recording.
For legacy reasons I can't save the video locally, then to take it in a static instance and delete it from local.
How can I do that ?

Answer Source

AVFoundation framework has only the following output for a capture session.

  • AVCaptureMovieFileOutput - to record and output a movie file
  • AVCaptureVideoDataOutput - process frames from video being captures
  • AVCaptureAudioDataOuput - process audio data being captures
  • AVCaptureStillImageOutput - to capture still image output

Since you don't want to save the recorded video to a file. The other best option would be using AVCaptureVideoDataOutput and get each frame on a continuous recording video and create a video from image buffer. To make a note you will not have audio output in this case. Again we can add AVCaptureAudioDataOuput and embed the audio separately on our recorded video. But this workaround will not work for higher frame rates. So best suggestion to save the video into temp folder and delete it later.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download