I’m working on a plugin that takes images and offers them on an endpoint to another service.
The service only cares for the latest image so I want to delete the previous image as soon as the new one is taken (just so I don’t run out of space on the camera).
I’ve tried using the project on github.com/ricohapi/theta-plugin-sdk as a base. There, on the callback triggered after taking a photo, I do the following:
HttpConnector camera = new HttpConnector("127.0.0.1:8080");
camera.deleteFile(fileUrl, new HttpEventListener() { ... });
However, the onError function keeps getting called and the file remains. Is there anything I’m doing wrong?
You may need to check the camera status to make sure the camera is finished taking the picture and saving it to storage. If the camera is not finished, you will get an error. You can test this by putting a 4 second delay between the time the picture was taken and when you delete it. In actual use, you will need to check the camera status. As you are trying to take pictures at less than 1000ms, you likely need to delete all the files at set intervals instead of after every picture as it will take time to delete the file.
There are a large number of code examples at the link below.
I haven’t developed a plug-in in a while and my knowledge is out of date. When I used theta4j, I built two minimal examples. I’m not sure if they still work.
Note that there is another example use of pushing the MotionJPEG from the plug-in to an Arduino. This is likely not a relevant, but cool.
BTW, if this is a commercial project with potential sales potential for RICOH, please send a note to @jcasman as we can try and get more help from RICOH. This forum receives sponsorship from RICOH and we like to report back on activities. You can either send a direct message through the forum or send an email.
No problem if this is a research or hobby project. We can continue to support your project in this community forum.