Skip to content

Commit

Permalink
homekit: handle mp4 generation shutdown
Browse files Browse the repository at this point in the history
  • Loading branch information
koush committed Apr 15, 2024
1 parent f0e85f1 commit 69fd86a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
4 changes: 2 additions & 2 deletions plugins/homekit/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion plugins/homekit/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@scrypted/homekit",
"version": "1.2.49",
"version": "1.2.50",
"description": "HomeKit Plugin for Scrypted",
"scripts": {
"scrypted-setup-project": "scrypted-setup-project",
Expand Down
6 changes: 4 additions & 2 deletions plugins/homekit/src/types/camera.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ addSupportedType({
const isRecordingEnabled = device.interfaces.includes(ScryptedInterface.MotionSensor);

let configuration: CameraRecordingConfiguration;
const openRecordingStreams = new Set<number>();
const openRecordingStreams = new Map<number, AsyncGenerator<RecordingPacket>>();
if (isRecordingEnabled) {
recordingDelegate = {
updateRecordingConfiguration(newConfiguration: CameraRecordingConfiguration) {
Expand All @@ -112,10 +112,12 @@ addSupportedType({
handleRecordingStreamRequest(streamId: number): AsyncGenerator<RecordingPacket> {
const ret = handleFragmentsRequests(streamId, device, configuration, console, homekitPlugin,
() => openRecordingStreams.has(streamId));
openRecordingStreams.add(streamId);
openRecordingStreams.set(streamId, ret);
return ret;
},
closeRecordingStream(streamId, reason) {
const r = openRecordingStreams.get(streamId);
r?.throw(new Error(reason?.toString()));
openRecordingStreams.delete(streamId);
},
updateRecordingActive(active) {
Expand Down

0 comments on commit 69fd86a

Please sign in to comment.