Hello,
Our mobile application runs on standard Android, not a custom ROM. When we use JavaScript libraries to handle panoramic views, we encounter issues when trying to use Native DOM functions such as displaying an image or video returned from the Theta API.
For example, if we make a request to the Theta API to retrieve a picture or video and receive a URL like http://192.168.1.1/path/to/image.jpg, we then use it in the DOM as follows:
<img src="http://192.168.1.1/path/to/image.jpg">
or <video src="http://192.168.1.1/path/to/video.mp4">
.
This approach creates CORS issues, as the Theta API does not include proper Access-Control-Allow-Origin headers in its responses.
On the Android side, we tried to address this issue by using an interceptor to manually append headers to fetch requests. However, this workaround only works for programmatic requests (like JavaScript fetch) and not for Native DOM elements (e.g., <img>
or <video>
tags). As a result, we are unable to display resources like images or videos properly while maintaining the security and purpose of CORS.
Here is more information about CORS headers:
(Access-Control-Allow-Origin - HTTP | MDN)
If it were possible to configure or customize the CORS-related headers returned by the Theta API, it would help us resolve this issue effectively.
Example Steps:
Connect the Android device and the Theta camera to Wi-Fi in AP mode. The camera’s IP is 192.168.1.1.
The mobile app makes a request to the Theta API, for example, to retrieve an image or video:
Endpoint: http://192.168.1.1/osc/commands/execute
Payload: { “name”: “camera.getImage”, “parameters”: { “fileUrl”: “path/to/file.jpg” } }
The API returns a URL in the response, e.g., http://192.168.1.1/path/to/image.jpg.
This URL is used in the Native DOM, e.g.,:
<img src="http://192.168.1.1/path/to/image.jpg" />
CORS restrictions block the request when trying to load the image or video due to missing headers like Access-Control-Allow-Origin.
Attempts to fix this by intercepting fetch requests and appending headers only address JavaScript fetch requests but do not resolve the issue for resources handled directly in the DOM (like <img>
or <video>
).
Request:
If the Theta API could provide a way to configure or include appropriate CORS headers in its responses, such as Access-Control-Allow-Origin: * or allowing specific origins, this issue could be resolved.