Open ramdhasm opened 3 years ago
Agent comment from Luce Luo in Zendesk ticket #48323:
Dear Customer,
Thank you for contacting DJI. It should be the DOWNLOAD mode first, please check it setMode:withCompletion.
Thanks,
Luce Luo
DJI Developer Support
°°°
Hello. I'm having the same problem. But I'm using Mini 2 and apparently setMode is not supported.. I tried to add camera.enterPlayback(), but no success.
func camera(_ camera: DJICamera, didGenerateNewMediaFile newMedia: DJIMediaFile) {
camera.enterPlayback()
newMedia.fetchData(withOffset: 0, update: DispatchQueue.main, update: { [self](_ data: Data?, _ isComplete: Bool, _ error: Error?) -> Void in
if error != nil {
testlabel.text = "\(error!.localizedDescription)"
print("State:")
print("Error downloading photo: \(error!)")
}
else {
// unwrap downloaded data and create image
guard let data = data else {return}
let downloadedImage = UIImage(data: data)
pictureview.image = downloadedImage
}
guard isComplete else {return}
camera.exitPlayback()
})
When i try to get the last captured image, i'm getting this error: Camera is busy or the command is not supported in the camera's current state(code:-3002). Always newMedia.fetchData callback throws this error.