matterbridge-example-camera 0.0.4 → 0.0.6-dev-20260721-4f7106a

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -28,6 +28,45 @@ If you like this project and find it useful, please consider giving it a star on
28
28
 
29
29
  <a href="https://www.buymeacoffee.com/luligugithub"><img src="https://matterbridge.io/assets/bmc-button.svg" alt="Buy me a coffee" width="120"></a>
30
30
 
31
+ ## [0.0.6] - Dev branch
32
+
33
+ ## [0.0.6] - Dev branch
34
+
35
+ ### Added
36
+
37
+ - [floodlight camera]: Add the Floodlight Camera device type. It is a composed device: the root endpoint carries Basic Information and, unless disabled, Power Source; the mandatory Camera child endpoint and the mandatory On/Off Light child endpoint required by Matter specs 1.6.0 chapter 16.2 are both created automatically by the constructor, the Camera child with the same CameraAvStreamManagement/WebRtcTransportProvider wiring as the standalone `Camera` device; `addLight()` adds further On/Off Light child endpoints beyond the mandatory one.
38
+ - [platform]: Register a Floodlight Camera example device in `onStart`, and verify it's registered in `onConfigure`.
39
+ - [tests]: Add `vitest/devices/floodlightCamera.test.ts` covering default options, custom `lightOptions`, camera identify, power source variants, additional tagged lights, and custom stream usages; extend `vitest/module.test.ts` with the Floodlight Camera "device not registered" `onConfigure` error path.
40
+
41
+ ### Fixed
42
+
43
+ - [webrtc]: `provideIceCandidates` unconditionally skipped every mDNS host ICE candidate (`*.local`), so a peer that only offers mDNS-obfuscated candidates (the Chromium/Edge default) left the werift peer connection with zero usable remote candidates — signaling succeeded but the stream stayed black. werift-ice already resolves `.local` candidates via a real multicast DNS query before pairing them, so candidates are no longer skipped and that resolution is allowed to run; the per-candidate apply timeout is bumped from 2000ms to 5000ms to leave headroom for the mDNS round trip. Verified against a real Edge client: the mDNS candidate resolved and applied in 98ms and video streamed correctly. See the new "Known limitation: Firefox may only offer a link-local address on a non-HTTPS page" note in the README for a related, separate client-side issue this does not fix.
44
+ - [snapshot]: README asset docs still described the pre-#15 `camera-color-test-*.jpeg` names; `CaptureSnapshot` now reads `camera-color-{640-480,1280-720,1920-1080}.jpeg`. Also documented why all three calibration cards are kept under the ~65535-byte Matter message-size ceiling (AES-CCM's 13-byte nonce) and why it can't be worked around by tuning TCP.
45
+
46
+ <a href="https://www.buymeacoffee.com/luligugithub"><img src="https://matterbridge.io/assets/bmc-button.svg" alt="Buy me a coffee" width="120"></a>
47
+
48
+ ## [0.0.5] - 2026-07-20
49
+
50
+ ### Added
51
+
52
+ - [wirift]: Add codec negotiation and ffmpeg windows path.
53
+ - [audio doorbell]: Add the Audio Doorbell device type with the required Identify, Switch (MomentarySwitch feature), Camera AV Stream Management (Audio feature), and WebRtcTransportProvider clusters, plus the Chime and WebRtcTransportRequestor client clusters, and Power Source support.
54
+ - [clients]: Add `src/behaviors/clients.ts` with `addChimeClient`/`addWebRtcTransportRequestorClient` helpers, shared by `Doorbell`, `AudioDoorbell`, and `Camera`.
55
+ - [tests]: Add `vitest/behaviors/clients.test.ts` covering `addChimeClient`/`addWebRtcTransportRequestorClient`, and assert in `doorbell.test.ts`, `camera.test.ts`, and `audioDoorbell.test.ts` that the required client clusters are registered in `MatterbridgeBindingServer`'s `clientList` and `type.clientClusters`.
56
+ - [platform]: Add a server Chime and Doorbell to test binding.
57
+
58
+ ### Changed
59
+
60
+ - [package]: Update dependencies.
61
+ - [package]: Upgrade package.
62
+ - [camera]: Use the shared `addWebRtcTransportRequestorClient` helper from `clients.ts` instead of a local duplicate.
63
+ - [doorbell]: Use the shared `addChimeClient` helper from `clients.ts` instead of inline binding code.
64
+ - [devices]: `DoorbellOptions`, `AudioDoorbellOptions`, `ChimeOptions`, `CameraOptions`, and `SnapshotCameraOptions` now extend `MatterbridgeEndpointOptions`, forwarding `id`/`number`/`tagList`/`mode` to the underlying `MatterbridgeEndpoint` (`id` defaults to `${name}-${serial}` when not provided), and document the default value of each `identifyTime`/`identifyType`/`powerSourceType` option in JSDoc.
65
+ - [module]: Register the `AudioDoorbell` example device in `onStart` and verify it's registered in `onConfigure`, alongside the existing `Chime`, `Doorbell`, `SnapshotCamera`, and `Camera` example devices.
66
+ - [tests]: Add `vitest/module.test.ts` coverage for the `AudioDoorbell` and `Camera` "device not registered" `onConfigure` error paths, and for the `animationInterval` configuration option (periodic `animationHandler` execution, phase wraparound, and interval cleanup on shutdown).
67
+
68
+ <a href="https://www.buymeacoffee.com/luligugithub"><img src="https://matterbridge.io/assets/bmc-button.svg" alt="Buy me a coffee" width="80"></a>
69
+
31
70
  ## [0.0.4] - 2026-07-19
32
71
 
33
72
  ### Added
package/README.md CHANGED
@@ -77,6 +77,27 @@ Features:
77
77
  - Optional Identify cluster support, with configurable identify time and type. Set to Identify.IdentifyType.None to omit the cluster entirely.
78
78
  - Configurable Power Source cluster type: Rechargeable, Replaceable, Battery, Wired, or None to omit the Power Source cluster entirely.
79
79
 
