Hey there, I need to know if there is a good way to wait until the image is saved to the destination.
I’m using the following
media.capturePhoto({listener=captured, destination = {baseDir = system.TemporaryDirectory, filename = "file.jpg", type = "image"}})
Then, in the captured function I am trying to send the image as an smtp attachment, but the image hasn’t saved yet before the code is called so I end up with a file-doesn’t-exist exception.
I tried placing code after media.capturePhoto as well, but it seems that this code is called almost immediately after and also doesn’t give the system time to save the image to disk.
How can I wait until the image is saved by the media.capturePhoto function?
Is there an event listener?
My options I can think of right now:
I just hack a workaround and wait 5 seconds?
I manually save the image by not including the destination table, allowing the captured function to receive the image as a display object, saving that display object to disk and finally passing that file to smtp.