yitechnology / yiopenapi Goto Github PK
View Code? Open in Web Editor NEWYI Open API provides mobile SDKs and reference designs for software developers and hardware makers to build cool apps and products with YI 4K Action Cameras
License: Other
YI Open API provides mobile SDKs and reference designs for software developers and hardware makers to build cool apps and products with YI 4K Action Cameras
License: Other
If you want to attract developers that give you high-quality input and feedback, you should make this github repo – rather than a facebook page – the central gathering point for all parties interested. After all, github is the social network for developers and facebook has a real bad reputation among them, frankly for perfectly good reasons. So, instead of linking from here to there, do it the other way round (which you might have done, I couldn't be bothered to check) 😄
How about adding a method to make it possible to set the filename of the recording, e.g.,
ActionCamera.startRecording(filename, ...)?
For example when recording using multiple cameras it would be nice to have filenames like:
sequence1_cam0, sequence1_cam1, sequence1_cam2, et.c.
There appears to be a maximum filesize of 4 GB and then the recording is split. If supplying a filename for the recording, also the splits must be handled e.g., by adding the split number.
Hi
I tried to updated the firmware for my six cameras to on 360 video. The cameras didn't gave any message, insted it gave the video screen, but is black, and there's a red fix light on the top. When i tried to hit the button to record, they don't do anything. In the camera modes they allow me just photo and video. My question is: Is this normal? Or there was an error with the update? The batteries where fully charged.
Does this api work with the security cameras such as:
?
Thanks!
Could you please add a method to reboot the camera?
Please add an API method to set the exposure time in a video recording in micro- or nanoseconds (not an enum).
According to the documentation (https://github.com/YITechnology/YIOpenAPI/blob/master/vr/doc/Build%20hardware%20synchronized%20360%20VR%20camera%20with%20YI%204K%20action%20cameras.pdf),
"2.5k" is the only supported video mode.
Please consider adding support for more modes when recording synchronized video:
If not there already, make it possible to programmatically set the recording mode.
I have a old version Camera that has no LCD screen with up to 1080p capable.
I wonder this cam also support YiOpenAPI.
Plus, where can I buy Multi-endpoint Micro USB Cable?
Hello,
I noticed you are using an Android app as an example but I'm working on a java app on desktop.
Does you API support video streaming at low resolution like your YI Action app does? If not, will it in the near future?
Thank you, have a great day!
I have been trying to render preview of the yi action camera, but it always returns null pointer of RtspURL.
It seems that SDK prevents rendering of preview.
There is already published app in the store to control the camera.
Looking forward to hearing from someone.
when i used firmware and configed the file "sta.conf", i could not connect my wifi route ,i checked my configration again and again,but i could not find any error .I used notepad for windows to config it ,was that right?
Can I somehow reset the camera's image counter, so that it can start to name the captured image to /100MEDIA/YDXJ0001.JPG
again?
I tried to reset the camera setting but it did not seems to be worked.
Thanks in advance.
I have a project that makes use of multiple Yi 4K cameras connected to a PC for syncing. However, Windows only allows a single camera to enter U-Disk mode at a time, regardless of being connected to two different USB bus ports. However, this is not the case on Mac OSX, which can connect multiple Yi 4K cameras in U-Disk mode at once. Is there a way to force Windows to allow multiple Yi 4K devices to enter U-Disk mode at once? Thank you!
need python sdk,is that possible?
Hi,
My firmware version: Z16V13L_1.1.0_en-us_build-20160802190839_git-5222f2b7_r2139
When requesting the possible values for "photo_stamp" then the following is returned from the camera:
{"msg_id":9,"options":["off","time","date","date/time"],"param":"precise_cont_time","permission":"settable","rval":0}
I would expect this:
{"msg_id":9,"options":["off","time","date","date/time"],"param":"photo_stamp","permission":"settable","rval":0}
All other settings seem to work fine.
Can you update the Swift SDK to Swift 3.1?
I ran the program in accordance with the document, but without success.
When trying to build Yi360Demo for iOS it gives the following errors:
'ActionCameraListener' is unavailable: cannot find Swift declaration for this class
'Error' is unavailable: cannot find Swift declaration for this class
'Super' is unavailable: cannot find Swift declaration for this class
Method does not override any method from its superclass Camera.swift (regarding override func onConnected)
Tried with Xcode:
8.1
8.0
7.3.1
iOS - 9.3.4
Thanks
I want to use 2.7K 4:3 and 4k Ultra video resolution modes, but I can't find this mode in API. I found v_3840x2160_30p_16x9_super and v_2560x1920_30p_4x3 modes, but it doesn't work on my cameras.
Hi! :)
So I have a YI 4k Action Camera. Using YI open API, I'm trying to make Android apps that control the camera, capture a photo, and download the captured photo to an external storage on my device.
All were working well, until I try to download the image captured using ActionCamera.downloadFile("YDXJXXXX.JPG")
. Here's the detail:
DownloadTask.downloadBytes == DownloadTask.totalBytes
Did I make a mistakes here? Please let me know.
Thanks in advance.
P.S. These are the codes to call the downloadFile()
function, though I'm not sure if this will helps:
public void downloadAFile(String fileName){
String filePath = Constant.externalStoragePath;
filePath = filePath + fileName;
this.downloadFile(fileName, filePath, new ActionCameraCommandCallback1<DownloadTask>() {
@Override
public void onInvoke(DownloadTask downloadTask) {
onCameraSucceedDownloadFile(downloadTask);
}
}, new ActionCameraCommandCallback1<YICameraSDKError>() {
@Override
public void onInvoke(YICameraSDKError yiCameraSDKError) {
onCameraFailedDownloadFile(yiCameraSDKError);
}
});
}
public void onCameraSucceedDownloadFile(DownloadTask downloadTask){
Log.i(TAG, " (downloadTask.downloadedBytes/(float)downloadTask.totalBytes*100) +"% downloading image to " + downloadTask.destFilePath);
// and tell me when download finished
if(downloadTask.downloadedBytes == downloadTask.totalBytes){
Log.i(TAG, "download finished " + downloadTask.destFilePath + "at " + (downloadTask.downloadedBytes/(float)downloadTask.totalBytes * 100 + "%");
}
}
Hello - I am interested to develop an Android app that will capture the live stream of your dash cam. Would this SDK enables this scenario ? Is this doable via Wifi Direct ? Via other connectivity?
Thanks in advance - Philippe
I use Wifi for VR and would like to get a better sync. Reasons I still use wifi to trigger multiple cameras,
The big downfall of course is lack of proper syncronisation over Wifi. The way you've implemented the API tho - it would be so easy to make it better. Because you set the time to trigger start/stop etc, if the cameras clocks are perfectly syncronised, the triggering should also be perfectly syncronised.
If there was a way (probably over a cable) of syncronising the clocks then this would be perfect. Ideally it would be something like
then when you fire a start command via the app and give it a time to start recording, all cameras should start recording at the same time.
Hi,
I have a quick question regarding the config file used to connect to a WiFi hotspot.
There is a setting for DEVICE_NAME. What is this used for? I would like to be able to read this setting via the SDK, is this possible? I've gone through the SDK a few times and haven't seen anything.
##### Wifi configuration file ##########################################
# SSID
SSID=PM2.5-5G
# Password
PASSWORD=1234567890
# Device Name
DEVICE_NAME=xiaoyi-1
# Country Code
COUNTRY_CODE=US
Hi,
I've tried to stream Live from 4k into Unreal Media Server and it fails at connection to server - "Network connections fails, retrying...".
What i've got working till the moment:
So it's not network, wifi, firewall and server issue i guess.
The URL passed to QR code is "rtmp://192.168.0.105:5130/live/yi" which is tested with XSplit RTMP caster. Is the URL format correct?
I currently have 2 Yi 4K camera, one new and one old.
The old one worked with my wifi router when using 3.0 firmware. However, latest (5.0) firmware failed to fine my wifi, and it then renamed the wifi config (sta.conf) so it won't be loaded anymore.
My new Yi 4K worked fine with latest firmware (5.0). The only difference I can determined between the 2 are that the old one had the 3.0 firmware before. Is there any non-volatile memory stored in the camera that I need to reset to allowed for the old Yi 4K camera to work with the newest firmware? I tried to reset the camera back to factory settings, but it did not help.
Hi. I'm interested in useing this camera for a project of mine where we need to capture single shots (with EIS as it's in a moving environment) with multiple cameras with 1 Hz until we ask the cameras to stop (after multiple hours).
Is this possible with the YI 4k? The "video time lapse" function looks like it's automatically processing the captured shots - but we need the single shots (1HZ). The simultaneous start of multiple cameras should not be a problem as far as I understood.
Hi, I'm want to create VR rig with remote control and preview. I developed an android application that controls a rig via WIFI, but WIFI doesn't work in VR firmware.
Can you add WIFI connection into VR firmware? And if it possible, can you add it into both (firmware_first and firmware_others) with supporting the sta.conf files and an RTSP streaming in these firmwares for full preview from a rig
When will the functionality to enable/disable lens distortion correction be available?
I couldn't find that in the documentation for version 0.3 and I couldn't find any documentation or release notes for version 0.4 or 0.5.
Thanks.
Further to my issue with synchronisation and Wifi, I note that Bluetooth works with the VR firmware.
I can connect my device to the camera via bluetooth and send a message. Can you let me know what the camera is expecting via Bluetooth to start and stop record?
Any chance you could release code with all Log.info removed, I'm trying to implement in a Cordova App and it's very hard to overide the initialisation function.
Here is a stackoverflow question about the subject
http://stackoverflow.com/questions/39604196/cordova-plugin-override-platform-initialise
OK now I've got the app running I'm trying to start recording
The camera is connected fine, it's got the latest firmware (1.2.13)
Here is the log
V/XiaomiYiCordovaPlugin(16988): [com.xiaoyi.action.ActionCamera@423fe5c0] onDataSent(), current state: Connected I/XiaomiYiCordovaPlugin(16988): Start recording success V/XiaomiYiCordovaPlugin(16988): [com.xiaoyi.action.ActionCamera@423fe5c0] onDataReceive d(), current state: Connected V/XiaomiYiCordovaPlugin(16988): [com.xiaoyi.action.ActionCamera@423fe5c0] onDataSent(), current state: Connected V/XiaomiYiCordovaPlugin(16988): [com.xiaoyi.action.ActionCamera@423fe5c0] onDataReceive d(), current state: Connected V/XiaomiYiCordovaPlugin(16988): [com.xiaoyi.action.ActionCamera@423fe5c0] onDataSent(), current state: Connected V/XiaomiYiCordovaPlugin(16988): [com.xiaoyi.action.ActionCamera@423fe5c0] internalDisco nnect(), current state: Connected I/XiaomiYiCordovaPlugin(16988): [com.xiaoyi.action.ActionCamera@423fe5c0] onClosed(), c urrent state: Disconnecting I/XiaomiYiCordovaPlugin(16988): Start recording failed I/XiaomiYiCordovaPlugin(16988): camera connection closed
Here is my recording function (copied from the example)
public void startRecording(Date startTime,final CallbackContext callbackContext) { if (mState == CameraState.Connected) { updateState(CameraState.StartRecording); mCamera.stopRecording(null, null).setSystemMode(SystemMode.Record, null, null) .startCommandGroup() .setDateTime(new Date(), null, null) .startRecording(startTime.getHours(), startTime.getMinutes(), startTime.getSeconds(), null, null) .submitCommandGroup(null, new ActionCameraCommandCallback1<Error>() { @Override public void onInvoke(Error val) { Log.i(TAG, "Start recording failed"); if (mState == CameraState.StartRecording) { updateState(CameraState.Connected); } } }); Log.i(TAG, "Start recording success"); PluginResult result = new PluginResult(PluginResult.Status.OK, true); callbackContext.sendPluginResult(result); } }
Here is my camera setup
public Camera( String ip, CallbackContext callbackContext) { mUIHandler = new Handler(Looper.getMainLooper()); mState = CameraState.Disconnected; mCallbackContext = callbackContext; mIP = ip; if (mIP == null) { mIP = ""; } /* mHostname = hostname; if (mHostname == null || mHostname.isEmpty()) { mHostname = mIP; }*/ }
Is this something to do with hostname? I could see where that was being used.
The wiring diagram decribes that you have to connect all pins 2 together and all pins 7 together. I'm a bit confused because micro usb cables only have 5 pins. If i use the colors then i should connect all red: vcc (+5v) cables together and all black: ground cables together. Is that correct?
Edit: i found out that there's a (now sold out) special sync cable: here
Any way i can create a cable like this with a male connector?
I'm writing Android application which connects to 10 Xiaomi Yi cameras. Each one of them has different IP assigned by custom script. They all connects to Wi-Fi and Android device is also in the same network.
Cameras connects without any problems but every 1-2 minutes some camera disconnects from device (not from network because for testing purposes I'm running ping command to cameras from my computer connected to the same network). If I had 5 cameras connected it was working without any problems.
com.xiaoyi.action.Logger
show logs in that situation (one after one in the same second):
verbose: [com.xiaoyi.action.ActionCamera@396e82ee] internalDisconnect(), current state: Connected
info: [com.xiaoyi.action.ActionCamera@396e82ee] onClosed(), current state: Disconnecting
In ActionCameraListener
in public void onClosed(YICameraSDKError error)
error object has values:
error.getDetail(): null
error.getCode(): -2147483638
What internalDisconnect() means and how to fix it?
//edit
Now I checked and 5 cameras also disconnects after some time.
Hi,
are there any plans to release an SDK for the action camera? I've tried the firmware on a non 4k version of the camera and it doesn't work?
I haven't found a way to run the samples in Linux (Ubuntu). I've installed swift, but I don't know how to proceed: if I cd
into samples/CameraDemo
and type swift build
I get:
error: rootManifestFileNotFound
My goal is to be able to do live streams bu using my computer or my Ubuntu phone (I don't have any android or iOS devices).
While parsing Java libyiaction.jar i've noticed
String url = "http://" + ActionCamera.this.mCameraIP + "/DCIM/100MEDIA/" + fileName;
string in ActionCamera.downloadFile().
But if you ever shot more than 999 times, new files will be placed in /101MEDIA/, then /102MEDIA/ for 1999+ files and so on. And in that case files could not be readed AT ALL by the function.
Humble but vital petition from here:
Could you please please add ability to access file by HTTP from particular offset, something like "http://...mp4?offset=xxxbytes"? I believe it costs nothing for you...
Hi, when following the instructions on the website to upgrade our YI action camera, we cannot find the right firmware. The device's SN starts with "Z25L" which doesn't match any SN on the official website.
We also tried the firmware in this repository, but didn't success. Can the YI action camera (not the 4k version) support this firmware? How can we get the device upgraded successfully?
Hi,
I'm trying to follow this tutorial on syncing Yi 4k+ cameras together.
http://open.yitechnology.com/vrcamera.html
And I'm having problems follow this tutorial to the its end.
Here's what I did:
firmware_first.bin
and firmware_others.bin
from this repository https://github.com/YITechnology/YIOpenAPI/tree/master/vr/bin/en-us *firmware.bin
I suppose those particular firmwares were compiled strictly for 4k cameras and won't work on 4k+ models.
Would you please tell me how should I proceed with this issue?
Thank you!!
Its possible to provide the STL files? I tried to use the Gcode files but my printer have a very different configuration...
Best Regards
Can't use sdk with new Xcode 8.3. When updates (if they will)?
Firmware.bin contains Linux, Busybox, and Cherokee. It is obvious to state that this firmware is compiled from the Ambarella SDK. Under the GPL license I am requesting the used sourcecode and build process for the Xiaomi Yi camera's under a repository of YiTechnology. I am sure more people are interested in this.
Linux version 3.10.71 (jenkins@ANTS-BJ-SV0003) (gcc version 4.9.2 20140904 (prerelease) (crosstool-NG linaro-1.13.1-4.9-2014.09 - Linaro GCC 4.9-2014.09) ) #1 PREEMPT Fri Sep 30 18:22:03 CST 2016
So I guess it would be the most simple to state: Ambarella SoC SDK please :)
Is this firmware in the repository for the Yi as well as the Yi4K?
I can get the rtsp url (it claims it is rtsp://192.168.42.1/live) and the camera ip is 192.168.1.199, but I can not view the stream in my app. I tried just starting the rtsp server and using VLC and it also will not work.
Any ideas on what I'm doing wrong?
I'm trying to conenct with a camera but onConnected() or onClosed() are never called.
I create ActionCamera like this
`ac1 = new ActionCamera(new ActionCameraListener() {
@OverRide
public void onConnected() {
super.onConnected();
connFeedback.setText("Connected to camera " + SSID1);
}
@Override
public void onClosed(Error error) {
super.onClosed(error);
connFeedback.setText("Error connecting to camera " + SSID1 + ": " + error.toString());
}
}, new DispatchQueue() {
@Override
public void dispatch(Runnable runnable) {
}
});`
and try to connect with this camera using
ac1.connect("tcp:" + ip + ":7878");
I'm sure that ip is correct (I tested it) but nothing happens with ActionCameraListener. However, dispatch() is being called .
Anyone can help me? thanks
I know QR Code made with yi action app works with yi action camera.
But, the QR Code made with yi action app has two more values, ak and sign, compared to QR Code made with this API.
Does the QR Code made with this API still works? or is it outdated?
when i execute my program,it post some error :
Exception in thread "main" java.lang.NoClassDefFoundError: com/xiaoyi/action/Platform
at Yi4k.main(Yi4k.java:224)
Caused by: java.lang.ClassNotFoundException: com.xiaoyi.action.Platform
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
my codes is here,is there any error:
import com.xiaoyi.action.;
import com.xiaoyi.action.Error;
import java.io.;
import java.net.;
import java.util.;
import java.util.Date;
enum CameraState {
Disconnected,
Connected,
StartRecording,
Recording
}
class Camera extends ActionCameraListener {
private CameraState mState;
private ActionCamera mCamera;
public String mIP;
public String mHostname;
//region Properties
public CameraState getState() {
return mState;
}
public String getIp() {
return mIP;
}
public String getHostname() {
return mHostname;
}
//endregion
public Camera() {
mState = CameraState.Disconnected;
}
public void connect() {
mCamera = new ActionCamera(this, new DispatchQueue() {
@Override
public void dispatch(Runnable task) {
}
});
mCamera.connect("tcp:" + mIP + ":7878");
}
public void disconnect() {
if (mCamera != null) {
mCamera.disconnect();
}
}
public void startRecording(Date startTime) {
}
private void capturesuccess(){
}
public void startcapture(){
if (mState == CameraState.Connected){
updateState(CameraState.StartRecording);
mCamera.stopViewFinder(null, null).stopRecording(null, null).setSystemMode(SystemMode.Record, null, null);
mCamera.capturePhoto(null, null);
}
}
public void stopRecording() {
if (mState == CameraState.StartRecording || mState == CameraState.Recording) {
mCamera.stopRecording(null, null);
}
}
//region implementation of ActionCameraListener
@Override
public void onConnected() {
updateState(CameraState.Connected);
}
}
@Override
public void onClosed(Error error) {
updateState(CameraState.Disconnected);
}
@Override
public void onRecordStarted() {
updateState(CameraState.Recording);
}
@Override
public void onRecordStopped() {
updateState(CameraState.Connected);
}
//endregion
private void updateState(CameraState state) {
if (mState != state) {
mState = state;
// mContext.gridAdapter.notifyDataSetChanged();
}
}
public void doscan() {
}
}
public class Yi4k {
/**
* @param args the command line arguments
*/
private String s;
public static void main(String[] args) {
// TODO Auto-generated method stub
try {
Platform.initialize(null);
} catch (Exception ex) {
ex.printStackTrace();
}
Camera camera=new Camera();
System.out.println("doscan......");
camera.doscan();
//camera.mIP = s;
System.out.println("connecting......");
camera.connect();
}
}
I really like that you are working on an open API for your devices! This effort makes your products much more attractive to developers. By having a nice to use API, potentially a software ecosystem around your products may form that drives artists, makers and an even wider audience towards it. This really can set you apart from other brands.
That having said, I think you limit yourselves by offering language-specific or platform-specific SDKs. The reason why you currently support Java exclusively probably is the fact that it's a lot of work to build these SDKs. You'll have to allocate a lot of developer resources within your teams to build and maintain a whole set of SDKs for different languages and no matter how many languages or platforms you support, some devs will always be excluded. I saw many poorly maintained, outdated and buggy SDKs for exactly this reason.
There is a better way that requires way less work on your end, and supports all languages and platforms, including the most exotic ones running on tiny $2 embedded devices. Move your API to the http layer. Your cameras have Wifi and maybe even support Ethernet-over-USB? Then you can easily implement an http server with various REST API endpoints and use JSON to serialize data structures.
http and JSON are supported by all programming languages, because they are required to talk to all of the web services out there. There are well-tested and robust implementations on all platforms and even junior developers and web developers know how to use them.
By focusing all your resources on designing, building and documenting a REST API, you could create a very polished, accessible and fun to use programmatic interface to your devices that would be attractive to the developer community as a whole.
By carefully mapping your devices' components to URLs, you can make that API really intuitive. Imagine:
curl http://myyi4k.local/sensor/settings
{
"iso": 100,
"resolution": {
"x": 4000,
"y": 3000
},
"framesPerSecond": 30
}
curl http://myyi4k.local/battery
{
"charge": 0.75,
"secondsRemaining": 6000
}
curl http://myyi4k.local/firmware
{
"version": {
"major": 1,
"minor": 0,
"patchLevel": 13
},
"releaseDate": "2016-10-14"
}
curl http://myyi4k.local/storage/IMG-23124.jpeg
[jpeg data]
Some of these settings would be writable via POST or PUT requests, firmware updates could be done by POSTing to /firmware/image
, the camera's shutter could be triggered by POSTing to /shutter
, the current live video frame could be requested from /sensor/frame
.
Pre-existing http infrastructure projects (proxies, caches, etc) could be easily combined with your device without any custom software to build more complex system and everything would seamlessly integrate with Internet-of-things devices and, most importantly, the web. Imagine all those people out there knowing jquery could easily remote control your devices. But, on the other end of the spectrum, the Erlang or C++ and Java developer is also happy. because they can use their favourite HTTP client library and don't have to learn a bunch of new stuff.
Http is a good mach for live streaming, remote control and content management.
One of the first things I would do with that API would be controlling an action camera with this tiny chip. The possibilities are endless! No chance that a Java VM will ever run on it. Or maybe, the first thing I'd do would actually be writing a module for NodeJS that could be used in a Node-powered Quadcopter (Nodecopter).
I hope these thoughts are useful to you.
Jan
Hi,
This problem happens only on the Xiaomi Yi 4k (not on the old normal model):
1.) Viewfinder is off.
2.) Now switch between modes (video, photo, timelapse, etc.).
3.) Now try to turn on the viewfinder. Sometimes it works, but often the viewfinder does not start but instead an error -21 is returned.
After this procedure also the original Xiaomi Yi app for Android shows only a black viewfinder until the camera is manually rebooted.
Regards,
I will start by saying this could be user error but I have not been successful in my attempts to install the firmware on my YI 4K action cam. It asks if I want to update firmware and then it does it, restarts and then asks the same question again. I've tried it with and without the config file on the microSD card.
I am on the latest firmware from YI. I've also got the blinking red light on top of the camera a few times while trying to update the firmware with the SDK. Could someone point me in the right direction. My ultimate goal is to set them all up a WIFI clients to do a VR 360 rig.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.