80
+ ### Audio Doorbell
81
+
82
+ Features:
83
+
84
+ - Exposes the Switch cluster with the MomentarySwitch feature only, as required by the Matter specification for this device type.
85
+ - Exposes the Camera AV Stream Management cluster with the Audio feature only (the Video and Snapshot features are not present, per the Matter specification for this device type; see Camera for a device implementing those).
86
+ - Exposes the WebRtcTransportProvider cluster and registers a WebRtcTransportRequestor client, so a bound controller can solicit and receive WebRTC offers, same as Camera.
87
+ - Adds the required Chime client cluster automatically via `addChimeClient`, so a bound Chime device can be triggered when the doorbell button is pressed.
88
+ - Identify cluster is always created (it is a required server cluster for this device type), with configurable identify time and type.
89
+ - Configurable Power Source cluster type: Rechargeable, Replaceable, Battery, Wired, or None to omit the Power Source cluster entirely.
90
+ - Deviation from the Matter specification: the CameraAvStreamManagement ImageControl feature is also enabled, even though the specification only allows it when Video or Snapshot is present, to work around a matter.js bug where the ImageRotation/ImageFlipHorizontal/ImageFlipVertical "at least one shall be present" choice conformance is enforced unconditionally instead of only when ImageControl is enabled (see the JSDoc in `src/devices/audioDoorbell.ts`).
91
+
92
+ ### Floodlight Camera
93
+
94
+ Features:
95
+
96
+ - A composite device type, always defined via endpoint composition: the root endpoint exposes Basic Information and, unless disabled, a Power Source cluster; the mandatory Camera child endpoint and the mandatory On/Off Light child endpoint required by the Matter specification for this device type are both created automatically by the constructor. The Camera child is wired the same way as the standalone Camera device (CameraAvStreamManagement with the Video, Audio, Snapshot and ImageControl features, and the WebRtcTransportProvider cluster and WebRtcTransportRequestor client). Each light gets its own Identify and OnOff (Lighting feature) cluster servers.
97
+ - Exposes `addLight()` to add further On/Off Light child endpoints beyond the mandatory one, with an optional tagList for disambiguation when more than one light is present.
98
+ - Configurable Power Source cluster type on the root endpoint: Rechargeable, Replaceable, Battery, Wired, or None to omit the Power Source cluster entirely.
99
+ - The Camera child endpoint's Identify and CameraAvStreamManagement configuration can be customized via the `cameraOptions` constructor option, using the same fields and defaults as the standalone Camera device. The mandatory light's name, tagList, and initial state can be customized via the `lightOptions` constructor option.
100
+
80
101
  ## WebRTC test video injection
81
102
 
82
103
  `WeriftWebRtcSession` (see `src/webrtc/weriftSession.ts`) wraps a real werift `RTCPeerConnection` for each WebRtcTransportProvider session (see `MatterbridgeWebRtcTransportProviderServer` in `src/behaviors/webRtcTransportProviderServer.ts`), so the session's SDP offer/answer and ICE candidates are handled by a real WebRTC peer connection instead of being just recorded. It can also inject a real ffmpeg-generated video track into the negotiated connection, so the end-to-end media path can be validated without a real camera capture pipeline.
@@ -90,7 +111,7 @@ The video source defaults to a synthetic SMPTE bars test pattern, or can be swit
90
111
 
91
112
  A real client's resolution/quality picker (e.g. in Home Assistant) takes precedence over `MATTERBRIDGE_CAMERA_WEBCAM_RESOLUTION`: it allocates a video stream with `CameraAvStreamManagement.VideoStreamAllocate` before soliciting or providing a WebRTC offer, and `MatterbridgeWebRtcTransportProviderServer` looks up that stream's `maxResolution` to select the webcam capture resolution for the session. `MATTERBRIDGE_CAMERA_WEBCAM_RESOLUTION` is used when no matching allocated stream is found, or when the requested resolution isn't one of the three supported above.
92
113
 
93
- Requires `ffmpeg` to be installed and reachable on `PATH` (or under `/usr/bin`, `/bin`, or `/usr/local/bin`).
114
+ Requires `ffmpeg` to be installed. The resolver first tries `PATH`, then `/usr/bin/ffmpeg`, `/bin/ffmpeg`, and `/usr/local/bin/ffmpeg`. On Windows it also checks winget/Gyan installs under `%LOCALAPPDATA%\Microsoft\WinGet\Packages\Gyan.FFmpeg_*\ffmpeg-*\bin\ffmpeg.exe`, plus `%ProgramFiles%\ffmpeg\bin\ffmpeg.exe`, `%ProgramFiles%\Gyan\FFmpeg\bin\ffmpeg.exe`, `%ProgramFiles(x86)%\ffmpeg\bin\ffmpeg.exe`, and `%ProgramFiles(x86)%\Gyan\FFmpeg\bin\ffmpeg.exe`.
94
115
 
95
116
  Example, capturing from a real Linux webcam at 720p:
96
117
 
@@ -98,6 +119,12 @@ Example, capturing from a real Linux webcam at 720p:
98
119
  MATTERBRIDGE_CAMERA_VIDEO_SOURCE=webcam MATTERBRIDGE_CAMERA_WEBCAM_DEVICE=/dev/video0 MATTERBRIDGE_CAMERA_WEBCAM_RESOLUTION=1280x720 npm start
99
120
  ```
100
121
 
122
+ ### Known limitation: Firefox may only offer a link-local address on a non-HTTPS page
123
+
124
+ `MatterbridgeWebRtcTransportProviderServer.provideIceCandidates` applies every ICE candidate it receives, including mDNS-obfuscated `*.local` host candidates (the Chromium/Edge default): werift-ice resolves those via a real multicast DNS query before pairing them, so no special handling is needed here.
125
+
126
+ This relies on the client machine actually offering a usable address in the first place. Firefox has been observed advertising only a non-routable IPv6 link-local (`fe80::...`) address — instead of its real LAN IP — when the WebRTC-consuming page is loaded over plain HTTP from a non-`localhost` origin (i.e. not a secure context: not `https://`, not `http://localhost`/`127.0.0.1`), even with `media.peerconnection.ice.obfuscate_host_addresses` disabled in `about:config`. A link-local address can never be reached by a remote peer, so the connection stays black-screen no matter how the candidate is resolved. Chromium-based browsers (Edge, Chrome) were unaffected under the same conditions. If a stream stays black specifically with Firefox, check whether the page serving the WebRTC client is a secure context (`window.isSecureContext` in devtools, or `about:webrtc` for the actual candidates gathered) before assuming a bug in this plugin — serving that page over HTTPS, or via `localhost`, is the fix.
127
+
101
128
  ## Werift integration test
102
129
 
103
130
  The `vitest/werift.test.ts` integration test creates local client and server peers and verifies SDP offer/answer negotiation, ICE candidate exchange, a bidirectional data-channel transfer, and connection teardown with `werift`.
@@ -145,9 +172,20 @@ The `assets` directory contains deterministic three-second media fixtures for ex
145
172
  - `test-video.h264`: raw H.264 Constrained Baseline video, 640×360 at 15 FPS, with a moving test pattern. Use this elementary stream when implementing H.264 NAL-unit parsing and RTP packetization.
146
173
  - `test-audio.opus`: Ogg container with mono Opus audio at 48 kHz and 64 kbit/s, containing a 1 kHz test tone. Use the Opus packets for an audio RTP track; the Ogg container itself is not sent over WebRTC.
147
174
  - `test-camera.mp4`: playable reference containing the same 640×360 H.264 test pattern and a mono 1 kHz AAC track. The werift test transfers the complete file over its SCTP data channel and verifies its integrity. This exercises binary file transport, not a WebRTC video RTP track.
