npm.io
4.0.0 • Published 12 months ago

is-camera-on

Licence
MIT
Version
4.0.0
Deps
2
Size
271 kB
Vulns
0
Weekly
0
Stars
97

is-camera-on

Check if a Mac camera is on

Install

npm install is-camera-on

Requires macOS 10.15 or later.

Usage

import isCameraOn, {isCameraOnChanges} from 'is-camera-on';

console.log(await isCameraOn());
//=> true

// Watch for camera status changes
for await (const status of isCameraOnChanges()) {
	console.log(`Camera is ${status ? 'on' : 'off'}`);
}

API

isCameraOn()

Returns a promise that resolves with a boolean indicating whether the camera is on.

isCameraOnChanges()

Returns an async iterator that yields the camera status as a boolean whenever it changes. The current status is emitted immediately.

Keywords