* This example records a 10 second video clip to output/example.mp4
()
| 8 | **/ |
| 9 | |
| 10 | async function example() { |
| 11 | const ringApi = new RingApi({ |
| 12 | // Replace with your refresh token |
| 13 | refreshToken: process.env.RING_REFRESH_TOKEN!, |
| 14 | debug: true, |
| 15 | }), |
| 16 | cameras = await ringApi.getCameras(), |
| 17 | camera = cameras[0] |
| 18 | |
| 19 | if (!camera) { |
| 20 | console.log('No cameras found') |
| 21 | return |
| 22 | } |
| 23 | |
| 24 | // clean/create the output directory |
| 25 | await cleanOutputDirectory() |
| 26 | |
| 27 | console.log(`Starting Video from ${camera.name} ...`) |
| 28 | await camera.recordToFile(path.join(outputDirectory, 'example.mp4'), 10) |
| 29 | console.log('Done recording video') |
| 30 | process.exit(0) |
| 31 | } |
| 32 | |
| 33 | example().catch((e) => { |
| 34 | console.error(e) |
no test coverage detected