148
- - `camera-color-test-1920-1080.jpeg`: 1920×1080 broadcast-style snapshot calibration card returned by the example's `CaptureSnapshot` command. It contains color bars, grayscale references, geometry targets, focus patterns, safe-area guides, and near-black/near-white patches for inspecting hue, saturation, brightness, contrast, geometry, overscan, and focus.
149
- - `camera-color-test-1280-720.jpeg`: 1280×720 SMPTE color-bars test pattern (mire) returned by the example's `CaptureSnapshot` command, generated with `ffmpeg -f lavfi -i smptebars=size=1280x720`.
150
- - `camera-color-test-640-480.jpeg`: 640×480 SMPTE color-bars test pattern (mire) returned by the example's `CaptureSnapshot` command, generated with `ffmpeg -f lavfi -i smptebars=size=640x480`.
175
+ - `camera-color-1920-1080.jpeg`: 1920×1080 simplified ffmpeg-generated color-rectangle snapshot returned by the example's `CaptureSnapshot` command.
176
+ - `camera-color-1280-720.jpeg`: 1280×720 simplified ffmpeg-generated color-rectangle snapshot returned by the example's `CaptureSnapshot` command.
177
+ - `camera-color-640-480.jpeg`: 640×480 simplified ffmpeg-generated color-rectangle snapshot returned by the example's `CaptureSnapshot` command.
178
+ - `camera-color-test-1920-1080.jpeg`, `camera-color-test-1280-720.jpeg`, `camera-color-test-960-540.jpeg`, `camera-color-test-640-480.jpeg`, and `camera-color-test-480-270.jpeg`: additional SMPTE color-bars snapshot fixtures.
179
+
180
+ #### Why the snapshot calibration cards stay under ~64 KB
181
+
182
+ All three calibration cards above are kept well under the Matter message size ceiling, which caps at **65535 bytes** for a single message and cannot be worked around by tuning TCP:
183
+
184
+ - Every Matter message is encrypted with AES-128-CCM, using a 13-byte nonce built from the security flags, message counter, and node ID (`Session.generateNonce`, part of the Matter message-security spec, not a matter.js choice).
185
+ - AES-CCM (RFC 3610 / NIST SP 800-38C) requires the nonce length `N` and the length-field size `L` to satisfy `N + L = 15` bytes for a 128-bit block cipher. With `N = 13`, that leaves `L = 2`.
186
+ - A 2-byte length field caps the plaintext of a single CCM-encrypted message at `2^16 - 1 = 65535` bytes — a cryptographic ceiling, not a networking one. matter.js's `DEFAULT_MAX_TCP_MESSAGE_SIZE` (64000) is just a round number kept safely under that limit.
187
+
188
+ A `CaptureSnapshot` response whose `data` field doesn't fit fails to send: the client gets a generic invoke failure instead of an image, since the encoder cannot represent the required plaintext length in the message header. `CameraAvStreamManagement.CaptureSnapshot` returns its image as a single field of a single command response, so it inherits this ceiling directly. Matter has a dedicated mechanism for transferring larger payloads — BDX (Bulk Data Exchange), used for OTA updates and diagnostic logs — which splits big content across a sequence of acknowledged messages instead of one oversized one, but `CaptureSnapshot` doesn't use it.
151
189
 
152
190
  WebRTC media tracks transport encoded H.264 or Opus frames in RTP packets; they do not send an MP4, Ogg, or MPEG container directly. The current MP4 transfer deliberately uses the separate data-channel path. A future video-track test should parse the relevant elementary frames, packetize them as RTP, call werift's media track `writeRtp()`, and verify reception through `onTrack` and `onReceiveRtp`.
153
191
 
@@ -0,0 +1,24 @@
1
+ import { MatterbridgeBindingServer } from 'matterbridge/behaviors';
2
+ import { ChimeClient, WebRtcTransportRequestorClient } from 'matterbridge/matter/behaviors';
3
+ import { Chime, WebRtcTransportRequestor } from 'matterbridge/matter/clusters';
4
+ function addBindingClientListEntry(endpoint, clusterId) {
5
+ if (endpoint.behaviors.has(MatterbridgeBindingServer)) {
6
+ const existing = endpoint.behaviors.optionsFor(MatterbridgeBindingServer)?.clientList ?? [];
7
+ if (!existing.includes(clusterId)) {
8
+ endpoint.behaviors.inject(MatterbridgeBindingServer, { clientList: [...existing, clusterId] });
9
+ }
10
+ }
11
+ else {
12
+ endpoint.behaviors.require(MatterbridgeBindingServer, { clientList: [clusterId] });
13
+ }
14
+ }
15
+ export function addChimeClient(endpoint) {
16
+ addBindingClientListEntry(endpoint, Chime.id);
17
+ endpoint.type.clientClusters.chime ??= ChimeClient;
18
+ return endpoint;
19
+ }
20
+ export function addWebRtcTransportRequestorClient(endpoint) {
21
+ addBindingClientListEntry(endpoint, WebRtcTransportRequestor.id);
22
+ endpoint.type.clientClusters.webRtcTransportRequestor ??= WebRtcTransportRequestorClient;
23
+ return endpoint;
24
+ }
@@ -1,11 +1,11 @@
1
- import { MatterbridgeBindingServer, MatterbridgeServer } from 'matterbridge/behaviors';
1
+ import { MatterbridgeServer } from 'matterbridge/behaviors';
2
2
  import { Node } from 'matterbridge/matter';
3
3
  import { WebRtcTransportProviderServer, WebRtcTransportRequestorClient } from 'matterbridge/matter/behaviors';
4
- import { WebRtcTransportRequestor } from 'matterbridge/matter/clusters';
5
4
  import { EndpointNumber, FabricIndex, NodeId, StreamUsage, Status, StatusResponseError } from 'matterbridge/matter/types';
6
5
  import { WeriftWebRtcSession } from '../webrtc/weriftSession.js';
7
6
  import { MatterbridgeCameraAvStreamManagementServer } from './cameraAvStreamManagementServer.js';
8
7
  const DEFERRED_INVOKE_DELAY_MS = 250;
