MCPcopy Create free account
hub / github.com/dgreif/ring / example

Function example

packages/examples/record-example.ts:10–31  ·  view source on GitHub ↗

* This example records a 10 second video clip to output/example.mp4

()

Source from the content-addressed store, hash-verified

8 **/
9
10async 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
33example().catch((e) => {
34 console.error(e)

Callers 1

record-example.tsFile · 0.70

Calls 3

getCamerasMethod · 0.95
cleanOutputDirectoryFunction · 0.90
recordToFileMethod · 0.80

Tested by

no test coverage detected