npm stats
  • Search
  • About
  • Repo
  • Sponsor
  • more
    • Search
    • About
    • Repo
    • Sponsor

Made by Antonio Ramirez

is-camera-on

4.0.0

@sindresorhus

npmHomeRepoSnykSocket
Downloads:103
$ npm install is-camera-on
DailyWeeklyMonthlyYearly

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.

Related

  • is-camera-on-cli - CLI for this package