8
+ const ICE_CANDIDATE_APPLY_TIMEOUT_MS = 5000;
9
9
  export class MatterbridgeWebRtcTransportProviderServer extends WebRtcTransportProviderServer {
10
10
  #invokeDeferred(action, description) {
11
11
  const device = this.endpoint.stateOf(MatterbridgeServer);
@@ -211,20 +211,13 @@ export class MatterbridgeWebRtcTransportProviderServer extends WebRtcTransportPr
211
211
  if (webRtcPeer) {
212
212
  for (const [index, candidate] of request.iceCandidates.entries()) {
213
213
  const startedAt = Date.now();
214
- const isMdnsHostCandidate = /\.local\s+\d+\s+typ\s+host\b/i.test(candidate.candidate);
215
- if (isMdnsHostCandidate) {
216
- device.log.debug(`Skipping mDNS host ICE candidate ${index + 1}/${request.iceCandidates.length} for session ${request.webRtcSessionId} ` +
217
- `(mid=${candidate.sdpMid ?? 'null'}, mLine=${candidate.sdpmLineIndex ?? 'null'}) ` +
218
- `(endpoint ${this.endpoint.maybeId}.${this.endpoint.maybeNumber})`);
219
- continue;
220
- }
221
214
  device.log.debug(`Applying ICE candidate ${index + 1}/${request.iceCandidates.length} for session ${request.webRtcSessionId} ` +
222
215
  `(mid=${candidate.sdpMid ?? 'null'}, mLine=${candidate.sdpmLineIndex ?? 'null'}, endOfCandidates=${candidate.candidate.trim() === ''}) ` +
223
216
  `(endpoint ${this.endpoint.maybeId}.${this.endpoint.maybeNumber})`);
224
217
  try {
225
218
  await Promise.race([
226
219
  webRtcPeer.addIceCandidate(candidate.candidate, candidate.sdpMid, candidate.sdpmLineIndex),
227
- new Promise((_resolve, reject) => setTimeout(() => reject(new Error('ICE candidate apply timeout after 2000ms')), 2000)),
220
+ new Promise((_resolve, reject) => setTimeout(() => reject(new Error(`ICE candidate apply timeout after ${ICE_CANDIDATE_APPLY_TIMEOUT_MS}ms`)), ICE_CANDIDATE_APPLY_TIMEOUT_MS)),
228
221
  ]);
229
222
  device.log.debug(`Applied ICE candidate ${index + 1}/${request.iceCandidates.length} for session ${request.webRtcSessionId} ` +
230
223
  `in ${Date.now() - startedAt}ms (endpoint ${this.endpoint.maybeId}.${this.endpoint.maybeNumber})`);
@@ -260,17 +253,3 @@ export function createDefaultWebRtcTransportProviderClusterServer(endpoint) {
260
253
  endpoint.behaviors.require(MatterbridgeWebRtcTransportProviderServer, { currentSessions: [] });
261
254
  return endpoint;
262
255
  }
263
- export function addWebRtcTransportRequestorClient(endpoint) {
264
- if (endpoint.behaviors.has(MatterbridgeBindingServer)) {
265
- const existing = endpoint.behaviors.optionsFor(MatterbridgeBindingServer)?.clientList ?? [];
266
- if (!existing.includes(WebRtcTransportRequestor.id)) {
267
- endpoint.behaviors.inject(MatterbridgeBindingServer, { clientList: [...existing, WebRtcTransportRequestor.id] });
268
- }
269
- }
270
- else {
271
- endpoint.behaviors.require(MatterbridgeBindingServer, { clientList: [WebRtcTransportRequestor.id] });
272
- }
273
- const clientClusters = endpoint.type.clientClusters;
274
- clientClusters.webRtcTransportRequestor ??= WebRtcTransportRequestorClient;
275
- return endpoint;
276
- }
@@ -0,0 +1,64 @@
1
+ import { audioDoorbell, MatterbridgeEndpoint, powerSource } from 'matterbridge';
2
+ import { CameraAvStreamManagement, Identify } from 'matterbridge/matter/clusters';
3
+ import { StreamUsage } from 'matterbridge/matter/types';
4
+ import { MatterbridgeCameraAvStreamManagementServer } from '../behaviors/cameraAvStreamManagementServer.js';
5
+ import { addChimeClient, addWebRtcTransportRequestorClient } from '../behaviors/clients.js';
6
+ import { createDefaultWebRtcTransportProviderClusterServer } from '../behaviors/webRtcTransportProviderServer.js';
7
+ export class AudioDoorbell extends MatterbridgeEndpoint {
8
+ constructor(name, serial, options = {}) {
9
+ const { identifyTime = 0, identifyType = Identify.IdentifyType.None, powerSourceType = 'Wired', maxContentBufferSize = 65_536, maxNetworkBandwidth = 128_000, supportedStreamUsages = [StreamUsage.LiveView], streamUsagePriorities = supportedStreamUsages, microphoneCapabilities = { maxNumberOfChannels: 1, supportedCodecs: [CameraAvStreamManagement.AudioCodec.Opus], supportedSampleRates: [48000], supportedBitDepths: [16] }, id, number, tagList, mode, } = options;
10
+ super(powerSourceType === 'None' ? [audioDoorbell] : [audioDoorbell, powerSource], {
11
+ id: id ?? `${name.replaceAll(' ', '')}-${serial.replaceAll(' ', '')}`,
12
+ number,
13
+ tagList,
14
+ mode,
15
+ });
16
+ this.createDefaultIdentifyClusterServer(identifyTime, identifyType);
17
+ this.createDefaultBasicInformationClusterServer(name, serial, 0xfff1, 'Matterbridge', 0x8000, 'Matterbridge Audio Doorbell');
18
+ switch (powerSourceType) {
19
+ case 'Rechargeable':
20
+ this.createDefaultPowerSourceRechargeableBatteryClusterServer();
21
+ break;
22
+ case 'Replaceable':
23
+ this.createDefaultPowerSourceReplaceableBatteryClusterServer();
24
+ break;
25
+ case 'Battery':
26
+ this.createDefaultPowerSourceBatteryClusterServer();
27
+ break;
28
+ case 'Wired':
29
+ this.createDefaultPowerSourceWiredClusterServer();
30
+ break;
31
+ case 'None':
32
+ break;
33
+ }
34
+ this.createDefaultMomentarySwitchClusterServer();
35
+ createDefaultAudioCameraAvStreamManagementClusterServer(this, {
36
+ maxContentBufferSize,
37
+ maxNetworkBandwidth,
38
+ supportedStreamUsages,
39
+ streamUsagePriorities,
40
+ microphoneCapabilities,
41
+ });
42
+ createDefaultWebRtcTransportProviderClusterServer(this);
43
+ addChimeClient(this);
44
+ addWebRtcTransportRequestorClient(this);
45
+ this.addRequiredClusters();
46
+ }
47
+ }
48
+ export function createDefaultAudioCameraAvStreamManagementClusterServer(endpoint, options) {
49
+ endpoint.behaviors.require(MatterbridgeCameraAvStreamManagementServer.with(CameraAvStreamManagement.Feature.Audio, CameraAvStreamManagement.Feature.ImageControl), {
50
+ ...options,
51
+ hardPrivacyModeOn: false,
52
+ statusLightEnabled: false,
53
+ allocatedAudioStreams: [],
54
+ microphoneMuted: false,
55
+ microphoneVolumeLevel: 128,
56
+ microphoneMaxLevel: 254,
57
+ microphoneMinLevel: 0,
58
+ microphoneAgcEnabled: false,
59
+ imageRotation: 0,
60
+ imageFlipVertical: false,
61
+ imageFlipHorizontal: false,
62
+ });
63
+ return endpoint;
64
+ }
@@ -1,9 +1,8 @@
1
1
  import { camera, MatterbridgeEndpoint, powerSource } from 'matterbridge';
2
- import { MatterbridgeBindingServer } from 'matterbridge/behaviors';
3
- import { WebRtcTransportRequestorClient } from 'matterbridge/matter/behaviors';
4
- import { CameraAvStreamManagement, Identify, WebRtcTransportRequestor } from 'matterbridge/matter/clusters';
2
+ import { CameraAvStreamManagement, Identify } from 'matterbridge/matter/clusters';
5
3
  import { StreamUsage, ThreeLevelAuto } from 'matterbridge/matter/types';
6
4
  import { MatterbridgeCameraAvStreamManagementServer } from '../behaviors/cameraAvStreamManagementServer.js';
5
+ import { addWebRtcTransportRequestorClient } from '../behaviors/clients.js';
7
6
  import { MatterbridgeWebRtcTransportProviderServer } from '../behaviors/webRtcTransportProviderServer.js';
8
7
  export class Camera extends MatterbridgeEndpoint {
9
8
  constructor(name, serial, options = {}) {
@@ -11,8 +10,8 @@ export class Camera extends MatterbridgeEndpoint {
11
10
  { resolution: { width: 640, height: 480 }, maxFrameRate: 10, imageCodec: CameraAvStreamManagement.ImageCodec.Jpeg, requiresEncodedPixels: false },
12
11
  { resolution: { width: 1280, height: 720 }, maxFrameRate: 10, imageCodec: CameraAvStreamManagement.ImageCodec.Jpeg, requiresEncodedPixels: false },
13
12
  { resolution: { width: 1920, height: 1080 }, maxFrameRate: 10, imageCodec: CameraAvStreamManagement.ImageCodec.Jpeg, requiresEncodedPixels: false },
14
- ], allocatedSnapshotStreams = [], } = options;
15
- super(powerSourceType === 'None' ? [camera] : [camera, powerSource], { id: `${name.replaceAll(' ', '')}-${serial.replaceAll(' ', '')}` });
13
+ ], allocatedSnapshotStreams = [], id, number, tagList, mode, } = options;
14
+ super(powerSourceType === 'None' ? [camera] : [camera, powerSource], { id: id ?? `${name.replaceAll(' ', '')}-${serial.replaceAll(' ', '')}`, number, tagList, mode });
16
15
  if (identifyType !== Identify.IdentifyType.None) {
17
16
  this.createDefaultIdentifyClusterServer(identifyTime, identifyType);
18
17
  }
@@ -78,8 +77,3 @@ export function createDefaultWebRtcTransportProviderClusterServer(endpoint) {
78
77
  endpoint.behaviors.require(MatterbridgeWebRtcTransportProviderServer, { currentSessions: [] });
79
78
  return endpoint;
80
79
  }
81
- export function addWebRtcTransportRequestorClient(endpoint) {
82
- endpoint.behaviors.require(MatterbridgeBindingServer, { clientList: [WebRtcTransportRequestor.id] });
83
- endpoint.type.clientClusters['webRtcTransportRequestor'] ??= WebRtcTransportRequestorClient;
84
- return endpoint;
85
- }
@@ -8,8 +8,8 @@ export class Chime extends MatterbridgeEndpoint {
8
8
  chimeId: 0,
9
9
  name: 'Default Chime',
10
10
  },
11
- ], selectedChime = 0, enabled = true, } = options;
12
- super(powerSourceType === 'None' ? [chime] : [chime, powerSource], { id: `${name.replaceAll(' ', '')}-${serial.replaceAll(' ', '')}` });
11
+ ], selectedChime = 0, enabled = true, id, number, tagList, mode, } = options;
12
+ super(powerSourceType === 'None' ? [chime] : [chime, powerSource], { id: id ?? `${name.replaceAll(' ', '')}-${serial.replaceAll(' ', '')}`, number, tagList, mode });
13
13
  if (identifyType !== Identify.IdentifyType.None) {
14
14
  this.createDefaultIdentifyClusterServer(identifyTime, identifyType);
15
15
  }
