Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mariomka/yi-action-camera
Yi Action Camera module for node
https://github.com/mariomka/yi-action-camera
nodejs yi-action-camera
Last synced: 16 days ago
JSON representation
Yi Action Camera module for node
- Host: GitHub
- URL: https://github.com/mariomka/yi-action-camera
- Owner: mariomka
- License: mit
- Archived: true
- Created: 2016-09-04T18:29:34.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2019-11-13T21:43:55.000Z (almost 5 years ago)
- Last Synced: 2024-10-02T11:47:20.274Z (about 1 month ago)
- Topics: nodejs, yi-action-camera
- Language: JavaScript
- Size: 13.7 KB
- Stars: 60
- Watchers: 5
- Forks: 10
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# yi-action-camera
[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE)
[![Latest Version on NPM](https://img.shields.io/npm/v/yi-action-camera.svg?style=flat-square)](https://npmjs.com/package/yi-action-camera)
[![npm](https://img.shields.io/npm/dt/yi-action-camera.svg?style=flat-square)](https://www.npmjs.com/package/yi-action-camera)> Yi Action Camera module for node.
Tested on Xiaomi Yi Action Camera (Not Yi 4K)
## Install
```shell
npm install --save yi-action-camera
```## Usage
First of all connect Xiaomi Yi Action Camera via WiFi.
Default password is `1234567890`.
```js
const yi = require('yi-action-camera');yi.connect()
.then(function () {
console.log('connected');return yi.takePhoto();
})
.then(function (filePath) {
console.log('photo', filePath);return yi.downloadFile(filePath);
})
.then(function (filePath) {
console.log('photo downloaded', filePath);return yi.disconnect();
})
.then(function () {
console.log('disconnected');
})
.catch(function (err) {
console.error(err);
});
```## Settings
### autoConnect
Default: `true`### ip
Default: `192.168.42.1`### port
Default: `7878`## API Reference
### connect()
Connect to camera.Returns `Promise`
### disconnect()
Close connection to camera.Returns `Promise`
### takePhoto()
Take a photo.Returns `Promise`
### startRecord()
Start video recording.Returns `Promise`
### stopRecord()
Stop video recording.Returns `Promise`
### startStream()
Start live stream by url (Default ip: `192.168.42.1`)
```rtsp://${ip}/live```Returns `Promise`
### stopStream()
Stop live streamReturns `Promise`
### getConfig()
Get camera config.Returns `Object`
### setConfig(type, value)
Set camera config. See [configuration values](#configuration-values).#### type
RequiredType: `string`
#### value
RequiredType: `string`
Returns `Promise`
### downloadFile(filePath, outputPath)
Download a file from camera.#### filePath
RequiredType: `string`
Absolute camera file path.
#### outputPath
OptionalType: `string`
Default: `./`
Output host file path.
Returns `Promise`
### deleteFile(filePath)
Delete a file from camera.#### filePath
RequiredType: `string`
Absolute camera file path.
Returns `Promise`
## Configuration values
You can check all config types and values in [constant.js](constant.js) and access it through `yi.config`.## License
MIT © [Mario Juárez](https://github.com/mariomka)
## It couldn't be possible without:
- https://dashcamtalk.com/forum/threads/xiaomi-yi-camera-gui-control-configure-from-pc-win-lin-mac.11206/
- https://copter.sovgvd.info/a/Xiaomi-Yi-protocol-remote-control
- http://pastebin.com/yKvXyyp8