scrypted-kasa 1.0.0 → 1.0.1
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/package.json +1 -1
- package/src/camera/stream.ts +13 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "scrypted-kasa",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "TP-Link Kasa plugin for Scrypted — cameras (video, two-way audio, spotlight, siren, status LED), plugs/outlets, wall switches, dimmers, and smart bulbs (on/off, brightness, color, color temperature).",
|
|
5
5
|
"author": "Sergey Vilgelm <sergey@vilgelm.com>",
|
|
6
6
|
"license": "MIT",
|
package/src/camera/stream.ts
CHANGED
|
@@ -278,6 +278,19 @@ export async function spawnKasaStream(opts: KasaStreamOptions): Promise<KasaStre
|
|
|
278
278
|
const videoPipe = cp.stdio[3] as Writable;
|
|
279
279
|
const audioPipe = cp.stdio[4] as Writable;
|
|
280
280
|
|
|
281
|
+
// Attach 'error' listeners on both pipes IMMEDIATELY. When cleanupAll calls cp.kill,
|
|
282
|
+
// ffmpeg's stdio FDs close forcibly and any in-flight pump write throws ECONNRESET /
|
|
283
|
+
// EPIPE on the writable side. Without listeners, Node turns those into
|
|
284
|
+
// uncaughtException and crashes the whole plugin worker (taking down every camera).
|
|
285
|
+
// The `_e` arg is intentional — we just want the stream to be informed there's a
|
|
286
|
+
// listener.
|
|
287
|
+
videoPipe.on('error', _e => {
|
|
288
|
+
/* tear down via the kasa pump's own try/finally */
|
|
289
|
+
});
|
|
290
|
+
audioPipe.on('error', _e => {
|
|
291
|
+
/* tear down via the kasa pump's own try/finally */
|
|
292
|
+
});
|
|
293
|
+
|
|
281
294
|
let resolveExited!: () => void;
|
|
282
295
|
const exited = new Promise<void>(r => {
|
|
283
296
|
resolveExited = r;
|