@@ -1,11 +1,10 @@
1
1
  import { doorbell, MatterbridgeEndpoint, powerSource } from 'matterbridge';
2
- import { MatterbridgeBindingServer } from 'matterbridge/behaviors';
3
- import { ChimeClient } from 'matterbridge/matter/behaviors';
4
- import { Chime, Identify } from 'matterbridge/matter/clusters';
2
+ import { Identify } from 'matterbridge/matter/clusters';
3
+ import { addChimeClient } from '../behaviors/clients.js';
5
4
  export class Doorbell extends MatterbridgeEndpoint {
6
5
  constructor(name, serial, options = {}) {
7
- const { identifyTime = 0, identifyType = Identify.IdentifyType.None, powerSourceType = 'Wired' } = options;
8
- super(powerSourceType === 'None' ? [doorbell] : [doorbell, powerSource], { id: `${name.replaceAll(' ', '')}-${serial.replaceAll(' ', '')}` });
6
+ const { identifyTime = 0, identifyType = Identify.IdentifyType.None, powerSourceType = 'Wired', id, number, tagList, mode } = options;
7
+ super(powerSourceType === 'None' ? [doorbell] : [doorbell, powerSource], { id: id ?? `${name.replaceAll(' ', '')}-${serial.replaceAll(' ', '')}`, number, tagList, mode });
9
8
  this.createDefaultIdentifyClusterServer(identifyTime, identifyType);
10
9
  this.createDefaultBasicInformationClusterServer(name, serial, 0xfff1, 'Matterbridge', 0x8000, 'Matterbridge Doorbell');
11
10
  switch (powerSourceType) {
@@ -25,8 +24,7 @@ export class Doorbell extends MatterbridgeEndpoint {
25
24
  break;
26
25
  }
27
26
  this.createDefaultMomentarySwitchClusterServer();
28
- this.behaviors.require(MatterbridgeBindingServer, { clientList: [Chime.id] });
29
- this.type.clientClusters['chime'] ??= ChimeClient;
27
+ addChimeClient(this);
30
28
  this.addRequiredClusters();
31
29
  }
32
30
  }
@@ -0,0 +1,76 @@
1
+ import { camera, floodlightCamera, MatterbridgeEndpoint, onOffLight, powerSource } from 'matterbridge';
2
+ import { CameraAvStreamManagement, Identify } from 'matterbridge/matter/clusters';
3
+ import { StreamUsage } from 'matterbridge/matter/types';
4
+ import { fireAndForget } from 'matterbridge/utils';
5
+ import { addWebRtcTransportRequestorClient } from '../behaviors/clients.js';
6
+ import { createDefaultWebRtcTransportProviderClusterServer } from '../behaviors/webRtcTransportProviderServer.js';
7
+ import { createDefaultCameraAvStreamManagementClusterServer } from './camera.js';
8
+ export class FloodlightCamera extends MatterbridgeEndpoint {
9
+ constructor(name, serial, options = {}) {
10
+ const { powerSourceType = 'Wired', cameraOptions = {}, lightOptions = {}, id, number, tagList, mode } = options;
11
+ super(powerSourceType === 'None' ? [floodlightCamera] : [floodlightCamera, powerSource], {
12
+ id: id ?? `${name.replaceAll(' ', '')}-${serial.replaceAll(' ', '')}`,
13
+ number,
14
+ tagList,
15
+ mode,
16
+ });
17
+ this.createDefaultBasicInformationClusterServer(name, serial, 0xfff1, 'Matterbridge', 0x8000, 'Matterbridge Floodlight Camera');
18
+ switch (powerSourceType) {
19
+ case 'Rechargeable':
20
+ this.createDefaultPowerSourceRechargeableBatteryClusterServer();
21
+ break;
22
+ case 'Replaceable':
23
+ this.createDefaultPowerSourceReplaceableBatteryClusterServer();
24
+ break;
25
+ case 'Battery':
26
+ this.createDefaultPowerSourceBatteryClusterServer();
27
+ break;
28
+ case 'Wired':
29
+ this.createDefaultPowerSourceWiredClusterServer();
30
+ break;
31
+ case 'None':
32
+ break;
33
+ }
34
+ fireAndForget(this.addFixedLabel('composed', 'FloodlightCamera'), this.log, 'Error adding composed label to floodlight camera');
35
+ this.addRequiredClusters();
36
+ const { identifyTime = 0, identifyType = Identify.IdentifyType.None, maxContentBufferSize = 4_194_304, maxNetworkBandwidth = 10_000_000, supportedStreamUsages = [StreamUsage.LiveView, StreamUsage.Recording], streamUsagePriorities = supportedStreamUsages, maxConcurrentEncoders = 1, maxEncodedPixelRate = 1920 * 1080 * 30, videoSensorParams = { sensorWidth: 1920, sensorHeight: 1080, maxFps: 30 }, minViewportResolution = { width: 640, height: 360 }, rateDistortionTradeOffPoints = [{ codec: CameraAvStreamManagement.VideoCodec.H264, resolution: { width: 1920, height: 1080 }, minBitRate: 1_000_000 }], currentFrameRate = 30, viewport = { x1: 0, y1: 0, x2: videoSensorParams.sensorWidth, y2: videoSensorParams.sensorHeight }, microphoneCapabilities = { maxNumberOfChannels: 1, supportedCodecs: [CameraAvStreamManagement.AudioCodec.Opus], supportedSampleRates: [48000], supportedBitDepths: [16] }, snapshotCapabilities = [
37
+ { resolution: { width: 640, height: 480 }, maxFrameRate: 10, imageCodec: CameraAvStreamManagement.ImageCodec.Jpeg, requiresEncodedPixels: false },
38
+ { resolution: { width: 1280, height: 720 }, maxFrameRate: 10, imageCodec: CameraAvStreamManagement.ImageCodec.Jpeg, requiresEncodedPixels: false },
39
+ { resolution: { width: 1920, height: 1080 }, maxFrameRate: 10, imageCodec: CameraAvStreamManagement.ImageCodec.Jpeg, requiresEncodedPixels: false },
40
+ ], allocatedSnapshotStreams = [], } = cameraOptions;
41
+ const cameraChild = this.addChildDeviceType('Camera', camera, {});
42
+ cameraChild.log.logName = 'Camera';
43
+ if (identifyType !== Identify.IdentifyType.None) {
44
+ cameraChild.createDefaultIdentifyClusterServer(identifyTime, identifyType);
45
+ }
46
+ createDefaultCameraAvStreamManagementClusterServer(cameraChild, {
47
+ maxContentBufferSize,
48
+ maxNetworkBandwidth,
49
+ supportedStreamUsages,
50
+ streamUsagePriorities,
51
+ maxConcurrentEncoders,
52
+ maxEncodedPixelRate,
53
+ videoSensorParams,
54
+ minViewportResolution,
55
+ rateDistortionTradeOffPoints,
56
+ currentFrameRate,
57
+ viewport,
58
+ microphoneCapabilities,
59
+ snapshotCapabilities,
60
+ allocatedSnapshotStreams,
61
+ });
62
+ createDefaultWebRtcTransportProviderClusterServer(cameraChild);
63
+ addWebRtcTransportRequestorClient(cameraChild);
64
+ cameraChild.addRequiredClusters();
65
+ const { name: lightName = 'Light', tagList: lightTagList = [], onOff: lightOnOff = false } = lightOptions;
66
+ this.addLight(lightName, lightTagList, lightOnOff);
67
+ }
68
+ addLight(name, tagList = [], onOff = false) {
69
+ const light = this.addChildDeviceType(name, onOffLight, tagList.length > 0 ? { tagList } : {});
70
+ light.log.logName = name;
71
+ light.createDefaultIdentifyClusterServer();
72
+ light.createDefaultOnOffClusterServer(onOff);
73
+ light.addRequiredClusters();
74
+ return light;
75
+ }
76
+ }
@@ -8,8 +8,13 @@ export class SnapshotCamera extends MatterbridgeEndpoint {
8
8
  { resolution: { width: 640, height: 480 }, maxFrameRate: 10, imageCodec: CameraAvStreamManagement.ImageCodec.Jpeg, requiresEncodedPixels: false },
9
9
  { resolution: { width: 1280, height: 720 }, maxFrameRate: 10, imageCodec: CameraAvStreamManagement.ImageCodec.Jpeg, requiresEncodedPixels: false },
10
10
  { resolution: { width: 1920, height: 1080 }, maxFrameRate: 10, imageCodec: CameraAvStreamManagement.ImageCodec.Jpeg, requiresEncodedPixels: false },
11
- ], maxNetworkBandwidth = 10000, supportedStreamUsages = [StreamUsage.Recording], allocatedSnapshotStreams = [], streamUsagePriorities = [StreamUsage.Recording], } = options;
12
- super(powerSourceType === 'None' ? [snapshotCamera] : [snapshotCamera, powerSource], { id: `${name.replaceAll(' ', '')}-${serial.replaceAll(' ', '')}` });
11
+ ], maxNetworkBandwidth = 10000, supportedStreamUsages = [StreamUsage.Recording], allocatedSnapshotStreams = [], streamUsagePriorities = [StreamUsage.Recording], id, number, tagList, mode, } = options;
12
+ super(powerSourceType === 'None' ? [snapshotCamera] : [snapshotCamera, powerSource], {
13
+ id: id ?? `${name.replaceAll(' ', '')}-${serial.replaceAll(' ', '')}`,
14
+ number,
15
+ tagList,
16
+ mode,
17
+ });
13
18
  if (identifyType !== Identify.IdentifyType.None) {
14
19
  this.createDefaultIdentifyClusterServer(identifyTime, identifyType);
15
20
  }
