I have captured the video for 5 seconds and the video should be in an encrypted format in the local storage of an app. So that I am using RNEncryptor framework for encrypting the video. But sometimes when I click use video button app get a freeze. check my code below for encrypt.
func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [UIImagePickerController.InfoKey : Any]) {
DispatchQueue.main.async(execute: {
let encryptData = try? RNCryptor.encrypt(data: data!, withPassword: "ABC123")
do {
try encryptData?.write(to: url!, options:.withoutOverwriting)
self.encryptVideoData = encryptData as! NSData
UserDefaults.standard.set(self.encryptVideoData, forKey: "passportVidKey")
} catch { // handle error
print(error)
}
})
}