Snapshots
這一頁還沒有中文版,以下顯示英文原文。
Take a still image from the device. With datachannelOnly: true, the device sends no video at all, so nothing is encoded or uploaded until you ask for the image. The image arrives base64-encoded, after every part of it is in.
import { ChannelRole, PiCamera } from '@mazupo/client';
const camera = new PiCamera({
uid: 'your-custom-uid',
mqttHost: 'your.mqtt.cloud',
mqttPath: '/mqtt',
mqttPort: 8084,
mqttUsername: 'hakunamatata',
mqttPassword: 'Wonderful',
stunUrls: ['stun:stun1.l.google.com:19302'],
datachannelOnly: true,
});
camera.onDatachannel = (role) => {
if (role === ChannelRole.Command) {
camera.snapshot();
}
};
camera.onSnapshot = (base64Image) => {
console.log(base64Image);
camera.terminate();
};
camera.connect();snapshot(quality) takes a JPEG quality from 0 to 100. The default is 30.
Bandwidth
Limit how much video the device sends to a viewer. A small tile on a monitoring wall does not need full quality, and a lower bitrate saves cloud and mobile d...
Recording
Start and stop the device's recorder, and download recorded files. Both use the DataChannel, so they need the mqtt signaling.