package/dist/module.js CHANGED
@@ -1,16 +1,22 @@
1
1
  import './patches/objectSchemaInjectFieldFix.js';
2
2
  import { MatterbridgeDynamicPlatform } from 'matterbridge';
3
3
  import { Identify, Chime as ChimeCluster, PowerSource } from 'matterbridge/matter/clusters';
4
+ import { AudioDoorbell } from './devices/audioDoorbell.js';
4
5
  import { Camera } from './devices/camera.js';
5
6
  import { Chime } from './devices/chime.js';
6
7
  import { Doorbell } from './devices/doorbell.js';
8
+ import { FloodlightCamera } from './devices/floodlightCamera.js';
7
9
  import { SnapshotCamera } from './devices/snapshotCamera.js';
8
10
  export default function initializePlugin(matterbridge, log, config) {
9
11
  return new ExampleMatterbridgeCameraPlatform(matterbridge, log, config);
10
12
  }
11
13
  export class ExampleMatterbridgeCameraPlatform extends MatterbridgeDynamicPlatform {
14
+ config;
15
+ animationPhase = 0;
16
+ animationInterval;
12
17
  constructor(matterbridge, log, config) {
13
18
  super(matterbridge, log, config);
19
+ this.config = config;
14
20
  if (typeof this.verifyMatterbridgeVersion !== 'function' || !this.verifyMatterbridgeVersion('3.10.0')) {
15
21
  throw new Error(`This plugin requires Matterbridge version >= "3.10.0". Please update Matterbridge to the latest version in the frontend.`);
16
22
  }
@@ -38,7 +44,13 @@ export class ExampleMatterbridgeCameraPlatform extends MatterbridgeDynamicPlatfo
38
44
  powerSourceType: 'Replaceable',
39
45
  });
