Hello,
I’m creating an application that take a picture using the Theta and then process it.
However I’m confused about the proper steps of changing the API to 2.1 then take picture.
The current process I’m working with is a button that do the following:
1\ start session
2\ change API level to 2.1
3\ take a picture
4\ show the image
However, with this, if the user didn’t like the taken image and wanted to take another image and pressed the button again. It would produced an error.
Ok, the problem is that I don’t know how many pictures the user will take. So I don’t know when to change the version. Is there is a way to detect if the user is still connected or disconnected ?
I’m using ionic framework. The application is running on a mobile device.
Thanks for the help @codetricity !
I did the following steps, not sure if it correct but it worked for me. I leave it in case someone needed it.
check connection through /osc/info
if it returns a response, I initialized a variable describing the state as StartSession.
it would check the state, if it StartSession, it would send a request camera.startSession to /osc/commands/execute
change the API version to 2.1
change the variable state as connected
take picture
acquire the last taken picture.
Now if I’d repeat the process, I’d check the variable state to see if it need a new session or skip that and take a picture.
However, i have noticed that the last taken image using the request camera.listFiles doesn’t return the current taken picture but the last stored picture before. Any help on this matter ?
Another technique is to wait 10 seconds (THETA S) or 5 seconds (THETA V) before you try to download the image to your local device.
I remember talking to another developer about setting up a simple delay between the take you run takePicture() and the time you grab the file from the camera with the URI.
Thanks for posting your updates. I’m getting inspired to take another look at using JavaScript to access the camera API.
I remember talking to another developer about setting up a simple delay between the take you run takePicture() and the time you grab the file from the camera with the URI.
So I did that, My theta model is (THETA SC). It seems the wait time to grab the latest image is 7 seconds.
Update:
It seems that the method I wrote in this post Here deson’t work when the app crashes or you close it and reopen it while the connection is still there and already there is an ongoing session.
the problem is that the variable state would be reinitialized and the state would turned to be StartSession. So I decided to do the following steps:
check connection
start session
change API version
take picture and list files
Now by repeating the process, the start session will throw an error. I placed an error handler that do step 4.
thanks for the update. Can you grab the last file taken now?
BTW, are you using this library to do the HTTP request or did you build your own?
I looked at several other HTTP get/post libraries, but the one above is the only one that appears to use Digest Authentication, which is needed for Client Mode testing.
I think I’m going to move forward with Electron and the request library above.
Note that when I tried to use Cordova/PhoneGap a year ago, I was not able to display the images in 360 navigation mode on Android/iOS. This problem may be fixed by now. However, if you need to display a 360 image on your mobile device with navigation, you may want to test this first before you get too far.
It’s possible to show the equirectangular image easily, so if that works for your application, it will be easier to implement.
It’s quite possible that Cordova/PhoneGap/Ionic has solved this problem
thanks for the update. Can you grab the last file taken now?
Yes! I have to wait 7 seconds between take picture and list files.
BTW, are you using this library to do the HTTP request or did you build your own?
the one above is the only one that appears to use Digest Authentication, which is needed for Client Mode testing
Thanks for mentioning the Client Mode, I didn’t know about it. I’m directly connecting the Theta using an native plugin in ionic. It is interesting to check out next, I’ll try the library you posted.
I was not able to display the images in 360 navigation mode on Android/iOS.
Note. I have not tried this with JavaScript yet. However, it does seem that the request library does support digest authentication, which is required for client mode.
My last attempt was in Sept 2017. At the time, I got this working in Cordova. Back in Sept 2017, I did not have the 360 navigation and buttons working at the same time. I’m assuming that when you show the 360 image or video, you want the user to be able to move to a different part of the image. If this is not a requirement, then your application will be much easier to finish.
Look at this video from July of 2017
I suspect, maybe just hope, that the problems with Cordova/A-Frame have been solved.
I remember talking to another developer about this problem. I think the API documentation may be slightly out of date.
Based on your comment and the comment from @strangerism , I’m assuming that takePicture() no longer returns the fileUri and that Ricoh needs to update their API documentation.
Thanks for the explanation, I actually use A-frame to view the 360 images from the Theta.
My last attempt was in Sept 2017. At the time, I got this working in Cordova. Back in Sept 2017, I did not have the 360 navigation and buttons working at the same time. I’m assuming that when you show the 360 image or video, you want the user to be able to move to a different part of the image.
I’m building an interactive image, I only use one button in ionic that enable the adding of elements in A-frame. those elements too are buttons that do something such as animation, etc. (sometimes those are difficult clicking on).
so, I don’t think that the buttons are still a problem now.
Based on your comment and the comment from @strangerism , I’m assuming that takePicture() no longer returns the fileUri and that Ricoh needs to update their API documentation.
Yes, that seems the case. The other commands are good. I just remember being confused at CheckForUpdates and I didn’t find the API helpful.
I think Ricoh made several changes to the Wi-Fi API (the one you’re using) recently. I need to build another project with it to learn about the changes.
I think checkForUpdates is fairly new. It’s not obvious how to use it from the documentation below.
Hi @Arwa , I am developing app in react native. I am confused about configuring local server 192.168.1.1 that responds to requests like 192.168.1.1/osc/info etc. I do not have ricoh theta device.What I need to do? Can you please help me. I want to take picture using my mobile camera (or theta api) and then show it in 360 view. Thanks