homebridge-unifi-protect 5.5.4 → 6.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/README.md +3 -3
- package/config.schema.json +17 -16
- package/dist/index.d.ts +3 -0
- package/dist/index.js +6 -6
- package/dist/index.js.map +1 -1
- package/dist/protect-camera.d.ts +58 -0
- package/dist/protect-camera.js +367 -246
- package/dist/protect-camera.js.map +1 -1
- package/dist/protect-device.d.ts +48 -0
- package/dist/protect-device.js +189 -0
- package/dist/protect-device.js.map +1 -0
- package/dist/protect-doorbell.d.ts +22 -0
- package/dist/protect-doorbell.js +75 -64
- package/dist/protect-doorbell.js.map +1 -1
- package/dist/protect-ffmpeg-record.d.ts +15 -0
- package/dist/protect-ffmpeg-record.js +48 -34
- package/dist/protect-ffmpeg-record.js.map +1 -1
- package/dist/protect-ffmpeg-stream.d.ts +15 -0
- package/dist/protect-ffmpeg-stream.js +22 -12
- package/dist/protect-ffmpeg-stream.js.map +1 -1
- package/dist/protect-ffmpeg.d.ts +42 -0
- package/dist/protect-ffmpeg.js +49 -58
- package/dist/protect-ffmpeg.js.map +1 -1
- package/dist/protect-light.d.ts +13 -0
- package/dist/protect-light.js +63 -40
- package/dist/protect-light.js.map +1 -1
- package/dist/protect-liveviews.d.ts +17 -0
- package/dist/protect-liveviews.js +117 -101
- package/dist/protect-liveviews.js.map +1 -1
- package/dist/protect-mqtt.d.ts +19 -0
- package/dist/protect-mqtt.js +26 -35
- package/dist/protect-mqtt.js.map +1 -1
- package/dist/protect-nvr-events.d.ts +30 -0
- package/dist/protect-nvr-events.js +168 -431
- package/dist/protect-nvr-events.js.map +1 -1
- package/dist/protect-nvr-systeminfo.d.ts +15 -0
- package/dist/protect-nvr-systeminfo.js +43 -49
- package/dist/protect-nvr-systeminfo.js.map +1 -1
- package/dist/protect-nvr.d.ts +48 -0
- package/dist/protect-nvr.js +327 -359
- package/dist/protect-nvr.js.map +1 -1
- package/dist/protect-options.d.ts +39 -0
- package/dist/protect-options.js +172 -6
- package/dist/protect-options.js.map +1 -1
- package/dist/protect-platform.d.ts +17 -0
- package/dist/protect-platform.js +17 -30
- package/dist/protect-platform.js.map +1 -1
- package/dist/protect-record.d.ts +33 -0
- package/dist/protect-record.js +130 -126
- package/dist/protect-record.js.map +1 -1
- package/dist/protect-rtp.d.ts +29 -0
- package/dist/protect-rtp.js +133 -16
- package/dist/protect-rtp.js.map +1 -1
- package/dist/protect-securitysystem.d.ts +18 -0
- package/dist/protect-securitysystem.js +105 -109
- package/dist/protect-securitysystem.js.map +1 -1
- package/dist/protect-sensor.d.ts +28 -0
- package/dist/protect-sensor.js +79 -97
- package/dist/protect-sensor.js.map +1 -1
- package/dist/protect-stream.d.ts +41 -0
- package/dist/protect-stream.js +298 -156
- package/dist/protect-stream.js.map +1 -1
- package/dist/protect-timeshift.d.ts +30 -0
- package/dist/protect-timeshift.js +65 -48
- package/dist/protect-timeshift.js.map +1 -1
- package/dist/protect-types.d.ts +50 -0
- package/dist/protect-types.js +22 -0
- package/dist/protect-types.js.map +1 -0
- package/dist/protect-viewer.d.ts +17 -0
- package/dist/protect-viewer.js +41 -47
- package/dist/protect-viewer.js.map +1 -1
- package/dist/settings.d.ts +22 -0
- package/dist/settings.js +30 -35
- package/dist/settings.js.map +1 -1
- package/homebridge-ui/public/index.html +715 -0
- package/homebridge-ui/server.js +156 -0
- package/package.json +15 -15
- package/dist/protect-accessory.js +0 -184
- package/dist/protect-accessory.js.map +0 -1
package/dist/protect-record.js
CHANGED
|
@@ -1,101 +1,67 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.ProtectRecordingDelegate = void 0;
|
|
4
|
-
const protect_ffmpeg_record_1 = require("./protect-ffmpeg-record");
|
|
5
|
-
const protect_timeshift_1 = require("./protect-timeshift");
|
|
1
|
+
import { FfmpegRecordingProcess } from "./protect-ffmpeg-record.js";
|
|
2
|
+
import { ProtectTimeshiftBuffer } from "./protect-timeshift.js";
|
|
6
3
|
// Camera recording delegate implementation for Protect.
|
|
7
|
-
class ProtectRecordingDelegate {
|
|
4
|
+
export class ProtectRecordingDelegate {
|
|
8
5
|
// Create an instance of the HKSV recording delegate.
|
|
9
6
|
constructor(protectCamera) {
|
|
10
|
-
var _a;
|
|
11
7
|
this._isRecording = false;
|
|
12
8
|
this.accessory = protectCamera.accessory;
|
|
13
9
|
this.api = protectCamera.api;
|
|
14
10
|
this.hap = protectCamera.api.hap;
|
|
15
|
-
this.debug = protectCamera.platform.debug.bind(protectCamera.platform);
|
|
16
11
|
this.ffmpegStream = null;
|
|
17
12
|
this.isInitialized = false;
|
|
18
13
|
this.isTransmitting = false;
|
|
19
|
-
this.log = protectCamera.
|
|
20
|
-
this.name = protectCamera.name.bind(protectCamera);
|
|
14
|
+
this.log = protectCamera.log;
|
|
21
15
|
this.nvr = protectCamera.nvr;
|
|
22
16
|
this.protectCamera = protectCamera;
|
|
23
|
-
this.maxRecordingDuration = parseInt(
|
|
17
|
+
this.maxRecordingDuration = parseInt(this.nvr.optionGet(this.protectCamera.ufp, "Video.HKSV.Recording.MaxDuration") ?? "0");
|
|
24
18
|
this.timeshiftedSegments = 0;
|
|
25
19
|
this.transmittedSegments = 0;
|
|
26
20
|
this.rtspEntry = null;
|
|
27
|
-
this.timeshift = new
|
|
21
|
+
this.timeshift = new ProtectTimeshiftBuffer(protectCamera);
|
|
28
22
|
this.transmitListener = null;
|
|
29
23
|
}
|
|
30
24
|
// Process HomeKit requests to activate or deactivate HKSV recording capabilities for a camera.
|
|
31
25
|
async updateRecordingActive(active) {
|
|
32
|
-
var _a, _b, _c;
|
|
33
26
|
// If we are no longer recording, stop the livestream.
|
|
34
27
|
if (!active) {
|
|
35
28
|
this.timeshift.stop();
|
|
36
29
|
// Inform the user of the state change, if needed.
|
|
37
30
|
if (this.isRecording !== active) {
|
|
38
|
-
this.log.info("
|
|
31
|
+
this.log.info("Disabling HomeKit Secure Video event recording.");
|
|
39
32
|
}
|
|
40
33
|
// Disable recording.
|
|
41
34
|
this._isRecording = active;
|
|
42
35
|
// Turn off any potential inflight motion detection. Strictly speaking, this shouldn't be needed since any inflight
|
|
43
36
|
// motion sensor events will clear themselves. That said, we play it safe just the same.
|
|
44
|
-
|
|
37
|
+
this.accessory.getService(this.hap.Service.MotionSensor)?.updateCharacteristic(this.hap.Characteristic.MotionDetected, false);
|
|
45
38
|
// We're done.
|
|
46
39
|
return;
|
|
47
40
|
}
|
|
48
|
-
// We
|
|
49
|
-
//
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
}
|
|
54
|
-
// Figure out which camera channel we should use for the livestream based on the requested resolution.
|
|
55
|
-
this.rtspEntry = this.protectCamera.findRecordingRtsp(this.recordingConfig.videoCodec.resolution[0], this.recordingConfig.videoCodec.resolution[1], this.accessory.context.device);
|
|
56
|
-
if (!this.rtspEntry) {
|
|
57
|
-
this._isRecording = false;
|
|
58
|
-
this.log.error("%s: Unable to start the HomeKit Secure Video timeshift buffer: no valid RTSP stream profile was found.", this.name());
|
|
41
|
+
// We're recording - update our recording state internally. We set this regardless of whether or not we succeed at starting the
|
|
42
|
+
// timeshift buffer in order to maintain our state consistent with HKSV.
|
|
43
|
+
this._isRecording = active;
|
|
44
|
+
// Begin maintaining a timeshift buffer, if configured to do so.
|
|
45
|
+
if (!(await this.configureTimeshifting())) {
|
|
59
46
|
return;
|
|
60
47
|
}
|
|
61
|
-
// If the user has disabled timeshifting, don't start the timeshift buffer.
|
|
62
|
-
if (this.nvr.optionEnabled(this.accessory.context.device, "Video.HKSV.TimeshiftBuffer")) {
|
|
63
|
-
if (!this.recordingConfig || !this.rtspEntry) {
|
|
64
|
-
return;
|
|
65
|
-
}
|
|
66
|
-
// Set the bitrate to what HomeKit is looking for. This is particularly useful when we occasionally have
|
|
67
|
-
// to livestream to a user, where bitrates can be different and even get reconfigured in realtime. By
|
|
68
|
-
// contrast, HomeKit Secure Video has a consistent bitrate it accepts, and we want to try to match it as
|
|
69
|
-
// closely as posible.
|
|
70
|
-
if (!(await this.protectCamera.setBitrate(this.rtspEntry.channel.id, this.recordingConfig.videoCodec.parameters.bitRate * 1000))) {
|
|
71
|
-
this.log.error("%s: Unable to set the bitrate to %skbps for HomeKit Secure Video event recording.", this.name(), this.recordingConfig.videoCodec.parameters.bitRate);
|
|
72
|
-
return;
|
|
73
|
-
}
|
|
74
|
-
// Fire up the timeshift buffer.
|
|
75
|
-
if (!(await this.timeshift.start(this.rtspEntry.channel.id))) {
|
|
76
|
-
this.log.error("%s: Unable to start the timeshift buffer for HomeKit Secure Video.", this.name());
|
|
77
|
-
return;
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
48
|
// Inform the user of the state change, if needed.
|
|
81
|
-
if (
|
|
49
|
+
if (!this.isInitialized) {
|
|
82
50
|
this.isInitialized = true;
|
|
83
|
-
this.log.info("
|
|
51
|
+
this.log.info("HomeKit Secure Video event recording enabled: %s, %s kbps with %s", this.rtspEntry?.name, this.recordingConfig?.videoCodec.parameters.bitRate, this.protectCamera.hints.timeshift ?
|
|
84
52
|
"a " + (this.timeshift.length / 1000).toString() + " second timeshift buffer." :
|
|
85
|
-
"no timeshift buffer.
|
|
53
|
+
"no timeshift buffer. This will provide a suboptimal HKSV experience.");
|
|
86
54
|
// Inform the user if there's a maximum event recording duration set.
|
|
87
55
|
if (this.maxRecordingDuration) {
|
|
88
|
-
this.log.info("
|
|
56
|
+
this.log.info("HomeKit Secure Video recordings will be no longer than ~%s seconds.", this.maxRecordingDuration);
|
|
89
57
|
}
|
|
90
58
|
}
|
|
91
|
-
// Update our recording state internally.
|
|
92
|
-
this._isRecording = active;
|
|
93
59
|
}
|
|
94
60
|
// Process updated recording configuration settings from HomeKit Secure Video.
|
|
95
61
|
updateRecordingConfiguration(configuration) {
|
|
96
|
-
// If we're set to an undefined state, it's because HomeKit can't figure out a valid configuration to use.
|
|
97
|
-
//
|
|
98
|
-
//
|
|
62
|
+
// If we're set to an undefined state, it's because HomeKit can't figure out a valid configuration to use. This is
|
|
63
|
+
// typically due to a factory reset of the camera or a similar edge case. We choose to handle it by stopping our
|
|
64
|
+
// timeshift buffer.
|
|
99
65
|
if (!configuration) {
|
|
100
66
|
this.recordingConfig = configuration;
|
|
101
67
|
this.timeshift.stop();
|
|
@@ -111,26 +77,29 @@ class ProtectRecordingDelegate {
|
|
|
111
77
|
// Handle the actual recording stream request.
|
|
112
78
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
113
79
|
async *handleRecordingStreamRequest(streamId) {
|
|
114
|
-
var _a, _b;
|
|
115
80
|
let isLastSegment = false;
|
|
116
81
|
this.transmittedSegments = 0;
|
|
117
|
-
// If we
|
|
118
|
-
//
|
|
119
|
-
if (
|
|
82
|
+
// If we are recording HKSV events and we haven't fully initialized our timeshift buffer (e.g. offline cameras preventing us
|
|
83
|
+
// from doing so), then do so now.
|
|
84
|
+
if (this.accessory.context.hksvRecording && this.isRecording && !this.isInitialized) {
|
|
85
|
+
await this.updateRecordingActive(this.isRecording);
|
|
86
|
+
}
|
|
87
|
+
// If we've explicitly disabled HKSV recording, or we have issues setting up our timeshift buffer, we're done right now. Otherwise,
|
|
88
|
+
// start transmitting our timeshift buffer and process it through FFmpeg.
|
|
89
|
+
if (!this.accessory.context.hksvRecording || !this.isInitialized || !(await this.startTransmitting()) || !this.ffmpegStream) {
|
|
120
90
|
// Stop transmitting, if needed. If HKSV recording has been disabled explicitly, it should never start in the first place.
|
|
121
|
-
this.stopTransmitting();
|
|
91
|
+
await this.stopTransmitting();
|
|
122
92
|
// Something's gone wrong, or we've disabled HKSV recording. In either event, we send an fMP4 stream header
|
|
123
93
|
// back to HKSV and exit as cleanly as we can. If we can't get the stream header, we still send an empty segment
|
|
124
94
|
// to HKSV - this will still generate a warning in Homebridge that can be ignored.
|
|
125
|
-
|
|
126
|
-
yield { data: streamHeader, isLast: true };
|
|
95
|
+
yield { data: (await this.timeshift.getInitSegment()) ?? Buffer.alloc(0), isLast: true };
|
|
127
96
|
return;
|
|
128
97
|
}
|
|
129
98
|
// Process our FFmpeg-generated segments and send them back to HKSV.
|
|
130
99
|
for await (const segment of this.ffmpegStream.segmentGenerator()) {
|
|
131
100
|
// If we've not transmitting, we're done.
|
|
132
101
|
if (!this.isTransmitting) {
|
|
133
|
-
|
|
102
|
+
break;
|
|
134
103
|
}
|
|
135
104
|
// No segment doesn't mean we're done necessarily, but it does mean we need to wait for FFmpeg to catch up.
|
|
136
105
|
if (!segment) {
|
|
@@ -142,55 +111,74 @@ class ProtectRecordingDelegate {
|
|
|
142
111
|
if (this.maxRecordingDuration && this.rtspEntry && ((this.transmittedSegments * this.rtspEntry.channel.idrInterval) > this.maxRecordingDuration)) {
|
|
143
112
|
isLastSegment = true;
|
|
144
113
|
}
|
|
145
|
-
//
|
|
146
|
-
yield {
|
|
147
|
-
data: segment,
|
|
148
|
-
isLast: isLastSegment
|
|
149
|
-
};
|
|
150
|
-
// Keep track of how many segments we've sent to HKSV.
|
|
114
|
+
// Keep track of how many segments we're sending to HKSV.
|
|
151
115
|
this.transmittedSegments++;
|
|
152
|
-
//
|
|
116
|
+
// Send HKSV the fMP4 segment.
|
|
117
|
+
yield { data: segment, isLast: isLastSegment };
|
|
118
|
+
// If we're at the last segment, we're done.
|
|
153
119
|
if (isLastSegment) {
|
|
154
|
-
|
|
120
|
+
break;
|
|
155
121
|
}
|
|
156
122
|
}
|
|
157
|
-
// If we're done transmitting, we're done here.
|
|
158
|
-
if (!this.isTransmitting) {
|
|
159
|
-
return;
|
|
160
|
-
}
|
|
161
|
-
// Something's gone wrong and we've sent HKSV no segments. Let's send an fMP4 stream header back to HKSV and exit
|
|
162
|
-
// as cleanly as we can. If we can't get the stream header, we send an empty segment to HKSV - this will still
|
|
163
|
-
// generate a warning in HAP-NodeJS that can be ignored.
|
|
164
|
-
if (!this.transmittedSegments) {
|
|
165
|
-
this.debug("%s: HKSV event recording ending without sending any segments. Transmitting a final packet to ensure we end properly.", this.name());
|
|
166
|
-
yield { data: (_b = (await this.timeshift.getInitSegment())) !== null && _b !== void 0 ? _b : Buffer.alloc(0), isLast: true };
|
|
167
|
-
return;
|
|
168
|
-
}
|
|
169
|
-
// Something likely happened to FFmpeg and we didn't send out a final segment. Tell HKSV we're really done.
|
|
170
|
-
if (!isLastSegment) {
|
|
171
|
-
this.log.error("%s: HKSV event recording ending abruptly, likely due to an FFmpeg failure. " +
|
|
172
|
-
"Transmitting a final packet to ensure we end properly. " +
|
|
173
|
-
"Note: Homebridge / HAP-NodeJS may generate an HDS error as a result. This can be safely ignored.", this.name());
|
|
174
|
-
yield { data: Buffer.alloc(0), isLast: true };
|
|
175
|
-
return;
|
|
176
|
-
}
|
|
177
123
|
}
|
|
178
124
|
// Receive an acknowledgement from HomeKit that it's seen an end-of-stream packet from us.
|
|
179
125
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
180
|
-
acknowledgeStream(streamId) {
|
|
126
|
+
async acknowledgeStream(streamId) {
|
|
181
127
|
// Since HomeKit knows our transmission is ending, it's safe to do so now.
|
|
182
|
-
this.stopTransmitting();
|
|
128
|
+
await this.stopTransmitting();
|
|
183
129
|
}
|
|
184
130
|
// Process HomeKit requests to end the transmission of the recording stream.
|
|
185
|
-
closeRecordingStream(streamId, reason) {
|
|
186
|
-
this.stopTransmitting(reason);
|
|
131
|
+
async closeRecordingStream(streamId, reason) {
|
|
132
|
+
await this.stopTransmitting(reason);
|
|
133
|
+
}
|
|
134
|
+
// Maintain a timeshift buffer and which Protect streams to use for HKSV.
|
|
135
|
+
async configureTimeshifting() {
|
|
136
|
+
// We have no recording configuration available yet. Even though HKSV recording is technically active, we can't do anything without
|
|
137
|
+
// a valid HKSV recording configuration, which HomeKit hasn't sent us yet.
|
|
138
|
+
if (!this.recordingConfig) {
|
|
139
|
+
return false;
|
|
140
|
+
}
|
|
141
|
+
const timeshiftError = "Unable to configure HomeKit Secure Video event recording support";
|
|
142
|
+
// If the camera isn't connected, don't attempt to do anything with the timeshift buffer or HKSV quite yet.
|
|
143
|
+
if (this.protectCamera.ufp.state !== "CONNECTED") {
|
|
144
|
+
this.log.error("%s: the camera is not currently connected to the Protect controller." +
|
|
145
|
+
" HomeKit Secure Video event recording will resume once the camera reconnects to the Protect controller.", timeshiftError);
|
|
146
|
+
return false;
|
|
147
|
+
}
|
|
148
|
+
const oldRtspEntry = this.rtspEntry;
|
|
149
|
+
// Figure out which camera channel we should use for the based on the HKSV-requested resolution.
|
|
150
|
+
this.rtspEntry = this.protectCamera.findRecordingRtsp(this.recordingConfig.videoCodec.resolution[0], this.recordingConfig.videoCodec.resolution[1], this.protectCamera.ufp);
|
|
151
|
+
if (!this.rtspEntry) {
|
|
152
|
+
this.log.error("%s: no valid RTSP stream profile was found for this camera.", timeshiftError);
|
|
153
|
+
return false;
|
|
154
|
+
}
|
|
155
|
+
// If we haven't enabled the timeshift buffer or HKSV hasn't asked us to record, we're done with everything we need to configure.
|
|
156
|
+
if (!this.protectCamera.hints.timeshift || !this.isRecording) {
|
|
157
|
+
return true;
|
|
158
|
+
}
|
|
159
|
+
// Set the bitrate to what HomeKit is looking for. This is particularly useful when we occasionally have to livestream to a user, where bitrates
|
|
160
|
+
// can be different and even get reconfigured in realtime. By contrast, HomeKit Secure Video has a consistent bitrate it accepts, and we want to
|
|
161
|
+
// try to match it as closely as posible, assuming dynamic bitrates are enabled.
|
|
162
|
+
if (!(await this.protectCamera.setBitrate(this.rtspEntry.channel.id, this.recordingConfig.videoCodec.parameters.bitRate * 1000))) {
|
|
163
|
+
this.log.error("%s: unable to set the bitrate to %skbps.", timeshiftError, this.recordingConfig.videoCodec.parameters.bitRate);
|
|
164
|
+
return false;
|
|
165
|
+
}
|
|
166
|
+
// If we haven't changed the camera channel we're using, and we've already started timeshifting, we're done.
|
|
167
|
+
if (this.timeshift.isStarted && (this.rtspEntry.channel.id === oldRtspEntry?.channel.id)) {
|
|
168
|
+
return true;
|
|
169
|
+
}
|
|
170
|
+
// Fire up the timeshift buffer.
|
|
171
|
+
if (!(await this.timeshift.start(this.rtspEntry.channel.id))) {
|
|
172
|
+
this.log.error("%s.", timeshiftError);
|
|
173
|
+
return false;
|
|
174
|
+
}
|
|
175
|
+
return true;
|
|
187
176
|
}
|
|
188
177
|
// Start transmitting to the HomeKit hub our timeshifted fMP4 stream.
|
|
189
178
|
async startTransmitting() {
|
|
190
|
-
var _a;
|
|
191
179
|
// If there's a prior instance of FFmpeg, clean up after ourselves.
|
|
192
180
|
if (this.ffmpegStream) {
|
|
193
|
-
this.ffmpegStream.stop();
|
|
181
|
+
this.ffmpegStream.stop(false);
|
|
194
182
|
this.ffmpegStream = null;
|
|
195
183
|
}
|
|
196
184
|
// If there's a prior instance of our transmit handler, clean it up.
|
|
@@ -202,28 +190,39 @@ class ProtectRecordingDelegate {
|
|
|
202
190
|
if (!this.recordingConfig || !this.rtspEntry) {
|
|
203
191
|
return false;
|
|
204
192
|
}
|
|
205
|
-
// We want to keep feeding HomeKit until it tells us it's finished, or we decide we don't want to send anymore
|
|
206
|
-
//
|
|
207
|
-
//
|
|
193
|
+
// We want to keep feeding HomeKit until it tells us it's finished, or we decide we don't want to send anymore fMP4 packets. We
|
|
194
|
+
// treat this in a similar way to how a DVR works where you can pause live television, but it continues to buffer what's being
|
|
195
|
+
// broadcast until you're ready to watch it. This is the same idea.
|
|
208
196
|
// Keep track of how many fMP4 segments we are feeding FFmpeg.
|
|
209
197
|
this.transmittedSegments = 0;
|
|
210
198
|
// Check to see if the user has audio enabled or disabled for recordings.
|
|
211
|
-
const isAudioActive =
|
|
199
|
+
const isAudioActive = this.protectCamera.stream.controller.recordingManagement?.recordingManagementService
|
|
200
|
+
.getCharacteristic(this.api.hap.Characteristic.RecordingAudioActive).value === 1 ? true : false;
|
|
212
201
|
// Start a new FFmpeg instance to transcode using HomeKit's requirements.
|
|
213
|
-
this.ffmpegStream = new
|
|
202
|
+
this.ffmpegStream = new FfmpegRecordingProcess(this.protectCamera, this.recordingConfig, this.rtspEntry, isAudioActive);
|
|
214
203
|
this.isTransmitting = true;
|
|
215
204
|
// Let the timeshift buffer know it's time to transmit and continue timeshifting.
|
|
216
|
-
if (this.
|
|
205
|
+
if (this.protectCamera.hints.timeshift) {
|
|
217
206
|
this.timeshiftedSegments = 0;
|
|
218
|
-
|
|
207
|
+
// Check to make sure something didn't go wrong when we start transmitting the stream.
|
|
208
|
+
if (!(await this.timeshift.startTransmitting())) {
|
|
209
|
+
// Stop our FFmpeg process and our timeshift buffer.
|
|
210
|
+
this.ffmpegStream.stop();
|
|
211
|
+
this.timeshift.stop();
|
|
212
|
+
// Ensure we cleanup.
|
|
213
|
+
this.ffmpegStream = null;
|
|
214
|
+
this.isTransmitting = false;
|
|
215
|
+
// Restart our timeshift buffer.
|
|
216
|
+
await this.restartTimeshifting();
|
|
217
|
+
return false;
|
|
218
|
+
}
|
|
219
219
|
let seenInitSegment = false;
|
|
220
220
|
// Listen in for events from the timeshift buffer and feed FFmpeg. This looks simple, conceptually,
|
|
221
221
|
// but there's a lot going on here.
|
|
222
222
|
this.transmitListener = (segment) => {
|
|
223
|
-
var _a, _b, _c, _d;
|
|
224
223
|
if (!seenInitSegment && this.timeshift.isInitSegment(segment)) {
|
|
225
224
|
seenInitSegment = true;
|
|
226
|
-
|
|
225
|
+
this.ffmpegStream?.stdin?.write(segment);
|
|
227
226
|
return;
|
|
228
227
|
}
|
|
229
228
|
// We don't want to send the initialization segment more than once - FFmpeg will get confused if you do, plus
|
|
@@ -232,26 +231,26 @@ class ProtectRecordingDelegate {
|
|
|
232
231
|
return;
|
|
233
232
|
}
|
|
234
233
|
// Send the segment to FFmpeg for processing.
|
|
235
|
-
|
|
234
|
+
this.ffmpegStream?.stdin?.write(segment);
|
|
236
235
|
this.timeshiftedSegments++;
|
|
237
236
|
};
|
|
238
237
|
this.timeshift.on("segment", this.transmitListener);
|
|
239
238
|
}
|
|
240
239
|
// Inform the user.
|
|
241
|
-
this.log.debug("
|
|
240
|
+
this.log.debug("Beginning a HomeKit Secure Video recording event.");
|
|
242
241
|
return true;
|
|
243
242
|
}
|
|
244
243
|
// Stop transmitting the HomeKit hub our timeshifted fMP4 stream.
|
|
245
|
-
stopTransmitting(reason) {
|
|
246
|
-
var _a;
|
|
247
|
-
const device = this.accessory.context.device;
|
|
244
|
+
async stopTransmitting(reason) {
|
|
248
245
|
// We're done transmitting, so we can go back to maintaining our timeshift buffer for HomeKit.
|
|
249
|
-
if (this.
|
|
250
|
-
|
|
246
|
+
if (this.protectCamera.hints.timeshift) {
|
|
247
|
+
this.timeshift.stopTransmitting();
|
|
251
248
|
}
|
|
249
|
+
let ffmpegError = false;
|
|
252
250
|
// Kill any FFmpeg sessions.
|
|
253
251
|
if (this.ffmpegStream) {
|
|
254
|
-
this.ffmpegStream.stop();
|
|
252
|
+
this.ffmpegStream.stop(((reason !== undefined) && (reason !== 0 /* HDSProtocolSpecificErrorReason.NORMAL */)) ? false : undefined);
|
|
253
|
+
ffmpegError = this.ffmpegStream.hasError;
|
|
255
254
|
this.ffmpegStream = null;
|
|
256
255
|
}
|
|
257
256
|
this.isTransmitting = false;
|
|
@@ -269,10 +268,9 @@ class ProtectRecordingDelegate {
|
|
|
269
268
|
// Calculate approximately how many seconds we've recorded. We have more accuracy in timeshifted segments, so we'll use the more
|
|
270
269
|
// accurate statistics when we can. Otherwise, we use the number of segments transmitted to HomeKit as a close proxy.
|
|
271
270
|
const recordedSeconds = this.timeshiftedSegments ?
|
|
272
|
-
((this.timeshiftedSegments * this.timeshift.segmentLength) / 1000) : (this.transmittedSegments *
|
|
271
|
+
((this.timeshiftedSegments * this.timeshift.segmentLength) / 1000) : (this.transmittedSegments * this.rtspEntry?.channel.idrInterval);
|
|
273
272
|
let recordedTime = "";
|
|
274
|
-
// Create a nicely formatted string for end users. Yes, the author recognizes this isn't
|
|
275
|
-
// essential, but it does bring a smile to their face.
|
|
273
|
+
// Create a nicely formatted string for end users. Yes, the author recognizes this isn't essential, but it does bring a smile to their face.
|
|
276
274
|
if (recordedSeconds < 1) {
|
|
277
275
|
recordedTime = recordedSeconds.toString();
|
|
278
276
|
}
|
|
@@ -285,13 +283,13 @@ class ProtectRecordingDelegate {
|
|
|
285
283
|
const minutes = Math.floor((recordedSeconds % 3600) / 60);
|
|
286
284
|
const seconds = Math.floor((recordedSeconds % 3600) % 60);
|
|
287
285
|
// Build the string.
|
|
288
|
-
if (hours >
|
|
286
|
+
if (hours > 9) {
|
|
289
287
|
recordedTime = hours.toString() + ":";
|
|
290
288
|
}
|
|
291
289
|
else if (hours > 0) {
|
|
292
290
|
recordedTime = "0" + hours.toString() + ":";
|
|
293
291
|
}
|
|
294
|
-
if (minutes >
|
|
292
|
+
if (minutes > 9) {
|
|
295
293
|
recordedTime += minutes.toString() + ":";
|
|
296
294
|
}
|
|
297
295
|
else if (minutes > 0) {
|
|
@@ -317,12 +315,11 @@ class ProtectRecordingDelegate {
|
|
|
317
315
|
break;
|
|
318
316
|
}
|
|
319
317
|
// Inform the user if they've enabled logging. We log HKSV events by default, for now.
|
|
320
|
-
if (this.
|
|
321
|
-
this.
|
|
322
|
-
this.log.info("%s: HomeKit Secure Video has recorded %s %s %s motion event.", this.name(), this.timeshiftedSegments ? "a" : "an approximately", recordedTime, timeUnit);
|
|
318
|
+
if (this.protectCamera.hints.logHksv || this.protectCamera.hints.logMotion) {
|
|
319
|
+
this.log.info("HomeKit Secure Video has recorded %s %s %s motion event.", this.timeshiftedSegments ? "a" : "an approximately", recordedTime, timeUnit);
|
|
323
320
|
}
|
|
324
321
|
}
|
|
325
|
-
//
|
|
322
|
+
// Let's figure out the reason why we're stopping, if we have one, and it's noteworthy.
|
|
326
323
|
let reasonDescription;
|
|
327
324
|
switch (reason) {
|
|
328
325
|
case 3 /* HDSProtocolSpecificErrorReason.CANCELLED */:
|
|
@@ -337,19 +334,26 @@ class ProtectRecordingDelegate {
|
|
|
337
334
|
default:
|
|
338
335
|
break;
|
|
339
336
|
}
|
|
337
|
+
// Inform the user when things stopped unexpectedly, and reset the timeshift buffer for good measure.
|
|
340
338
|
if ((reason !== undefined) && (reason !== 0 /* HDSProtocolSpecificErrorReason.NORMAL */)) {
|
|
341
|
-
this.log.error("
|
|
339
|
+
this.log.error("HomeKit Secure Video event recording ended early: %s", reasonDescription);
|
|
340
|
+
if (this.protectCamera.hints.timeshift && ffmpegError) {
|
|
341
|
+
await this.restartTimeshifting();
|
|
342
|
+
}
|
|
342
343
|
}
|
|
343
344
|
}
|
|
345
|
+
// Restart timeshifting for a camera.
|
|
346
|
+
async restartTimeshifting() {
|
|
347
|
+
this.timeshift.stop();
|
|
348
|
+
await this.configureTimeshifting();
|
|
349
|
+
}
|
|
344
350
|
// Return our HomeKit Secure Video recording state. This effectively tells us if HKSV has been configured and is on.
|
|
345
351
|
get isRecording() {
|
|
346
352
|
return this._isRecording;
|
|
347
353
|
}
|
|
348
354
|
// Return our current HomeKit Secure Video recording configuration.
|
|
349
355
|
get recordingConfiguration() {
|
|
350
|
-
|
|
351
|
-
return (_a = this.recordingConfig) !== null && _a !== void 0 ? _a : null;
|
|
356
|
+
return this.recordingConfig ?? null;
|
|
352
357
|
}
|
|
353
358
|
}
|
|
354
|
-
exports.ProtectRecordingDelegate = ProtectRecordingDelegate;
|
|
355
359
|
//# sourceMappingURL=protect-record.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"protect-record.js","sourceRoot":"","sources":["../src/protect-record.ts"],"names":[],"mappings":";;;AAmBA,mEAAiE;AAGjE,2DAA6D;AAE7D,wDAAwD;AACxD,MAAa,wBAAwB;IAsBnC,qDAAqD;IACrD,YAAY,aAA4B;;QAEtC,IAAI,CAAC,YAAY,GAAG,KAAK,CAAC;QAC1B,IAAI,CAAC,SAAS,GAAG,aAAa,CAAC,SAAS,CAAC;QACzC,IAAI,CAAC,GAAG,GAAG,aAAa,CAAC,GAAG,CAAC;QAC7B,IAAI,CAAC,GAAG,GAAG,aAAa,CAAC,GAAG,CAAC,GAAG,CAAC;QACjC,IAAI,CAAC,KAAK,GAAG,aAAa,CAAC,QAAQ,CAAC,KAAK,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ED,qCAAqC;IAC9B,KAAK,CAAC,mBAAmB;QAE9B,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC;QACtB,MAAM,IAAI,CAAC,qBAAqB,EAAE,CAAC;IACrC,CAAC;IAED,oHAAoH;IACpH,IAAW,WAAW;QAEpB,OAAO,IAAI,CAAC,YAAY,CAAC;IAC3B,CAAC;IAED,mEAAmE;IACnE,IAAW,sBAAsB;QAE/B,OAAO,IAAI,CAAC,eAAe,IAAI,IAAI,CAAC;IACtC,CAAC;CACF"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
/// <reference types="node" />
|
|
3
|
+
import { EventEmitter } from "node:events";
|
|
4
|
+
import { ProtectStreamingDelegate } from "./protect-stream.js";
|
|
5
|
+
export declare class RtpDemuxer extends EventEmitter {
|
|
6
|
+
private delegate;
|
|
7
|
+
private heartbeatTimer;
|
|
8
|
+
private heartbeatMsg;
|
|
9
|
+
private _isRunning;
|
|
10
|
+
private log;
|
|
11
|
+
private inputPort;
|
|
12
|
+
readonly socket: import("dgram").Socket;
|
|
13
|
+
constructor(streamingDelegate: ProtectStreamingDelegate, ipFamily: ("ipv4" | "ipv6"), inputPort: number, rtcpPort: number, rtpPort: number);
|
|
14
|
+
private heartbeat;
|
|
15
|
+
close(): void;
|
|
16
|
+
private getPayloadType;
|
|
17
|
+
private isRtpMessage;
|
|
18
|
+
get isRunning(): boolean;
|
|
19
|
+
}
|
|
20
|
+
export declare class RtpPortAllocator {
|
|
21
|
+
private portsInUse;
|
|
22
|
+
constructor();
|
|
23
|
+
private getPort;
|
|
24
|
+
reservePort(ipFamily?: ("ipv4" | "ipv6"), portCount?: (1 | 2), attempts?: number): Promise<number>;
|
|
25
|
+
freePort(port: number): void;
|
|
26
|
+
}
|
|
27
|
+
export declare class RtpUtils {
|
|
28
|
+
static reservePort(ipFamily?: ("ipv4" | "ipv6"), portCount?: (1 | 2), attempts?: number): Promise<number>;
|
|
29
|
+
}
|