DIY Android App for Yi Dash Car Camera
Why
A friend asked me to develop an Android app for his new Yi Dash Car Camera. The camera has impressive specifications at a very low price. He showed me the native Android app available on Google Play but needed a way to download and search video files by specific timestamps.
About the Camera
The camera operates on its own Wi-Fi network. To interact with it, you must be connected to this Wi-Fi. It automatically records videos, each approximately 3 minutes long, when powered on. Recording stops during downloads or settings changes. The official app also allows you to take a picture, which is essentially a screenshot from the video stream.
What I Did
Initially, I tried using an SDK from the camera's manufacturer, but it did not support this model. After contacting support, I learned that this camera lacks an official SDK. I then downloaded their app and examined the source code using an online decompiler, which was not obfuscated. Despite this, navigating the source code was time-consuming, and I was looking for a quicker solution. By connecting the phone to an Android IDE console and filtering the package messages, I discovered that all requests were logged into the console. With this information and the source code, I was able to accomplish what I needed.
How It Works
To access the camera, you must initiate an open stream request, which opens a session for subsequent requests. This session lasts approximately 10-15 seconds. Responses are in XML format.
For example, to download video files, you need to make three requests in sequence:
- Open Stream:
http://192.168.1.254/?custom=1&cmd=8001
- Change Mode to Media:
http://192.168.1.254/?custom=1&cmd=3001&par=2
- Request File List:
http://192.168.1.254/?custom=1&cmd=3015
To download videos, simply be connected to the camera's Wi-Fi; no additional steps are needed.
What I've Learned
While exploring video downloads, I was also curious about how to capture and download images from the camera. Surprisingly, there was no dedicated image capture feature—images are taken as snapshots from the video stream.
Result
I've created a GitHub project demonstrating how to download files from the camera. The process involves a few straightforward API calls. The project also highlights other settings accessible via the API. This resource could save someone hours of effort if they're working with this camera.
Comments
Post a Comment