40
46
  await this.registerDevice(exampleDoorbell);
41
- const exampleSnapshotCamera = new SnapshotCamera('Snapshot Camera', 'SNAPSHOT-001', {
47
+ const exampleAudioDoorbell = new AudioDoorbell('Audio Doorbell', 'AUDIODOORBELL-001', {
48
+ identifyTime: 5,
49
+ identifyType: Identify.IdentifyType.VisibleIndicator,
50
+ powerSourceType: 'Replaceable',
51
+ });
52
+ await this.registerDevice(exampleAudioDoorbell);
53
+ const exampleSnapshotCamera = new SnapshotCamera('Snapshot Camera', 'SNAPSHOTCAMERA-001', {
42
54
  identifyTime: 5,
43
55
  identifyType: Identify.IdentifyType.VisibleIndicator,
44
56
  powerSourceType: 'Wired',
@@ -46,6 +58,16 @@ export class ExampleMatterbridgeCameraPlatform extends MatterbridgeDynamicPlatfo
46
58
  await this.registerDevice(exampleSnapshotCamera);
47
59
  const exampleCamera = new Camera('Camera', 'CAMERA-001');
48
60
  await this.registerDevice(exampleCamera);
61
+ const exampleFloodlightCamera = new FloodlightCamera('Floodlight Camera', 'FLOODLIGHTCAMERA-001', {
62
+ powerSourceType: 'Wired',
63
+ cameraOptions: { identifyTime: 5, identifyType: Identify.IdentifyType.VisibleIndicator },
64
+ lightOptions: { name: 'Floodlight' },
65
+ });
66
+ await this.registerDevice(exampleFloodlightCamera);
67
+ const serverChime = new Chime('Server Chime', 'SERVER-CHIME-001', { mode: 'server' });
68
+ await this.registerDevice(serverChime);
69
+ const serverDoorbell = new Doorbell('Server Doorbell', 'SERVER-DOORBELL-001', { mode: 'server' });
70
+ await this.registerDevice(serverDoorbell);
49
71
  this.log.info(`Platform ${this.config.name} started successfully`);
50
72
  }
51
73
  async onConfigure() {
@@ -59,14 +81,34 @@ export class ExampleMatterbridgeCameraPlatform extends MatterbridgeDynamicPlatfo
59
81
  const exampleDoorbell = this.getDeviceById('Doorbell-DOORBELL-001');
60
82
  if (!exampleDoorbell)
61
83
  throw new Error(`Doorbell device not found. Please ensure the device is registered before configuration.`);
62
- const exampleSnapshotCamera = this.getDeviceById('SnapshotCamera-SNAPSHOT-001');
84
+ const exampleAudioDoorbell = this.getDeviceById('AudioDoorbell-AUDIODOORBELL-001');
85
+ if (!exampleAudioDoorbell)
86
+ throw new Error(`Audio doorbell device not found. Please ensure the device is registered before configuration.`);
87
+ const exampleSnapshotCamera = this.getDeviceById('SnapshotCamera-SNAPSHOTCAMERA-001');
63
88
  if (!exampleSnapshotCamera)
64
89
  throw new Error(`Snapshot camera device not found. Please ensure the device is registered before configuration.`);
90
+ const exampleCamera = this.getDeviceById('Camera-CAMERA-001');
91
+ if (!exampleCamera)
92
+ throw new Error(`Camera device not found. Please ensure the device is registered before configuration.`);
93
+ const exampleFloodlightCamera = this.getDeviceById('FloodlightCamera-FLOODLIGHTCAMERA-001');
94
+ if (!exampleFloodlightCamera)
95
+ throw new Error(`Floodlight camera device not found. Please ensure the device is registered before configuration.`);
96
+ if (this.config.animationInterval > 0) {
97
+ clearInterval(this.animationInterval);
98
+ this.animationInterval = setInterval(() => void this.animationHandler(), this.config.animationInterval * 1000);
99
+ }
65
100
  this.log.info(`Platform ${this.config.name} configured successfully`);
66
101
  }
102
+ async animationHandler() {
103
+ this.animationPhase = this.animationPhase + 1;
104
+ this.animationPhase = this.animationPhase > 10 ? 0 : this.animationPhase;
105
+ this.log.info(`Platform ${this.config.name} animation phase: ${this.animationPhase}`);
106
+ }
67
107
  async onShutdown(reason) {
68
108
  await super.onShutdown(reason);
69
109
  this.log.info(`Shutting down platform ${this.config.name} with reason: ${reason ?? 'No reason provided'}...`);
110
+ clearInterval(this.animationInterval);
111
+ this.animationInterval = undefined;
70
112
  if (this.config.unregisterOnShutdown)
71
113
  await this.unregisterAllDevices();
72
114
  this.log.info(`Platform ${this.config.name} shut down successfully`);
@@ -1,8 +1,9 @@
1
1
  import { spawn } from 'node:child_process';
2
2
  import { createSocket } from 'node:dgram';
3
3
  import { constants } from 'node:fs';
4
- import { access } from 'node:fs/promises';
5
- import { RTCPeerConnection, RTCRtpCodecParameters } from 'werift';
4
+ import { access, readdir } from 'node:fs/promises';
5
+ import path from 'node:path';
6
+ import { RTCPeerConnection, RTCRtpCodecParameters, useH264, useOPUS, usePCMU, useVP8 } from 'werift';
6
7
  import { navigator } from 'werift/nonstandard';
7
8
  export class WeriftWebRtcSession {
8
9
  peerConnection;
@@ -12,7 +13,7 @@ export class WeriftWebRtcSession {
12
13
  testVideoUdpDisposer;
13
14
  testVideoAttached = false;
14
15
  constructor(logger, label = 'WebRTC session') {
15
- this.peerConnection = new RTCPeerConnection();
16
+ this.peerConnection = new RTCPeerConnection({ codecs: { audio: [useOPUS(), usePCMU()], video: [useVP8(), useH264()] } });
16
17
  this.logger = logger;
17
18
  this.label = label;
18
19
  this.log('debug', 'Created RTCPeerConnection');
@@ -52,8 +53,43 @@ export class WeriftWebRtcSession {
52
53
  }
53
54
  return false;
54
55
  }
56
+ async getWindowsCommandCandidates(command) {
57
+ if (process.platform !== 'win32')
58
+ return [];
59
+ const commandName = command.toLowerCase().replace(/\.exe$/, '');
60
+ const executable = command.toLowerCase().endsWith('.exe') ? command : `${command}.exe`;
61
+ const candidates = [];
62
+ if (commandName === 'ffmpeg' && process.env.LOCALAPPDATA) {
63
+ const wingetPackages = path.join(process.env.LOCALAPPDATA, 'Microsoft', 'WinGet', 'Packages');
64
+ try {
65
+ const packageDirs = await readdir(wingetPackages, { withFileTypes: true });
66
+ for (const packageDir of packageDirs) {
67
+ if (!packageDir.isDirectory() || !packageDir.name.startsWith('Gyan.FFmpeg_'))
68
+ continue;
69
+ const packagePath = path.join(wingetPackages, packageDir.name);
70
+ try {
71
+ const versionDirs = await readdir(packagePath, { withFileTypes: true });
72
+ for (const versionDir of versionDirs) {
73
+ if (versionDir.isDirectory() && versionDir.name.startsWith('ffmpeg-'))
74
+ candidates.push(path.join(packagePath, versionDir.name, 'bin', executable));
75
+ }
76
+ }
77
+ catch {
78
+ }
79
+ }
80
+ }
81
+ catch {
82
+ }
83
+ }
84
+ for (const programFiles of [process.env.ProgramFiles, process.env['ProgramFiles(x86)']]) {
85
+ if (!programFiles)
86
+ continue;
87
+ candidates.push(path.join(programFiles, 'ffmpeg', 'bin', executable), path.join(programFiles, 'Gyan', 'FFmpeg', 'bin', executable));
88
+ }
89
+ return candidates;
90
+ }
55
91
  async resolveCommand(command) {
56
- const candidates = [command, `/usr/bin/${command}`, `/bin/${command}`, `/usr/local/bin/${command}`];
92
+ const candidates = [command, `/usr/bin/${command}`, `/bin/${command}`, `/usr/local/bin/${command}`, ...(await this.getWindowsCommandCandidates(command))];
57
93
  for (const candidate of candidates) {
58
94
  if (candidate.includes('/')) {
59
95
  try {
@@ -0,0 +1,9 @@
1
+ {
2
+ "name": "matterbridge-example-camera",
3
+ "type": "DynamicPlatform",
4
+ "whiteList": [],
5
+ "blackList": [],
6
+ "animationInterval": 60,
7
+ "debug": false,
8
+ "unregisterOnShutdown": false
9
+ }
@@ -0,0 +1,58 @@
1
+ {
2
+ "title": "Matterbridge example camera plugin",
3
+ "description": "matterbridge-example-camera v. 1.0.0 by https://github.com/Luligu",
4
+ "type": "object",
5
+ "required": [],
6
+ "properties": {
7
+ "name": {
8
+ "description": "Plugin Name",
9
+ "type": "string",
10
+ "readOnly": true,
11
+ "ui:widget": "hidden"
12
+ },
13
+ "type": {
14
+ "description": "Plugin Type",
15
+ "type": "string",
16
+ "readOnly": true,
17
+ "ui:widget": "hidden"
18
+ },
19
+ "whiteList": {
20
+ "title": "White List",
21
+ "description": "Only the devices in the list will be exposed. If the list is empty, all the devices will be exposed.",
22
+ "type": "array",
23
+ "items": {
24
+ "type": "string"
25
+ },
26
+ "uniqueItems": true,
27
+ "selectFrom": "name"
28
+ },
29
+ "blackList": {
30
+ "title": "Black List",
31
+ "description": "The devices in the list will not be exposed. If the list is empty, no devices will be excluded.",
32
+ "type": "array",
33
+ "items": {
34
+ "type": "string"
35
+ },
36
+ "uniqueItems": true,
37
+ "selectFrom": "name"
38
+ },
39
+ "animationInterval": {
40
+ "title": "Animation Interval",
41
+ "description": "Interval to refresh the devices (in seconds). Use 0 to disable the animation.",
42
+ "type": "number",
43
+ "default": 60
44
+ },
45
+ "debug": {
46
+ "title": "Enable Debug",
47
+ "description": "Enable the debug for the plugin (development only)",
48
+ "type": "boolean",
49
+ "default": false
50
+ },
51
+ "unregisterOnShutdown": {
52
+ "title": "Unregister On Shutdown",
53
+ "description": "Unregister all devices on shutdown (development only)",
54
+ "type": "boolean",
55
+ "default": false
56
+ }
57
+ }
58
+ }
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "matterbridge-example-camera",
3
- "version": "0.0.4",
3
+ "version": "0.0.6-dev-20260721-4f7106a",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "matterbridge-example-camera",
9
- "version": "0.0.4",
9
+ "version": "0.0.6-dev-20260721-4f7106a",
10
10
  "license": "Apache-2.0",
11
11
  "dependencies": {
12
12
  "node-ansi-logger": "3.3.0",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "matterbridge-example-camera",
3
- "version": "0.0.4",
3
+ "version": "0.0.6-dev-20260721-4f7106a",
4
4
  "description": "Matterbridge camera example plugin",
5
5
  "author": "https://github.com/Luligu",
6
6
  "license": "Apache-2.0",