yi-action-camera

Yi Action Camera module for node


Keywords
yi, action, camera, xiaomi, nodejs, yi-action-camera
License
MIT
Install
npm install yi-action-camera@0.1.4

Documentation

yi-action-camera

Software License Latest Version on NPM npm

Yi Action Camera module for node.

Tested on Xiaomi Yi Action Camera (Not Yi 4K)

Install

npm install --save yi-action-camera

Usage

First of all connect Xiaomi Yi Action Camera via WiFi.

Default password is 1234567890.

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 stream

Returns Promise

getConfig()

Get camera config.

Returns Object

setConfig(type, value)

Set camera config. See configuration values.

type

Required

Type: string

value

Required

Type: string

Returns Promise

downloadFile(filePath, outputPath)

Download a file from camera.

filePath

Required

Type: string

Absolute camera file path.

outputPath

Optional

Type: string

Default: ./

Output host file path.

Returns Promise

deleteFile(filePath)

Delete a file from camera.

filePath

Required

Type: string

Absolute camera file path.

Returns Promise

Configuration values

You can check all config types and values in constant.js and access it through yi.config.

License

MIT © Mario Juárez

It couldn't be possible without: