Unable to Run Callback after Execution of Video stopCapture from Plugin-in Using WebAPI

Hi @craig we were able to insert the exif data by creating a custom api that takes a photo as well as inserts metadata into the image once it is ready. However, we are struggling to do the same with video files. We did try the same concept we used for taking photos, but in this case we are not getting a callback from the theta stop capture api. If we receive the callback from the stop capture api, we can acknowledge that the recording has stopped and the video file is ready to be updated. Any suggestions?
What we are trying to do is create a custom api that accepts a string parameter and it in turn calls the theta stop capture api. The stop capture api by default should return the detials or at least the name of the file once it is ready, but we are not getting that when calling the ricoh api from our custom api. Please help.

@craig please help :smiling_face_with_tear:
need to insert exif data to a video, but not able to do so. Need a way to map the metadata from the server to the correct video

Please advise on the process (algorithm) you are using to save the metadata.

Example:

  1. using plugin with WebAPI send stopCapture
  2. using plugin with WebAPI check status with commands/status
  3. if status is not done and shows inProgress, then delay 300ms and repeat commands/status. If process is done, then move to next step
  4. stopCapture will now show the file url of the last video taken
  5. using the URL, your application then downloads the video file into application and inserts the desired exif data into the video file.

Please advise if you are using the Camera API or the WebAPI from inside the plugin.

Please advise at what stage you are stuck. For example, can you get the URL of the video file?


Note that unlike the algorithm for the image, the video has a significant delay after stopCapture. In your application, checks for the fileUrl after stopCapture, it will not be there. You must wait until the process is done.

See this example:

@craig thank you for getting back to help. Here is a rough outline of the steps we are doing,

  1. Call the plugin’s web api to stop recording
  2. From the plugin, call the camera’s camera api to stop recording
    3[A]) Expect a response from the camera api and once we get a response, locate the file and update the exif data

OR

3[B]) Instead of waiting for a response from the camera api, add a wait of 15 seconds and then try to update the exif data

However, we already tried using commands/status as well as adding a 15/20 seconds wait in between after calling the stop capture api and before trying to update the exif data, but to no avail. We tried different delays from 300 ms up to 15 sec to wait for the camera to fully stop recording, but the output is the same. Once we call the camera api to stop capture, the further code from the plugin does not get executed, it exits.

We also tried using a status checker to see if the status has changed, but that does not seem to work either

In step 3, are you waiting for a response from the plugin’s Android Camera API or the plugin’s Web API?

Do you switch between the WebAPI and the Camera API?

If you switch from the WebAPI to the Camera API, you must release the resources.

theta-api-specs/ricoh-theta-plugin/broadcast-intent.md at main · ricohapi/theta-api-specs · GitHub


NOTE: I moved the discussion to a new topic in order to make it easier to point your question to other people to ask for help.

“If you switch from the WebAPI to the Camera API, you must release the resources.”
I think this is confusing their is two camera api’s the internal camera api “the one that sends the commands to the hardware from within the camera itself” and the “Normal” camera api the one that get the command from external device like phone. in this case if you are referring to the switching between webapi and “Normal” api then no, we are not switching.
also, if we do release the resources, not sure how our plugin api will receive the response as the plugin api is supposed to receive the filename and then it will add the exif data in that video

Have you used this as a reference?

Can you modify the sample to get the video file location and then open an issue on GitHub on the sample repo above?

I reviewed. your problem with someone at RICOH. If you put the problem on GitHub, either as a discussion or issue, it may be easier to communicate with the developers maintaining the example.

Are you using this API to take the video?

Camera API  |  Android media  |  Android Developers

Are you stopping the video with this?

MediaRecorder  |  Android Developers

But if we use the camera api, how do we pass the parameter from the phone app to the camera? We will need web api from the plugin to add a custom parameter in it which accepts a string and then the plugin calls the camera api to start and stop recording and then update the exif data with the string received with the web api as a parameter.
I will post this question there as well.

I’m trying to understand which API you are using to start and stop the video. When you write the question on GitHub, please include a link to the API you are using to stop video recording.

As. you mentioned, the plugin API can be confusing because both the RICOH THETA WebAPI and the Android Camera API (Android Camera) can be used.

I may have a misunderstanding of the API you are using in your algorithm.

So the app calls the plugin’s api which is a custom api,

192.168.1.1:8888/video_start

This triggers the plugin to call the camera api to start recording. The api called by the plugin is,

192.168.1.1/osc/commands/execute

"name", "camera.startCapture"

I added this last post as a comment on the GitHub issue you created.

I add this to a community report we send to RICOH.

2 Likes

@craig I do not mean to be pushy, but it has been 2 weeks since the issue was raised on the github repo :sweat_smile:
Any update on it?

@sumeetgm89 , I don’t have a response from RICOH.

@jcasman can you send an email to your contact at RICOH to check up on this?

Yes, doing this right now

1 Like

@jcasman can you help with the followup for sumeet.

We could theoretically try to push forward by encouraging RICOH or one of our interns to use Android or Kotlin to test a plugin with this:

192.168.1.1/osc/commands/execute

"name", "camera.startCapture"

Is the engineering team in Tokyo on vacation?

I don’t know exactly, but my belief is that RICOH HQ - which includes RICOH engineering - is on holiday this week.

@jcasman our only other option is to assign this to an intern. The person needs physical access to a RICOH THETA X and may need multiple days (part-time) to try it.

Note that running flutter inside of the THETA X does not work for some reason. We’ll need to use Kotlin.

Just so we are on the same page, though this sample needs to be run on the X, we also want to do it on the Z1.
Not sure why, but i am unable to find the repository that we used as a template to create our webserver. It was named webguisample, but i am not able to find it on github anymore.
That one worked on the Z1.

@sumeetgm89 can you provide a log of the HTTP request and HTTP response that you are getting from the plug-in when you run

camera.stopCapture from inside of the plugin.

When you run this:

192.168.1.1/osc/commands/execute

"name", "camera.stopCapture"

what is the output?

Do you get a list of file URLs for the video file? Do you get a blank array?

How long are you waiting after stopCapture?

@sumeetgm89 there is a new response on GitHub.

I read the post too, and we need to say that Theta X plugin does not support WebAPI to start/stop video recording. I am sorry that this spec difference between Theta Z1 and X is came from the difference of plugin architecture.

If you want to do video recording in plugin, using the Camera API is strongly recommended. This repository is showing how to use Camera API to execute take picture and start/stop video recording.

Do you know how to get the file path when you stop the video recording using the Camera API?