Theta V 404 response sometimes

I’m connecting to a Theta V in unity and streaming out the preview image. Sometimes it connects, sometimes it doesn’t.

The first thing I do is send a POST to /osc/commands/execute with {“name”:“camera.setOptions”,“parameters”:{ “options”:{ “captureMode”:“image”} } }

When it works I get a HTTP/1.1 200 OK response and {“name”:“camera.setOptions”,“state”:“done”}

But when it doesn’t work I get a 404 not found error. I checked the request in wireshark and the good request and bad request seem to be the same byte for byte.

HTTP/1.1 404 Not Found

Content-Type: text/html

Cache-Control: public

Pragma: cache

Expires: Fri, 30 Jul 2021 15:20:40 GMT

Date: Fri, 30 Jul 2021 14:50:40 GMT

Last-Modified: Fri, 30 Jul 2021 14:50:40 GMT

Accept-Ranges: bytes

Connection: close

404 Not Found

404 Not Found

Am I missing something?

Thank you

In the HTTP POST header you are sending, are you sending to start the stream, ContentType = "application/json;charset=utf-8"

The guy here has a GitHub repo. It may help.

This is old, but maybe still works.

string url = "Enter HTTP path of THETA here";
var request = HttpWebRequest.Create (url);
HttpWebResponse response = null;
request.Method = "POST";
request.Timeout = (int) (30 * 10000f); // to ensure  no timeout
request.ContentType = "application/json; charset = utf-8";

byte [] postBytes = Encoding.Default.GetBytes ( "Put the JSON data here");
request.ContentLength = postBytes.Length;

This example works with V (I have not tested)

Another example with the V. See the updated zip file

THETA S WiFi Streaming with Unity - #20 by ZHU


BTW, if you have a moment, can you share your use case? I’m always curious as to the use of the 360 video streaming.

Thank you for the links. Yes I am setting that, here is an excerpt from a wireshark capture. In this case for whatever reason the camera replied to me 100 Continue but then did not start the stream. Other times I get 404, and sometimes it just works :slight_smile:

POST /osc/commands/execute HTTP/1.1

Content-Type: application/json;charset=utf-8

Content-Length: 32

Expect: 100-continue

Connection: keep-alive

Host: 192.168.1.1

{"name":"camera.getLivePreview"}

HTTP/1.1 100 Continue

Does your application issue another command prior to camera.getLivePreview? For example, do you set the mode to image? Try set a delay between the previous command and the camera.getLivePreview command. Ideally, use state or status to check that the camera is ready. If the behavior is inconsistent, it might be related to the camera load at the specific time the command is sent.

here’s what I would do to trace the problem:

  • upgrade to the latest firmware
  • place camera right next to the computer you are connecting to order to eliminate Wi-Fi signal strength problems
  • verify that liveStreaming works consistently with the official mobile app and use Wireshark capture on that app to see what the HTTP headers look like for the command. Maybe there is a difference?
  • test stream with Amelia Viewer
  • change the Wi-Fi frequency from 5GHz to 2.4GHz as a test
  • eliminate chance of strong wifi channel interference
  • try it with a different Wi-Fi adapter or computer

Successful Theta V stream from drone to VR headset 0.25 miles away

  • test the other apps posted on the forum