@homebridge/hap-nodejs 2.2.4-beta.7 → 2.3.0-beta.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 +14 -17
- package/dist/accessories/AirConditioner_accessory.js +27 -29
- package/dist/accessories/AirConditioner_accessory.js.map +1 -1
- package/dist/accessories/AppleTVRemote_accessory.js +63 -76
- package/dist/accessories/AppleTVRemote_accessory.js.map +1 -1
- package/dist/accessories/Camera_accessory.js +151 -134
- package/dist/accessories/Camera_accessory.js.map +1 -1
- package/dist/accessories/Fan_accessory.js +18 -21
- package/dist/accessories/Fan_accessory.js.map +1 -1
- package/dist/accessories/GarageDoorOpener_accessory.js +33 -35
- package/dist/accessories/GarageDoorOpener_accessory.js.map +1 -1
- package/dist/accessories/Light-AdaptiveLighting_accessory.js +41 -44
- package/dist/accessories/Light-AdaptiveLighting_accessory.js.map +1 -1
- package/dist/accessories/Light_accessory.js +32 -34
- package/dist/accessories/Light_accessory.js.map +1 -1
- package/dist/accessories/Lock_accessory.js +24 -26
- package/dist/accessories/Lock_accessory.js.map +1 -1
- package/dist/accessories/MotionSensor_accessory.js +13 -15
- package/dist/accessories/MotionSensor_accessory.js.map +1 -1
- package/dist/accessories/Outlet_accessory.js +20 -22
- package/dist/accessories/Outlet_accessory.js.map +1 -1
- package/dist/accessories/SmartSpeaker_accessory.js +18 -20
- package/dist/accessories/SmartSpeaker_accessory.js.map +1 -1
- package/dist/accessories/Sprinkler_accessory.js +36 -38
- package/dist/accessories/Sprinkler_accessory.js.map +1 -1
- package/dist/accessories/TV_accessory.js +43 -45
- package/dist/accessories/TV_accessory.js.map +1 -1
- package/dist/accessories/TemperatureSensor_accessory.js +12 -14
- package/dist/accessories/TemperatureSensor_accessory.js.map +1 -1
- package/dist/accessories/Wi-FiRouter_accessory.d.ts +1 -1
- package/dist/accessories/Wi-FiRouter_accessory.d.ts.map +1 -1
- package/dist/accessories/Wi-FiRouter_accessory.js +9 -12
- package/dist/accessories/Wi-FiRouter_accessory.js.map +1 -1
- package/dist/accessories/Wi-FiSatellite_accessory.d.ts +1 -1
- package/dist/accessories/Wi-FiSatellite_accessory.d.ts.map +1 -1
- package/dist/accessories/Wi-FiSatellite_accessory.js +11 -14
- package/dist/accessories/Wi-FiSatellite_accessory.js.map +1 -1
- package/dist/accessories/gstreamer-audioProducer.d.ts +3 -3
- package/dist/accessories/gstreamer-audioProducer.d.ts.map +1 -1
- package/dist/accessories/gstreamer-audioProducer.js +38 -38
- package/dist/accessories/gstreamer-audioProducer.js.map +1 -1
- package/dist/accessories/types.d.ts +63 -63
- package/dist/accessories/types.d.ts.map +1 -1
- package/dist/accessories/types.js +83 -87
- package/dist/accessories/types.js.map +1 -1
- package/dist/hap.d.ts +50 -0
- package/dist/hap.d.ts.map +1 -0
- package/dist/hap.js +49 -0
- package/dist/hap.js.map +1 -0
- package/dist/index.d.ts +3 -49
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -53
- package/dist/index.js.map +1 -1
- package/dist/internal-types.d.ts +1 -1
- package/dist/internal-types.d.ts.map +1 -1
- package/dist/internal-types.js +19 -19
- package/dist/internal-types.js.map +1 -1
- package/dist/lib/Accessory.d.ts +37 -37
- package/dist/lib/Accessory.d.ts.map +1 -1
- package/dist/lib/Accessory.js +286 -280
- package/dist/lib/Accessory.js.map +1 -1
- package/dist/lib/Advertiser.d.ts +6 -6
- package/dist/lib/Advertiser.d.ts.map +1 -1
- package/dist/lib/Advertiser.js +143 -139
- package/dist/lib/Advertiser.js.map +1 -1
- package/dist/lib/Bridge.d.ts +1 -1
- package/dist/lib/Bridge.d.ts.map +1 -1
- package/dist/lib/Bridge.js +2 -6
- package/dist/lib/Bridge.js.map +1 -1
- package/dist/lib/Characteristic.d.ts +40 -41
- package/dist/lib/Characteristic.d.ts.map +1 -1
- package/dist/lib/Characteristic.js +290 -240
- package/dist/lib/Characteristic.js.map +1 -1
- package/dist/lib/HAPServer.d.ts +31 -30
- package/dist/lib/HAPServer.d.ts.map +1 -1
- package/dist/lib/HAPServer.js +245 -247
- package/dist/lib/HAPServer.js.map +1 -1
- package/dist/lib/Service.d.ts +21 -22
- package/dist/lib/Service.d.ts.map +1 -1
- package/dist/lib/Service.js +60 -68
- package/dist/lib/Service.js.map +1 -1
- package/dist/lib/camera/RTPProxy.d.ts +2 -1
- package/dist/lib/camera/RTPProxy.d.ts.map +1 -1
- package/dist/lib/camera/RTPProxy.js +35 -37
- package/dist/lib/camera/RTPProxy.js.map +1 -1
- package/dist/lib/camera/RTPStreamManagement.d.ts +34 -33
- package/dist/lib/camera/RTPStreamManagement.d.ts.map +1 -1
- package/dist/lib/camera/RTPStreamManagement.js +184 -137
- package/dist/lib/camera/RTPStreamManagement.js.map +1 -1
- package/dist/lib/camera/RecordingManagement.d.ts +18 -17
- package/dist/lib/camera/RecordingManagement.d.ts.map +1 -1
- package/dist/lib/camera/RecordingManagement.js +189 -164
- package/dist/lib/camera/RecordingManagement.js.map +1 -1
- package/dist/lib/camera/index.d.ts +3 -3
- package/dist/lib/camera/index.d.ts.map +1 -1
- package/dist/lib/camera/index.js +3 -6
- package/dist/lib/camera/index.js.map +1 -1
- package/dist/lib/controller/AdaptiveLightingController.d.ts +8 -8
- package/dist/lib/controller/AdaptiveLightingController.d.ts.map +1 -1
- package/dist/lib/controller/AdaptiveLightingController.js +112 -99
- package/dist/lib/controller/AdaptiveLightingController.js.map +1 -1
- package/dist/lib/controller/CameraController.d.ts +21 -20
- package/dist/lib/controller/CameraController.d.ts.map +1 -1
- package/dist/lib/controller/CameraController.js +92 -89
- package/dist/lib/controller/CameraController.js.map +1 -1
- package/dist/lib/controller/Controller.d.ts +1 -1
- package/dist/lib/controller/Controller.d.ts.map +1 -1
- package/dist/lib/controller/Controller.js +5 -8
- package/dist/lib/controller/Controller.js.map +1 -1
- package/dist/lib/controller/DoorbellController.d.ts +4 -4
- package/dist/lib/controller/DoorbellController.d.ts.map +1 -1
- package/dist/lib/controller/DoorbellController.js +9 -13
- package/dist/lib/controller/DoorbellController.js.map +1 -1
- package/dist/lib/controller/RemoteController.d.ts +40 -39
- package/dist/lib/controller/RemoteController.d.ts.map +1 -1
- package/dist/lib/controller/RemoteController.js +213 -186
- package/dist/lib/controller/RemoteController.js.map +1 -1
- package/dist/lib/controller/index.d.ts +5 -5
- package/dist/lib/controller/index.d.ts.map +1 -1
- package/dist/lib/controller/index.js +5 -8
- package/dist/lib/controller/index.js.map +1 -1
- package/dist/lib/datastream/DataStreamManagement.d.ts +2 -2
- package/dist/lib/datastream/DataStreamManagement.d.ts.map +1 -1
- package/dist/lib/datastream/DataStreamManagement.js +36 -35
- package/dist/lib/datastream/DataStreamManagement.js.map +1 -1
- package/dist/lib/datastream/DataStreamParser.d.ts +1 -0
- package/dist/lib/datastream/DataStreamParser.d.ts.map +1 -1
- package/dist/lib/datastream/DataStreamParser.js +53 -69
- package/dist/lib/datastream/DataStreamParser.js.map +1 -1
- package/dist/lib/datastream/DataStreamServer.d.ts +24 -23
- package/dist/lib/datastream/DataStreamServer.d.ts.map +1 -1
- package/dist/lib/datastream/DataStreamServer.js +151 -154
- package/dist/lib/datastream/DataStreamServer.js.map +1 -1
- package/dist/lib/datastream/index.d.ts +3 -3
- package/dist/lib/datastream/index.d.ts.map +1 -1
- package/dist/lib/datastream/index.js +3 -6
- package/dist/lib/datastream/index.js.map +1 -1
- package/dist/lib/definitions/CharacteristicDefinitions.d.ts +1 -1
- package/dist/lib/definitions/CharacteristicDefinitions.d.ts.map +1 -1
- package/dist/lib/definitions/CharacteristicDefinitions.js +1103 -1288
- package/dist/lib/definitions/CharacteristicDefinitions.js.map +1 -1
- package/dist/lib/definitions/ServiceDefinitions.d.ts +1 -1
- package/dist/lib/definitions/ServiceDefinitions.d.ts.map +1 -1
- package/dist/lib/definitions/ServiceDefinitions.js +644 -722
- package/dist/lib/definitions/ServiceDefinitions.js.map +1 -1
- package/dist/lib/definitions/generate-definitions.d.ts +2 -2
- package/dist/lib/definitions/generate-definitions.d.ts.map +1 -1
- package/dist/lib/definitions/generate-definitions.js +241 -241
- package/dist/lib/definitions/generate-definitions.js.map +1 -1
- package/dist/lib/definitions/generator-configuration.d.ts +1 -1
- package/dist/lib/definitions/generator-configuration.d.ts.map +1 -1
- package/dist/lib/definitions/generator-configuration.js +572 -309
- package/dist/lib/definitions/generator-configuration.js.map +1 -1
- package/dist/lib/definitions/index.d.ts +2 -2
- package/dist/lib/definitions/index.d.ts.map +1 -1
- package/dist/lib/definitions/index.js +2 -5
- package/dist/lib/definitions/index.js.map +1 -1
- package/dist/lib/gen/HomeKit.js +1 -2
- package/dist/lib/gen/HomeKit.js.map +1 -1
- package/dist/lib/model/AccessoryInfo.d.ts +4 -3
- package/dist/lib/model/AccessoryInfo.d.ts.map +1 -1
- package/dist/lib/model/AccessoryInfo.js +53 -56
- package/dist/lib/model/AccessoryInfo.js.map +1 -1
- package/dist/lib/model/ControllerStorage.d.ts +3 -3
- package/dist/lib/model/ControllerStorage.d.ts.map +1 -1
- package/dist/lib/model/ControllerStorage.js +31 -30
- package/dist/lib/model/ControllerStorage.js.map +1 -1
- package/dist/lib/model/HAPFileStorage.d.ts.map +1 -1
- package/dist/lib/model/HAPFileStorage.js +71 -50
- package/dist/lib/model/HAPFileStorage.js.map +1 -1
- package/dist/lib/model/HAPStorage.d.ts +1 -1
- package/dist/lib/model/HAPStorage.d.ts.map +1 -1
- package/dist/lib/model/HAPStorage.js +11 -14
- package/dist/lib/model/HAPStorage.js.map +1 -1
- package/dist/lib/model/IdentifierCache.d.ts +1 -1
- package/dist/lib/model/IdentifierCache.d.ts.map +1 -1
- package/dist/lib/model/IdentifierCache.js +23 -27
- package/dist/lib/model/IdentifierCache.js.map +1 -1
- package/dist/lib/tv/AccessControlManagement.d.ts +6 -6
- package/dist/lib/tv/AccessControlManagement.d.ts.map +1 -1
- package/dist/lib/tv/AccessControlManagement.js +23 -24
- package/dist/lib/tv/AccessControlManagement.js.map +1 -1
- package/dist/lib/util/checkName.d.ts +2 -2
- package/dist/lib/util/checkName.d.ts.map +1 -1
- package/dist/lib/util/checkName.js +8 -14
- package/dist/lib/util/checkName.js.map +1 -1
- package/dist/lib/util/clone.d.ts.map +1 -1
- package/dist/lib/util/clone.js +1 -5
- package/dist/lib/util/clone.js.map +1 -1
- package/dist/lib/util/color-utils.d.ts +1 -1
- package/dist/lib/util/color-utils.d.ts.map +1 -1
- package/dist/lib/util/color-utils.js +1608 -410
- package/dist/lib/util/color-utils.js.map +1 -1
- package/dist/lib/util/eventedhttp.d.ts +23 -22
- package/dist/lib/util/eventedhttp.d.ts.map +1 -1
- package/dist/lib/util/eventedhttp.js +127 -122
- package/dist/lib/util/eventedhttp.js.map +1 -1
- package/dist/lib/util/hapCrypto.d.ts +2 -1
- package/dist/lib/util/hapCrypto.d.ts.map +1 -1
- package/dist/lib/util/hapCrypto.js +72 -59
- package/dist/lib/util/hapCrypto.js.map +1 -1
- package/dist/lib/util/hapStatusError.d.ts +1 -1
- package/dist/lib/util/hapStatusError.d.ts.map +1 -1
- package/dist/lib/util/hapStatusError.js +5 -9
- package/dist/lib/util/hapStatusError.js.map +1 -1
- package/dist/lib/util/net-utils.js +13 -19
- package/dist/lib/util/net-utils.js.map +1 -1
- package/dist/lib/util/once.js +3 -6
- package/dist/lib/util/once.js.map +1 -1
- package/dist/lib/util/promise-utils.d.ts +1 -1
- package/dist/lib/util/promise-utils.d.ts.map +1 -1
- package/dist/lib/util/promise-utils.js +9 -11
- package/dist/lib/util/promise-utils.js.map +1 -1
- package/dist/lib/util/request-util.d.ts +3 -3
- package/dist/lib/util/request-util.d.ts.map +1 -1
- package/dist/lib/util/request-util.js +14 -23
- package/dist/lib/util/request-util.js.map +1 -1
- package/dist/lib/util/time.d.ts +1 -0
- package/dist/lib/util/time.d.ts.map +1 -1
- package/dist/lib/util/time.js +6 -11
- package/dist/lib/util/time.js.map +1 -1
- package/dist/lib/util/tlv.d.ts +1 -0
- package/dist/lib/util/tlv.d.ts.map +1 -1
- package/dist/lib/util/tlv.js +38 -44
- package/dist/lib/util/tlv.js.map +1 -1
- package/dist/lib/util/uuid.d.ts +1 -0
- package/dist/lib/util/uuid.d.ts.map +1 -1
- package/dist/lib/util/uuid.js +26 -38
- package/dist/lib/util/uuid.js.map +1 -1
- package/dist/types.d.ts +24 -24
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +3 -5
- package/dist/types.js.map +1 -1
- package/package.json +49 -42
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
const
|
|
13
|
-
const
|
|
14
|
-
const hksvDebug = (0, debug_1.default)("HAP-NodeJS:HKSV");
|
|
1
|
+
/* global NodeJS */
|
|
2
|
+
import { Buffer } from 'node:buffer';
|
|
3
|
+
import crypto from 'node:crypto';
|
|
4
|
+
import { EventEmitter } from 'node:events';
|
|
5
|
+
import createDebug from 'debug';
|
|
6
|
+
import { Characteristic } from '../Characteristic.js';
|
|
7
|
+
import { DataStreamManagement, HDSConnectionError, HDSProtocolError, HDSProtocolSpecificErrorReason, HDSStatus, } from '../datastream/index.js';
|
|
8
|
+
import { HAPStatus } from '../HAPServer.js';
|
|
9
|
+
import { Service } from '../Service.js';
|
|
10
|
+
import { HapStatusError } from '../util/hapStatusError.js';
|
|
11
|
+
import * as tlv from '../util/tlv.js';
|
|
12
|
+
const debug = createDebug('HAP-NodeJS:Camera:RecordingManagement');
|
|
13
|
+
const hksvDebug = createDebug('HAP-NodeJS:HKSV');
|
|
15
14
|
/**
|
|
16
15
|
* Describes the Event trigger.
|
|
17
16
|
*
|
|
18
17
|
* @group Camera
|
|
19
18
|
*/
|
|
20
|
-
|
|
19
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
20
|
+
export var EventTriggerOption;
|
|
21
21
|
(function (EventTriggerOption) {
|
|
22
22
|
/**
|
|
23
23
|
* The Motion trigger. If enabled motion should trigger the start of a recording.
|
|
@@ -32,20 +32,23 @@ var EventTriggerOption;
|
|
|
32
32
|
* See https://github.com/homebridge/HAP-NodeJS/issues/976#issuecomment-1280301989.
|
|
33
33
|
*/
|
|
34
34
|
EventTriggerOption[EventTriggerOption["DOORBELL"] = 2] = "DOORBELL";
|
|
35
|
-
})(EventTriggerOption || (
|
|
35
|
+
})(EventTriggerOption || (EventTriggerOption = {}));
|
|
36
36
|
/**
|
|
37
37
|
* @group Camera
|
|
38
38
|
*/
|
|
39
|
-
|
|
39
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
40
|
+
export var MediaContainerType;
|
|
40
41
|
(function (MediaContainerType) {
|
|
41
42
|
MediaContainerType[MediaContainerType["FRAGMENTED_MP4"] = 0] = "FRAGMENTED_MP4";
|
|
42
|
-
})(MediaContainerType || (
|
|
43
|
+
})(MediaContainerType || (MediaContainerType = {}));
|
|
44
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
43
45
|
var VideoCodecConfigurationTypes;
|
|
44
46
|
(function (VideoCodecConfigurationTypes) {
|
|
45
47
|
VideoCodecConfigurationTypes[VideoCodecConfigurationTypes["CODEC_TYPE"] = 1] = "CODEC_TYPE";
|
|
46
48
|
VideoCodecConfigurationTypes[VideoCodecConfigurationTypes["CODEC_PARAMETERS"] = 2] = "CODEC_PARAMETERS";
|
|
47
49
|
VideoCodecConfigurationTypes[VideoCodecConfigurationTypes["ATTRIBUTES"] = 3] = "ATTRIBUTES";
|
|
48
50
|
})(VideoCodecConfigurationTypes || (VideoCodecConfigurationTypes = {}));
|
|
51
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
49
52
|
var VideoCodecParametersTypes;
|
|
50
53
|
(function (VideoCodecParametersTypes) {
|
|
51
54
|
VideoCodecParametersTypes[VideoCodecParametersTypes["PROFILE_ID"] = 1] = "PROFILE_ID";
|
|
@@ -53,12 +56,14 @@ var VideoCodecParametersTypes;
|
|
|
53
56
|
VideoCodecParametersTypes[VideoCodecParametersTypes["BITRATE"] = 3] = "BITRATE";
|
|
54
57
|
VideoCodecParametersTypes[VideoCodecParametersTypes["IFRAME_INTERVAL"] = 4] = "IFRAME_INTERVAL";
|
|
55
58
|
})(VideoCodecParametersTypes || (VideoCodecParametersTypes = {}));
|
|
59
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
56
60
|
var VideoAttributesTypes;
|
|
57
61
|
(function (VideoAttributesTypes) {
|
|
58
62
|
VideoAttributesTypes[VideoAttributesTypes["IMAGE_WIDTH"] = 1] = "IMAGE_WIDTH";
|
|
59
63
|
VideoAttributesTypes[VideoAttributesTypes["IMAGE_HEIGHT"] = 2] = "IMAGE_HEIGHT";
|
|
60
64
|
VideoAttributesTypes[VideoAttributesTypes["FRAME_RATE"] = 3] = "FRAME_RATE";
|
|
61
65
|
})(VideoAttributesTypes || (VideoAttributesTypes = {}));
|
|
66
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
62
67
|
var SelectedCameraRecordingConfigurationTypes;
|
|
63
68
|
(function (SelectedCameraRecordingConfigurationTypes) {
|
|
64
69
|
SelectedCameraRecordingConfigurationTypes[SelectedCameraRecordingConfigurationTypes["SELECTED_RECORDING_CONFIGURATION"] = 1] = "SELECTED_RECORDING_CONFIGURATION";
|
|
@@ -68,15 +73,17 @@ var SelectedCameraRecordingConfigurationTypes;
|
|
|
68
73
|
/**
|
|
69
74
|
* @group Camera
|
|
70
75
|
*/
|
|
71
|
-
|
|
76
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
77
|
+
export var AudioRecordingCodecType;
|
|
72
78
|
(function (AudioRecordingCodecType) {
|
|
73
79
|
AudioRecordingCodecType[AudioRecordingCodecType["AAC_LC"] = 0] = "AAC_LC";
|
|
74
80
|
AudioRecordingCodecType[AudioRecordingCodecType["AAC_ELD"] = 1] = "AAC_ELD";
|
|
75
|
-
})(AudioRecordingCodecType || (
|
|
81
|
+
})(AudioRecordingCodecType || (AudioRecordingCodecType = {}));
|
|
76
82
|
/**
|
|
77
83
|
* @group Camera
|
|
78
84
|
*/
|
|
79
|
-
|
|
85
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
86
|
+
export var AudioRecordingSamplerate;
|
|
80
87
|
(function (AudioRecordingSamplerate) {
|
|
81
88
|
AudioRecordingSamplerate[AudioRecordingSamplerate["KHZ_8"] = 0] = "KHZ_8";
|
|
82
89
|
AudioRecordingSamplerate[AudioRecordingSamplerate["KHZ_16"] = 1] = "KHZ_16";
|
|
@@ -84,38 +91,45 @@ var AudioRecordingSamplerate;
|
|
|
84
91
|
AudioRecordingSamplerate[AudioRecordingSamplerate["KHZ_32"] = 3] = "KHZ_32";
|
|
85
92
|
AudioRecordingSamplerate[AudioRecordingSamplerate["KHZ_44_1"] = 4] = "KHZ_44_1";
|
|
86
93
|
AudioRecordingSamplerate[AudioRecordingSamplerate["KHZ_48"] = 5] = "KHZ_48";
|
|
87
|
-
})(AudioRecordingSamplerate || (
|
|
94
|
+
})(AudioRecordingSamplerate || (AudioRecordingSamplerate = {}));
|
|
95
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
88
96
|
var SupportedVideoRecordingConfigurationTypes;
|
|
89
97
|
(function (SupportedVideoRecordingConfigurationTypes) {
|
|
90
98
|
SupportedVideoRecordingConfigurationTypes[SupportedVideoRecordingConfigurationTypes["VIDEO_CODEC_CONFIGURATION"] = 1] = "VIDEO_CODEC_CONFIGURATION";
|
|
91
99
|
})(SupportedVideoRecordingConfigurationTypes || (SupportedVideoRecordingConfigurationTypes = {}));
|
|
100
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
92
101
|
var SupportedCameraRecordingConfigurationTypes;
|
|
93
102
|
(function (SupportedCameraRecordingConfigurationTypes) {
|
|
94
103
|
SupportedCameraRecordingConfigurationTypes[SupportedCameraRecordingConfigurationTypes["PREBUFFER_LENGTH"] = 1] = "PREBUFFER_LENGTH";
|
|
95
104
|
SupportedCameraRecordingConfigurationTypes[SupportedCameraRecordingConfigurationTypes["EVENT_TRIGGER_OPTIONS"] = 2] = "EVENT_TRIGGER_OPTIONS";
|
|
96
105
|
SupportedCameraRecordingConfigurationTypes[SupportedCameraRecordingConfigurationTypes["MEDIA_CONTAINER_CONFIGURATIONS"] = 3] = "MEDIA_CONTAINER_CONFIGURATIONS";
|
|
97
106
|
})(SupportedCameraRecordingConfigurationTypes || (SupportedCameraRecordingConfigurationTypes = {}));
|
|
107
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
98
108
|
var MediaContainerConfigurationTypes;
|
|
99
109
|
(function (MediaContainerConfigurationTypes) {
|
|
100
110
|
MediaContainerConfigurationTypes[MediaContainerConfigurationTypes["MEDIA_CONTAINER_TYPE"] = 1] = "MEDIA_CONTAINER_TYPE";
|
|
101
111
|
MediaContainerConfigurationTypes[MediaContainerConfigurationTypes["MEDIA_CONTAINER_PARAMETERS"] = 2] = "MEDIA_CONTAINER_PARAMETERS";
|
|
102
112
|
})(MediaContainerConfigurationTypes || (MediaContainerConfigurationTypes = {}));
|
|
113
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
103
114
|
var MediaContainerParameterTypes;
|
|
104
115
|
(function (MediaContainerParameterTypes) {
|
|
105
116
|
MediaContainerParameterTypes[MediaContainerParameterTypes["FRAGMENT_LENGTH"] = 1] = "FRAGMENT_LENGTH";
|
|
106
117
|
})(MediaContainerParameterTypes || (MediaContainerParameterTypes = {}));
|
|
118
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
107
119
|
var AudioCodecParametersTypes;
|
|
108
120
|
(function (AudioCodecParametersTypes) {
|
|
109
121
|
AudioCodecParametersTypes[AudioCodecParametersTypes["CHANNEL"] = 1] = "CHANNEL";
|
|
110
122
|
AudioCodecParametersTypes[AudioCodecParametersTypes["BIT_RATE"] = 2] = "BIT_RATE";
|
|
111
123
|
AudioCodecParametersTypes[AudioCodecParametersTypes["SAMPLE_RATE"] = 3] = "SAMPLE_RATE";
|
|
112
|
-
AudioCodecParametersTypes[AudioCodecParametersTypes["MAX_AUDIO_BITRATE"] = 4] = "MAX_AUDIO_BITRATE";
|
|
124
|
+
AudioCodecParametersTypes[AudioCodecParametersTypes["MAX_AUDIO_BITRATE"] = 4] = "MAX_AUDIO_BITRATE";
|
|
113
125
|
})(AudioCodecParametersTypes || (AudioCodecParametersTypes = {}));
|
|
126
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
114
127
|
var AudioCodecConfigurationTypes;
|
|
115
128
|
(function (AudioCodecConfigurationTypes) {
|
|
116
129
|
AudioCodecConfigurationTypes[AudioCodecConfigurationTypes["CODEC_TYPE"] = 1] = "CODEC_TYPE";
|
|
117
130
|
AudioCodecConfigurationTypes[AudioCodecConfigurationTypes["CODEC_PARAMETERS"] = 2] = "CODEC_PARAMETERS";
|
|
118
131
|
})(AudioCodecConfigurationTypes || (AudioCodecConfigurationTypes = {}));
|
|
132
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
119
133
|
var SupportedAudioRecordingConfigurationTypes;
|
|
120
134
|
(function (SupportedAudioRecordingConfigurationTypes) {
|
|
121
135
|
SupportedAudioRecordingConfigurationTypes[SupportedAudioRecordingConfigurationTypes["AUDIO_CODEC_CONFIGURATION"] = 1] = "AUDIO_CODEC_CONFIGURATION";
|
|
@@ -123,7 +137,8 @@ var SupportedAudioRecordingConfigurationTypes;
|
|
|
123
137
|
/**
|
|
124
138
|
* @group Camera
|
|
125
139
|
*/
|
|
126
|
-
|
|
140
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
141
|
+
export var PacketDataType;
|
|
127
142
|
(function (PacketDataType) {
|
|
128
143
|
/**
|
|
129
144
|
* mp4 moov box
|
|
@@ -133,11 +148,11 @@ var PacketDataType;
|
|
|
133
148
|
* mp4 moof + mdat boxes
|
|
134
149
|
*/
|
|
135
150
|
PacketDataType["MEDIA_FRAGMENT"] = "mediaFragment";
|
|
136
|
-
})(PacketDataType || (
|
|
151
|
+
})(PacketDataType || (PacketDataType = {}));
|
|
137
152
|
/**
|
|
138
153
|
* @group Camera
|
|
139
154
|
*/
|
|
140
|
-
class RecordingManagement {
|
|
155
|
+
export class RecordingManagement {
|
|
141
156
|
options;
|
|
142
157
|
delegate;
|
|
143
158
|
stateChangeDelegate;
|
|
@@ -183,129 +198,139 @@ class RecordingManagement {
|
|
|
183
198
|
this.supportedVideoRecordingConfiguration = this._supportedVideoRecordingConfiguration(options.video);
|
|
184
199
|
this.supportedAudioRecordingConfiguration = this._supportedAudioStreamConfiguration(options.audio);
|
|
185
200
|
this.setupServiceHandlers();
|
|
186
|
-
hksvDebug(
|
|
201
|
+
hksvDebug('RecordingManagement created (eventTriggers=0x%s)', this.eventTriggerOptions.toString(16));
|
|
187
202
|
}
|
|
188
203
|
constructService() {
|
|
189
|
-
const recordingManagement = new
|
|
190
|
-
recordingManagement.setCharacteristic(
|
|
191
|
-
recordingManagement.setCharacteristic(
|
|
192
|
-
const operatingMode = new
|
|
193
|
-
operatingMode.setCharacteristic(
|
|
194
|
-
operatingMode.setCharacteristic(
|
|
195
|
-
operatingMode.setCharacteristic(
|
|
196
|
-
const dataStreamManagement = new
|
|
204
|
+
const recordingManagement = new Service.CameraRecordingManagement('', '');
|
|
205
|
+
recordingManagement.setCharacteristic(Characteristic.Active, false);
|
|
206
|
+
recordingManagement.setCharacteristic(Characteristic.RecordingAudioActive, false);
|
|
207
|
+
const operatingMode = new Service.CameraOperatingMode('', '');
|
|
208
|
+
operatingMode.setCharacteristic(Characteristic.EventSnapshotsActive, true);
|
|
209
|
+
operatingMode.setCharacteristic(Characteristic.HomeKitCameraActive, true);
|
|
210
|
+
operatingMode.setCharacteristic(Characteristic.PeriodicSnapshotsActive, true);
|
|
211
|
+
const dataStreamManagement = new DataStreamManagement();
|
|
197
212
|
recordingManagement.addLinkedService(dataStreamManagement.getService());
|
|
198
213
|
return {
|
|
199
|
-
recordingManagement
|
|
200
|
-
operatingMode
|
|
201
|
-
dataStreamManagement
|
|
214
|
+
recordingManagement,
|
|
215
|
+
operatingMode,
|
|
216
|
+
dataStreamManagement,
|
|
202
217
|
};
|
|
203
218
|
}
|
|
204
219
|
setupServiceHandlers() {
|
|
205
220
|
// update the current configuration values to the current state.
|
|
206
|
-
this.recordingManagementService.setCharacteristic(
|
|
207
|
-
this.recordingManagementService.setCharacteristic(
|
|
208
|
-
this.recordingManagementService.setCharacteristic(
|
|
209
|
-
this.recordingManagementService.getCharacteristic(
|
|
221
|
+
this.recordingManagementService.setCharacteristic(Characteristic.SupportedCameraRecordingConfiguration, this.supportedCameraRecordingConfiguration);
|
|
222
|
+
this.recordingManagementService.setCharacteristic(Characteristic.SupportedVideoRecordingConfiguration, this.supportedVideoRecordingConfiguration);
|
|
223
|
+
this.recordingManagementService.setCharacteristic(Characteristic.SupportedAudioRecordingConfiguration, this.supportedAudioRecordingConfiguration);
|
|
224
|
+
this.recordingManagementService.getCharacteristic(Characteristic.SelectedCameraRecordingConfiguration)
|
|
210
225
|
.onGet(this.handleSelectedCameraRecordingConfigurationRead.bind(this))
|
|
211
226
|
.onSet(this.handleSelectedCameraRecordingConfigurationWrite.bind(this))
|
|
212
|
-
.setProps({
|
|
213
|
-
|
|
214
|
-
|
|
227
|
+
.setProps({
|
|
228
|
+
adminOnlyAccess: [1 /* Access.WRITE */],
|
|
229
|
+
});
|
|
230
|
+
this.recordingManagementService.getCharacteristic(Characteristic.Active)
|
|
231
|
+
.onSet((value) => {
|
|
215
232
|
if (!!value === this.recordingActive) {
|
|
216
233
|
return; // skip delegate call if state didn't change!
|
|
217
234
|
}
|
|
218
235
|
this.recordingActive = !!value;
|
|
219
|
-
hksvDebug(
|
|
236
|
+
hksvDebug('Active onSet: recordingActive -> %s', this.recordingActive);
|
|
220
237
|
this.delegate.updateRecordingActive(this.recordingActive);
|
|
221
238
|
})
|
|
222
239
|
.on("change" /* CharacteristicEventTypes.CHANGE */, () => this.stateChangeDelegate?.())
|
|
223
|
-
.setProps({
|
|
224
|
-
|
|
240
|
+
.setProps({
|
|
241
|
+
adminOnlyAccess: [1 /* Access.WRITE */],
|
|
242
|
+
});
|
|
243
|
+
this.recordingManagementService.getCharacteristic(Characteristic.RecordingAudioActive)
|
|
225
244
|
.on("change" /* CharacteristicEventTypes.CHANGE */, () => this.stateChangeDelegate?.());
|
|
226
|
-
this.operatingModeService.getCharacteristic(
|
|
227
|
-
.on("change" /* CharacteristicEventTypes.CHANGE */, change => {
|
|
245
|
+
this.operatingModeService.getCharacteristic(Characteristic.HomeKitCameraActive)
|
|
246
|
+
.on("change" /* CharacteristicEventTypes.CHANGE */, (change) => {
|
|
228
247
|
for (const service of this.sensorServices) {
|
|
229
|
-
service.setCharacteristic(
|
|
248
|
+
service.setCharacteristic(Characteristic.StatusActive, !!change.newValue);
|
|
230
249
|
}
|
|
231
250
|
if (!change.newValue && this.recordingStream) {
|
|
232
|
-
this.recordingStream.close(
|
|
251
|
+
this.recordingStream.close(HDSProtocolSpecificErrorReason.NOT_ALLOWED);
|
|
233
252
|
}
|
|
234
253
|
this.stateChangeDelegate?.();
|
|
235
254
|
})
|
|
236
|
-
.setProps({
|
|
237
|
-
|
|
255
|
+
.setProps({
|
|
256
|
+
adminOnlyAccess: [1 /* Access.WRITE */],
|
|
257
|
+
});
|
|
258
|
+
this.operatingModeService.getCharacteristic(Characteristic.EventSnapshotsActive)
|
|
238
259
|
.on("change" /* CharacteristicEventTypes.CHANGE */, () => this.stateChangeDelegate?.())
|
|
239
|
-
.setProps({
|
|
240
|
-
|
|
260
|
+
.setProps({
|
|
261
|
+
adminOnlyAccess: [1 /* Access.WRITE */],
|
|
262
|
+
});
|
|
263
|
+
this.operatingModeService.getCharacteristic(Characteristic.PeriodicSnapshotsActive)
|
|
241
264
|
.on("change" /* CharacteristicEventTypes.CHANGE */, () => this.stateChangeDelegate?.())
|
|
242
|
-
.setProps({
|
|
265
|
+
.setProps({
|
|
266
|
+
adminOnlyAccess: [1 /* Access.WRITE */],
|
|
267
|
+
});
|
|
243
268
|
this.dataStreamManagement
|
|
244
269
|
.onRequestMessage("dataSend" /* Protocols.DATA_SEND */, "open" /* Topics.OPEN */, this.handleDataSendOpen.bind(this));
|
|
245
270
|
}
|
|
246
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
247
271
|
handleDataSendOpen(connection, id, message) {
|
|
248
272
|
// for message fields see https://github.com/Supereg/secure-video-specification#41-start
|
|
249
273
|
const streamId = message.streamId;
|
|
250
274
|
const type = message.type;
|
|
251
275
|
const target = message.target;
|
|
252
276
|
const reason = message.reason;
|
|
253
|
-
if (target !==
|
|
254
|
-
debug(
|
|
255
|
-
connection.sendResponse("dataSend" /* Protocols.DATA_SEND */, "open" /* Topics.OPEN */, id,
|
|
256
|
-
status:
|
|
277
|
+
if (target !== 'controller' || type !== 'ipcamera.recording') {
|
|
278
|
+
debug('[HDS %s] Received data send with unexpected target: %s or type: %d. Rejecting...', connection.remoteAddress, target, type);
|
|
279
|
+
connection.sendResponse("dataSend" /* Protocols.DATA_SEND */, "open" /* Topics.OPEN */, id, HDSStatus.PROTOCOL_SPECIFIC_ERROR, {
|
|
280
|
+
status: HDSProtocolSpecificErrorReason.UNEXPECTED_FAILURE,
|
|
257
281
|
});
|
|
258
282
|
return;
|
|
259
283
|
}
|
|
260
284
|
if (!this.recordingActive) {
|
|
261
|
-
hksvDebug(
|
|
262
|
-
connection.sendResponse("dataSend" /* Protocols.DATA_SEND */, "open" /* Topics.OPEN */, id,
|
|
263
|
-
status:
|
|
285
|
+
hksvDebug('[HDS %s] rejecting DATA_SEND OPEN: recordingActive=false', connection.remoteAddress);
|
|
286
|
+
connection.sendResponse("dataSend" /* Protocols.DATA_SEND */, "open" /* Topics.OPEN */, id, HDSStatus.PROTOCOL_SPECIFIC_ERROR, {
|
|
287
|
+
status: HDSProtocolSpecificErrorReason.NOT_ALLOWED,
|
|
264
288
|
});
|
|
265
289
|
return;
|
|
266
290
|
}
|
|
267
|
-
if (!this.operatingModeService.getCharacteristic(
|
|
268
|
-
hksvDebug(
|
|
269
|
-
connection.sendResponse("dataSend" /* Protocols.DATA_SEND */, "open" /* Topics.OPEN */, id,
|
|
270
|
-
status:
|
|
291
|
+
if (!this.operatingModeService.getCharacteristic(Characteristic.HomeKitCameraActive).value) {
|
|
292
|
+
hksvDebug('[HDS %s] rejecting DATA_SEND OPEN: HomeKitCameraActive=false', connection.remoteAddress);
|
|
293
|
+
connection.sendResponse("dataSend" /* Protocols.DATA_SEND */, "open" /* Topics.OPEN */, id, HDSStatus.PROTOCOL_SPECIFIC_ERROR, {
|
|
294
|
+
status: HDSProtocolSpecificErrorReason.NOT_ALLOWED,
|
|
271
295
|
});
|
|
272
296
|
return;
|
|
273
297
|
}
|
|
274
298
|
if (this.recordingStream) {
|
|
275
|
-
debug(
|
|
299
|
+
debug('[HDS %s] Rejecting DATA_SEND OPEN as another stream (%s) is already recording with streamId %d!', connection.remoteAddress, this.recordingStream.connection.remoteAddress, this.recordingStream.streamId);
|
|
276
300
|
// there is already a recording stream running.
|
|
277
|
-
connection.sendResponse("dataSend" /* Protocols.DATA_SEND */, "open" /* Topics.OPEN */, id,
|
|
278
|
-
status:
|
|
301
|
+
connection.sendResponse("dataSend" /* Protocols.DATA_SEND */, "open" /* Topics.OPEN */, id, HDSStatus.PROTOCOL_SPECIFIC_ERROR, {
|
|
302
|
+
status: HDSProtocolSpecificErrorReason.BUSY,
|
|
279
303
|
});
|
|
280
304
|
return;
|
|
281
305
|
}
|
|
282
306
|
if (!this.selectedConfiguration) {
|
|
283
|
-
hksvDebug(
|
|
284
|
-
connection.sendResponse("dataSend" /* Protocols.DATA_SEND */, "open" /* Topics.OPEN */, id,
|
|
285
|
-
status:
|
|
307
|
+
hksvDebug('[HDS %s] rejecting DATA_SEND OPEN: no selectedConfiguration (homebridge#3928)', connection.remoteAddress);
|
|
308
|
+
connection.sendResponse("dataSend" /* Protocols.DATA_SEND */, "open" /* Topics.OPEN */, id, HDSStatus.PROTOCOL_SPECIFIC_ERROR, {
|
|
309
|
+
status: HDSProtocolSpecificErrorReason.INVALID_CONFIGURATION,
|
|
286
310
|
});
|
|
287
311
|
return;
|
|
288
312
|
}
|
|
289
|
-
debug(
|
|
290
|
-
// eslint-disable-next-line
|
|
313
|
+
debug('[HDS %s] HDS DATA_SEND Open with reason \'%s\'.', connection.remoteAddress, reason);
|
|
314
|
+
// eslint-disable-next-line ts/no-use-before-define
|
|
291
315
|
this.recordingStream = new CameraRecordingStream(connection, this.delegate, id, streamId);
|
|
292
316
|
this.recordingStream.on("closed" /* CameraRecordingStreamEvents.CLOSED */, () => {
|
|
293
|
-
debug(
|
|
317
|
+
debug('[HDS %s] Removing active recoding session from recording management!', connection.remoteAddress);
|
|
294
318
|
this.recordingStream = undefined;
|
|
295
319
|
});
|
|
296
320
|
this.recordingStream.startStreaming();
|
|
297
321
|
}
|
|
298
322
|
handleSelectedCameraRecordingConfigurationRead() {
|
|
299
323
|
if (!this.selectedConfiguration) {
|
|
300
|
-
throw new
|
|
324
|
+
throw new HapStatusError(HAPStatus.SERVICE_COMMUNICATION_FAILURE);
|
|
301
325
|
}
|
|
302
326
|
return this.selectedConfiguration.base64;
|
|
303
327
|
}
|
|
304
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
305
328
|
handleSelectedCameraRecordingConfigurationWrite(value) {
|
|
306
329
|
const configuration = this.parseSelectedConfiguration(value);
|
|
307
330
|
const changed = this.selectedConfiguration?.base64 !== value;
|
|
308
|
-
hksvDebug(
|
|
331
|
+
hksvDebug('SelectedRecordingConfiguration write: changed=%s hasStateChangeDelegate=%s base64Len=%d', changed, !!this.stateChangeDelegate, typeof value === 'string'
|
|
332
|
+
? value.length
|
|
333
|
+
: -1);
|
|
309
334
|
this.selectedConfiguration = {
|
|
310
335
|
parsed: configuration,
|
|
311
336
|
base64: value,
|
|
@@ -317,7 +342,7 @@ class RecordingManagement {
|
|
|
317
342
|
}
|
|
318
343
|
}
|
|
319
344
|
parseSelectedConfiguration(value) {
|
|
320
|
-
const decoded = tlv.decode(Buffer.from(value,
|
|
345
|
+
const decoded = tlv.decode(Buffer.from(value, 'base64'));
|
|
321
346
|
const recording = tlv.decode(decoded[1 /* SelectedCameraRecordingConfigurationTypes.SELECTED_RECORDING_CONFIGURATION */]);
|
|
322
347
|
const video = tlv.decode(decoded[2 /* SelectedCameraRecordingConfigurationTypes.SELECTED_VIDEO_CONFIGURATION */]);
|
|
323
348
|
const audio = tlv.decode(decoded[3 /* SelectedCameraRecordingConfigurationTypes.SELECTED_AUDIO_CONFIGURATION */]);
|
|
@@ -353,7 +378,7 @@ class RecordingManagement {
|
|
|
353
378
|
bit_index += 1; // count our current bit index
|
|
354
379
|
}
|
|
355
380
|
return {
|
|
356
|
-
prebufferLength
|
|
381
|
+
prebufferLength,
|
|
357
382
|
eventTriggerTypes: typedEventTriggers,
|
|
358
383
|
mediaContainerConfiguration: {
|
|
359
384
|
type: containerType,
|
|
@@ -362,10 +387,10 @@ class RecordingManagement {
|
|
|
362
387
|
videoCodec: {
|
|
363
388
|
type: videoCodec,
|
|
364
389
|
parameters: {
|
|
365
|
-
profile
|
|
366
|
-
level
|
|
390
|
+
profile,
|
|
391
|
+
level,
|
|
367
392
|
bitRate: videoBitrate,
|
|
368
|
-
iFrameInterval
|
|
393
|
+
iFrameInterval,
|
|
369
394
|
},
|
|
370
395
|
resolution: [width, height, framerate],
|
|
371
396
|
},
|
|
@@ -386,23 +411,23 @@ class RecordingManagement {
|
|
|
386
411
|
const eventTriggerOptions = Buffer.alloc(8);
|
|
387
412
|
prebufferLength.writeInt32LE(options.prebufferLength, 0);
|
|
388
413
|
eventTriggerOptions.writeInt32LE(this.eventTriggerOptions, 0);
|
|
389
|
-
return tlv.encode(1 /* SupportedCameraRecordingConfigurationTypes.PREBUFFER_LENGTH */, prebufferLength, 2 /* SupportedCameraRecordingConfigurationTypes.EVENT_TRIGGER_OPTIONS */, eventTriggerOptions, 3 /* SupportedCameraRecordingConfigurationTypes.MEDIA_CONTAINER_CONFIGURATIONS */, mediaContainers.map(config => {
|
|
414
|
+
return tlv.encode(1 /* SupportedCameraRecordingConfigurationTypes.PREBUFFER_LENGTH */, prebufferLength, 2 /* SupportedCameraRecordingConfigurationTypes.EVENT_TRIGGER_OPTIONS */, eventTriggerOptions, 3 /* SupportedCameraRecordingConfigurationTypes.MEDIA_CONTAINER_CONFIGURATIONS */, mediaContainers.map((config) => {
|
|
390
415
|
const fragmentLength = Buffer.alloc(4);
|
|
391
416
|
fragmentLength.writeInt32LE(config.fragmentLength, 0);
|
|
392
417
|
return tlv.encode(1 /* MediaContainerConfigurationTypes.MEDIA_CONTAINER_TYPE */, config.type, 2 /* MediaContainerConfigurationTypes.MEDIA_CONTAINER_PARAMETERS */, tlv.encode(1 /* MediaContainerParameterTypes.FRAGMENT_LENGTH */, fragmentLength));
|
|
393
|
-
})).toString(
|
|
418
|
+
})).toString('base64');
|
|
394
419
|
}
|
|
395
420
|
_supportedVideoRecordingConfiguration(videoOptions) {
|
|
396
421
|
if (!videoOptions.parameters) {
|
|
397
|
-
throw new Error(
|
|
422
|
+
throw new Error('Video parameters cannot be undefined');
|
|
398
423
|
}
|
|
399
424
|
if (!videoOptions.resolutions) {
|
|
400
|
-
throw new Error(
|
|
425
|
+
throw new Error('Video resolutions cannot be undefined');
|
|
401
426
|
}
|
|
402
427
|
const codecParameters = tlv.encode(1 /* VideoCodecParametersTypes.PROFILE_ID */, videoOptions.parameters.profiles, 2 /* VideoCodecParametersTypes.LEVEL */, videoOptions.parameters.levels);
|
|
403
|
-
const videoStreamConfiguration = tlv.encode(1 /* VideoCodecConfigurationTypes.CODEC_TYPE */, videoOptions.type, 2 /* VideoCodecConfigurationTypes.CODEC_PARAMETERS */, codecParameters, 3 /* VideoCodecConfigurationTypes.ATTRIBUTES */, videoOptions.resolutions.map(resolution => {
|
|
428
|
+
const videoStreamConfiguration = tlv.encode(1 /* VideoCodecConfigurationTypes.CODEC_TYPE */, videoOptions.type, 2 /* VideoCodecConfigurationTypes.CODEC_PARAMETERS */, codecParameters, 3 /* VideoCodecConfigurationTypes.ATTRIBUTES */, videoOptions.resolutions.map((resolution) => {
|
|
404
429
|
if (resolution.length !== 3) {
|
|
405
|
-
throw new Error(
|
|
430
|
+
throw new Error('Unexpected video resolution');
|
|
406
431
|
}
|
|
407
432
|
const width = Buffer.alloc(2);
|
|
408
433
|
const height = Buffer.alloc(2);
|
|
@@ -412,33 +437,33 @@ class RecordingManagement {
|
|
|
412
437
|
frameRate.writeUInt8(resolution[2], 0);
|
|
413
438
|
return tlv.encode(1 /* VideoAttributesTypes.IMAGE_WIDTH */, width, 2 /* VideoAttributesTypes.IMAGE_HEIGHT */, height, 3 /* VideoAttributesTypes.FRAME_RATE */, frameRate);
|
|
414
439
|
}));
|
|
415
|
-
return tlv.encode(1 /* SupportedVideoRecordingConfigurationTypes.VIDEO_CODEC_CONFIGURATION */, videoStreamConfiguration).toString(
|
|
440
|
+
return tlv.encode(1 /* SupportedVideoRecordingConfigurationTypes.VIDEO_CODEC_CONFIGURATION */, videoStreamConfiguration).toString('base64');
|
|
416
441
|
}
|
|
417
442
|
_supportedAudioStreamConfiguration(audioOptions) {
|
|
418
443
|
const audioCodecs = Array.isArray(audioOptions.codecs)
|
|
419
444
|
? audioOptions.codecs
|
|
420
445
|
: [audioOptions.codecs];
|
|
421
446
|
if (audioCodecs.length === 0) {
|
|
422
|
-
throw Error(
|
|
447
|
+
throw new Error('CameraRecordingOptions.audio: At least one audio codec configuration must be specified!');
|
|
423
448
|
}
|
|
424
|
-
const codecConfigurations = audioCodecs.map(codec => {
|
|
449
|
+
const codecConfigurations = audioCodecs.map((codec) => {
|
|
425
450
|
const providedSamplerates = Array.isArray(codec.samplerate)
|
|
426
451
|
? codec.samplerate
|
|
427
452
|
: [codec.samplerate];
|
|
428
453
|
if (providedSamplerates.length === 0) {
|
|
429
|
-
throw new Error(
|
|
454
|
+
throw new Error('CameraRecordingOptions.audio.codecs: Audio samplerate cannot be empty!');
|
|
430
455
|
}
|
|
431
456
|
const audioParameters = tlv.encode(1 /* AudioCodecParametersTypes.CHANNEL */, Math.max(1, codec.audioChannels || 1), 2 /* AudioCodecParametersTypes.BIT_RATE */, codec.bitrateMode || 0 /* AudioBitrate.VARIABLE */, 3 /* AudioCodecParametersTypes.SAMPLE_RATE */, providedSamplerates);
|
|
432
457
|
return tlv.encode(1 /* AudioCodecConfigurationTypes.CODEC_TYPE */, codec.type, 2 /* AudioCodecConfigurationTypes.CODEC_PARAMETERS */, audioParameters);
|
|
433
458
|
});
|
|
434
|
-
return tlv.encode(1 /* SupportedAudioRecordingConfigurationTypes.AUDIO_CODEC_CONFIGURATION */, codecConfigurations).toString(
|
|
459
|
+
return tlv.encode(1 /* SupportedAudioRecordingConfigurationTypes.AUDIO_CODEC_CONFIGURATION */, codecConfigurations).toString('base64');
|
|
435
460
|
}
|
|
436
|
-
computeConfigurationHash(algorithm =
|
|
437
|
-
const configurationHash =
|
|
461
|
+
computeConfigurationHash(algorithm = 'sha256') {
|
|
462
|
+
const configurationHash = crypto.createHash(algorithm);
|
|
438
463
|
configurationHash.update(this.supportedCameraRecordingConfiguration);
|
|
439
464
|
configurationHash.update(this.supportedVideoRecordingConfiguration);
|
|
440
465
|
configurationHash.update(this.supportedAudioRecordingConfiguration);
|
|
441
|
-
return configurationHash.digest().toString(
|
|
466
|
+
return configurationHash.digest().toString('hex');
|
|
442
467
|
}
|
|
443
468
|
/**
|
|
444
469
|
* @private
|
|
@@ -446,15 +471,15 @@ class RecordingManagement {
|
|
|
446
471
|
serialize() {
|
|
447
472
|
return {
|
|
448
473
|
configurationHash: {
|
|
449
|
-
algorithm:
|
|
450
|
-
hash: this.computeConfigurationHash(
|
|
474
|
+
algorithm: 'sha256',
|
|
475
|
+
hash: this.computeConfigurationHash('sha256'),
|
|
451
476
|
},
|
|
452
477
|
selectedConfiguration: this.selectedConfiguration?.base64,
|
|
453
478
|
recordingActive: this.recordingActive,
|
|
454
|
-
recordingAudioActive: !!this.recordingManagementService.getCharacteristic(
|
|
455
|
-
eventSnapshotsActive: !!this.operatingModeService.getCharacteristic(
|
|
456
|
-
homeKitCameraActive: !!this.operatingModeService.getCharacteristic(
|
|
457
|
-
periodicSnapshotsActive: !!this.operatingModeService.getCharacteristic(
|
|
479
|
+
recordingAudioActive: !!this.recordingManagementService.getCharacteristic(Characteristic.RecordingAudioActive).value,
|
|
480
|
+
eventSnapshotsActive: !!this.operatingModeService.getCharacteristic(Characteristic.EventSnapshotsActive).value,
|
|
481
|
+
homeKitCameraActive: !!this.operatingModeService.getCharacteristic(Characteristic.HomeKitCameraActive).value,
|
|
482
|
+
periodicSnapshotsActive: !!this.operatingModeService.getCharacteristic(Characteristic.PeriodicSnapshotsActive).value,
|
|
458
483
|
};
|
|
459
484
|
}
|
|
460
485
|
/**
|
|
@@ -464,7 +489,7 @@ class RecordingManagement {
|
|
|
464
489
|
let changedState = false;
|
|
465
490
|
// we only restore the `selectedConfiguration` if our supported configuration hasn't changed.
|
|
466
491
|
const currentConfigurationHash = this.computeConfigurationHash(serialized.configurationHash.algorithm);
|
|
467
|
-
hksvDebug(
|
|
492
|
+
hksvDebug('deserialize: hasSavedSelectedConfig=%s savedHash=%s currentHash=%s hashMatch=%s recordingActive=%s', !!serialized.selectedConfiguration, serialized.configurationHash?.hash?.slice(0, 12), currentConfigurationHash.slice(0, 12), currentConfigurationHash === serialized.configurationHash?.hash, serialized.recordingActive);
|
|
468
493
|
if (serialized.selectedConfiguration) {
|
|
469
494
|
if (currentConfigurationHash === serialized.configurationHash.hash) {
|
|
470
495
|
this.selectedConfiguration = {
|
|
@@ -473,33 +498,33 @@ class RecordingManagement {
|
|
|
473
498
|
};
|
|
474
499
|
}
|
|
475
500
|
else {
|
|
476
|
-
hksvDebug(
|
|
501
|
+
hksvDebug('deserialize: discarding saved selectedConfiguration — supportedConfiguration hash changed since last run');
|
|
477
502
|
changedState = true;
|
|
478
503
|
}
|
|
479
504
|
}
|
|
480
505
|
this.recordingActive = serialized.recordingActive;
|
|
481
|
-
this.recordingManagementService.updateCharacteristic(
|
|
482
|
-
this.recordingManagementService.updateCharacteristic(
|
|
483
|
-
this.operatingModeService.updateCharacteristic(
|
|
484
|
-
this.operatingModeService.updateCharacteristic(
|
|
485
|
-
this.operatingModeService.updateCharacteristic(
|
|
506
|
+
this.recordingManagementService.updateCharacteristic(Characteristic.Active, serialized.recordingActive);
|
|
507
|
+
this.recordingManagementService.updateCharacteristic(Characteristic.RecordingAudioActive, serialized.recordingAudioActive);
|
|
508
|
+
this.operatingModeService.updateCharacteristic(Characteristic.EventSnapshotsActive, serialized.eventSnapshotsActive);
|
|
509
|
+
this.operatingModeService.updateCharacteristic(Characteristic.PeriodicSnapshotsActive, serialized.periodicSnapshotsActive);
|
|
510
|
+
this.operatingModeService.updateCharacteristic(Characteristic.HomeKitCameraActive, serialized.homeKitCameraActive);
|
|
486
511
|
for (const service of this.sensorServices) {
|
|
487
|
-
service.setCharacteristic(
|
|
512
|
+
service.setCharacteristic(Characteristic.StatusActive, serialized.homeKitCameraActive);
|
|
488
513
|
}
|
|
489
514
|
try {
|
|
490
515
|
if (this.selectedConfiguration) {
|
|
491
|
-
hksvDebug(
|
|
516
|
+
hksvDebug('deserialize: replaying updateRecordingConfiguration to delegate');
|
|
492
517
|
this.delegate.updateRecordingConfiguration(this.selectedConfiguration.parsed);
|
|
493
518
|
}
|
|
494
519
|
else {
|
|
495
|
-
hksvDebug(
|
|
520
|
+
hksvDebug('deserialize: no selectedConfiguration to restore');
|
|
496
521
|
}
|
|
497
522
|
if (serialized.recordingActive) {
|
|
498
523
|
this.delegate.updateRecordingActive(serialized.recordingActive);
|
|
499
524
|
}
|
|
500
525
|
}
|
|
501
526
|
catch (error) {
|
|
502
|
-
console.error(
|
|
527
|
+
console.error(`Failed to properly initialize CameraRecordingDelegate from persistent storage: ${error.stack}`);
|
|
503
528
|
}
|
|
504
529
|
if (changedState) {
|
|
505
530
|
this.stateChangeDelegate?.();
|
|
@@ -515,15 +540,15 @@ class RecordingManagement {
|
|
|
515
540
|
this.dataStreamManagement.destroy();
|
|
516
541
|
}
|
|
517
542
|
handleFactoryReset() {
|
|
518
|
-
hksvDebug(
|
|
543
|
+
hksvDebug('handleFactoryReset: clearing selectedConfiguration and resetting recording state');
|
|
519
544
|
this.selectedConfiguration = undefined;
|
|
520
|
-
this.recordingManagementService.updateCharacteristic(
|
|
521
|
-
this.recordingManagementService.updateCharacteristic(
|
|
522
|
-
this.operatingModeService.updateCharacteristic(
|
|
523
|
-
this.operatingModeService.updateCharacteristic(
|
|
524
|
-
this.operatingModeService.updateCharacteristic(
|
|
545
|
+
this.recordingManagementService.updateCharacteristic(Characteristic.Active, false);
|
|
546
|
+
this.recordingManagementService.updateCharacteristic(Characteristic.RecordingAudioActive, false);
|
|
547
|
+
this.operatingModeService.updateCharacteristic(Characteristic.EventSnapshotsActive, true);
|
|
548
|
+
this.operatingModeService.updateCharacteristic(Characteristic.PeriodicSnapshotsActive, true);
|
|
549
|
+
this.operatingModeService.updateCharacteristic(Characteristic.HomeKitCameraActive, true);
|
|
525
550
|
for (const service of this.sensorServices) {
|
|
526
|
-
service.setCharacteristic(
|
|
551
|
+
service.setCharacteristic(Characteristic.StatusActive, true);
|
|
527
552
|
}
|
|
528
553
|
try {
|
|
529
554
|
// notifying the delegate about the updated state
|
|
@@ -531,14 +556,14 @@ class RecordingManagement {
|
|
|
531
556
|
this.delegate.updateRecordingConfiguration(undefined);
|
|
532
557
|
}
|
|
533
558
|
catch (error) {
|
|
534
|
-
console.error(
|
|
559
|
+
console.error(`CameraRecordingDelegate failed to update state after handleFactoryReset: ${error.stack}`);
|
|
535
560
|
}
|
|
536
561
|
}
|
|
537
562
|
}
|
|
538
|
-
exports.RecordingManagement = RecordingManagement;
|
|
539
563
|
/**
|
|
540
564
|
* @group Camera
|
|
541
565
|
*/
|
|
566
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
542
567
|
var CameraRecordingStreamEvents;
|
|
543
568
|
(function (CameraRecordingStreamEvents) {
|
|
544
569
|
/**
|
|
@@ -554,8 +579,8 @@ var CameraRecordingStreamEvents;
|
|
|
554
579
|
*
|
|
555
580
|
* @group Camera
|
|
556
581
|
*/
|
|
557
|
-
// eslint-disable-next-line
|
|
558
|
-
class CameraRecordingStream extends
|
|
582
|
+
// eslint-disable-next-line ts/no-unsafe-declaration-merging
|
|
583
|
+
class CameraRecordingStream extends EventEmitter {
|
|
559
584
|
connection;
|
|
560
585
|
delegate;
|
|
561
586
|
hdsRequestId;
|
|
@@ -594,9 +619,9 @@ class CameraRecordingStream extends events_1.EventEmitter {
|
|
|
594
619
|
this._startStreaming();
|
|
595
620
|
}
|
|
596
621
|
async _startStreaming() {
|
|
597
|
-
debug(
|
|
598
|
-
this.connection.sendResponse("dataSend" /* Protocols.DATA_SEND */, "open" /* Topics.OPEN */, this.hdsRequestId,
|
|
599
|
-
status:
|
|
622
|
+
debug('[HDS %s] Sending DATA_SEND OPEN response for streamId %d', this.connection.remoteAddress, this.streamId);
|
|
623
|
+
this.connection.sendResponse("dataSend" /* Protocols.DATA_SEND */, "open" /* Topics.OPEN */, this.hdsRequestId, HDSStatus.SUCCESS, {
|
|
624
|
+
status: HDSStatus.SUCCESS,
|
|
600
625
|
});
|
|
601
626
|
// 256 KiB (1KiB to 900 KiB)
|
|
602
627
|
const maxChunk = 0x40000;
|
|
@@ -610,7 +635,7 @@ class CameraRecordingStream extends events_1.EventEmitter {
|
|
|
610
635
|
this.generator = this.delegate.handleRecordingStreamRequest(this.streamId, this.abortController.signal);
|
|
611
636
|
for await (const packet of this.generator) {
|
|
612
637
|
if (this.closed) {
|
|
613
|
-
debug(
|
|
638
|
+
debug('[HDS %s] Delegate yielded fragment after stream %d was already closed.', this.connection.remoteAddress, this.streamId);
|
|
614
639
|
break;
|
|
615
640
|
}
|
|
616
641
|
if (lastFragmentWasMarkedLast) {
|
|
@@ -629,19 +654,25 @@ class CameraRecordingStream extends events_1.EventEmitter {
|
|
|
629
654
|
// see https://github.com/Supereg/secure-video-specification#42-binary-data
|
|
630
655
|
const event = {
|
|
631
656
|
streamId: this.streamId,
|
|
632
|
-
packets: [
|
|
633
|
-
|
|
657
|
+
packets: [
|
|
658
|
+
{
|
|
659
|
+
data,
|
|
634
660
|
metadata: {
|
|
635
661
|
dataType: initialization ? "mediaInitialization" /* PacketDataType.MEDIA_INITIALIZATION */ : "mediaFragment" /* PacketDataType.MEDIA_FRAGMENT */,
|
|
636
|
-
dataSequenceNumber
|
|
637
|
-
dataChunkSequenceNumber
|
|
662
|
+
dataSequenceNumber,
|
|
663
|
+
dataChunkSequenceNumber,
|
|
638
664
|
isLastDataChunk: offset >= fragment.length,
|
|
639
|
-
dataTotalSize: dataChunkSequenceNumber === 1
|
|
665
|
+
dataTotalSize: dataChunkSequenceNumber === 1
|
|
666
|
+
? fragment.length
|
|
667
|
+
: undefined,
|
|
640
668
|
},
|
|
641
|
-
}
|
|
642
|
-
|
|
669
|
+
},
|
|
670
|
+
],
|
|
671
|
+
endOfStream: offset >= fragment.length
|
|
672
|
+
? Boolean(packet.isLast).valueOf()
|
|
673
|
+
: undefined,
|
|
643
674
|
};
|
|
644
|
-
debug(
|
|
675
|
+
debug('[HDS %s] Sending DATA_SEND DATA for stream %d with metadata: %o and length %d; EoS: %s', this.connection.remoteAddress, this.streamId, event.packets[0].metadata, data.length, event.endOfStream);
|
|
645
676
|
this.connection.sendEvent("dataSend" /* Protocols.DATA_SEND */, "data" /* Topics.DATA */, event);
|
|
646
677
|
dataChunkSequenceNumber++;
|
|
647
678
|
initialization = false;
|
|
@@ -654,8 +685,8 @@ class CameraRecordingStream extends events_1.EventEmitter {
|
|
|
654
685
|
}
|
|
655
686
|
if (!lastFragmentWasMarkedLast && !this.closed) {
|
|
656
687
|
// Delegate violates the contract. Exited normally on a non-closed stream without properly setting `isLast`.
|
|
657
|
-
console.warn(`[HDS ${this.connection.remoteAddress}] Delegate finished streaming for ${this.streamId} without setting RecordingPacket.isLast. `
|
|
658
|
-
|
|
688
|
+
console.warn(`[HDS ${this.connection.remoteAddress}] Delegate finished streaming for ${this.streamId} without setting RecordingPacket.isLast. `
|
|
689
|
+
+ 'Can\'t notify Controller about endOfStream!');
|
|
659
690
|
}
|
|
660
691
|
}
|
|
661
692
|
catch (error) {
|
|
@@ -663,14 +694,14 @@ class CameraRecordingStream extends events_1.EventEmitter {
|
|
|
663
694
|
console.warn(`[HDS ${this.connection.remoteAddress}] Encountered unexpected error on already closed recording stream ${this.streamId}: ${error.stack}`);
|
|
664
695
|
}
|
|
665
696
|
else {
|
|
666
|
-
let closeReason =
|
|
667
|
-
if (error instanceof
|
|
697
|
+
let closeReason = HDSProtocolSpecificErrorReason.UNEXPECTED_FAILURE;
|
|
698
|
+
if (error instanceof HDSProtocolError) {
|
|
668
699
|
closeReason = error.reason;
|
|
669
|
-
debug(
|
|
700
|
+
debug('[HDS %s] Delegate signaled to close the recording stream %d.', this.connection.remoteAddress, this.streamId);
|
|
670
701
|
}
|
|
671
|
-
else if (error instanceof
|
|
702
|
+
else if (error instanceof HDSConnectionError && error.type === 2 /* HDSConnectionErrorType.CLOSED_SOCKET */) {
|
|
672
703
|
// we are probably on a shutdown or just late. Connection is dead. End the stream!
|
|
673
|
-
debug(
|
|
704
|
+
debug('[HDS %s] Exited recording stream due to closed HDS socket: stream id %d.', this.connection.remoteAddress, this.streamId);
|
|
674
705
|
return; // execute finally and then exit (we want to skip the `sendEvent` below)
|
|
675
706
|
}
|
|
676
707
|
else {
|
|
@@ -694,19 +725,17 @@ class CameraRecordingStream extends events_1.EventEmitter {
|
|
|
694
725
|
this.kickOffCloseTimeout();
|
|
695
726
|
}
|
|
696
727
|
}
|
|
697
|
-
debug(
|
|
728
|
+
debug('[HDS %s] Finished DATA_SEND transmission for stream %d!', this.connection.remoteAddress, this.streamId);
|
|
698
729
|
}
|
|
699
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
700
730
|
handleDataSendAck(message) {
|
|
701
731
|
const streamId = message.streamId;
|
|
702
732
|
const endOfStream = message.endOfStream;
|
|
703
733
|
// The HomeKit Controller will send a DATA_SEND ACK if we set the `endOfStream` flag in the last packet
|
|
704
734
|
// of our DATA_SEND DATA packet.
|
|
705
735
|
// To my testing the session is then considered complete and the HomeKit controller will close the HDS Connection after 5 seconds.
|
|
706
|
-
debug(
|
|
736
|
+
debug('[HDS %s] Received DATA_SEND ACK packet for streamId %s. Acknowledged %s.', this.connection.remoteAddress, streamId, endOfStream);
|
|
707
737
|
this.handleClosed(() => this.delegate.acknowledgeStream?.(this.streamId));
|
|
708
738
|
}
|
|
709
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
710
739
|
handleDataSendClose(message) {
|
|
711
740
|
// see https://github.com/Supereg/secure-video-specification#43-close
|
|
712
741
|
const streamId = message.streamId;
|
|
@@ -714,13 +743,11 @@ class CameraRecordingStream extends events_1.EventEmitter {
|
|
|
714
743
|
if (streamId !== this.streamId) {
|
|
715
744
|
return;
|
|
716
745
|
}
|
|
717
|
-
debug(
|
|
718
|
-
// @ts-expect-error: forceConsistentCasingInFileNames compiler option
|
|
719
|
-
this.connection.remoteAddress, streamId, datastream_1.HDSProtocolSpecificErrorReason[reason]);
|
|
746
|
+
debug('[HDS %s] Received DATA_SEND CLOSE for streamId %d with reason %s', this.connection.remoteAddress, streamId, HDSProtocolSpecificErrorReason[reason]);
|
|
720
747
|
this.handleClosed(() => this.delegate.closeRecordingStream(streamId, reason));
|
|
721
748
|
}
|
|
722
749
|
handleDataStreamConnectionClosed() {
|
|
723
|
-
debug(
|
|
750
|
+
debug('[HDS %s] The HDS connection of the stream %d closed.', this.connection.remoteAddress, this.streamId);
|
|
724
751
|
this.handleClosed(() => this.delegate.closeRecordingStream(this.streamId, undefined));
|
|
725
752
|
}
|
|
726
753
|
handleClosed(closure) {
|
|
@@ -743,12 +770,12 @@ class CameraRecordingStream extends events_1.EventEmitter {
|
|
|
743
770
|
// generator terminates promptly even if the delegate doesn't check the signal. We catch rejections
|
|
744
771
|
// to prevent unhandled promise warnings if the generator's cleanup throws.
|
|
745
772
|
// @ts-expect-error: AsyncGenerator.return() requires a value parameter, but we're signaling termination.
|
|
746
|
-
void this.generator.return().catch((error) => debug(
|
|
773
|
+
void this.generator.return().catch((error) => debug('[HDS %s] Error while closing recording generator for stream %d: %s', this.connection.remoteAddress, this.streamId, error.stack ?? String(error)));
|
|
747
774
|
// when this variable is defined, the generator hasn't returned yet.
|
|
748
775
|
// we start a timeout to uncover potential programming mistakes where we await forever and can't free resources.
|
|
749
776
|
this.generatorTimeout = setTimeout(() => {
|
|
750
|
-
console.error(
|
|
751
|
-
|
|
777
|
+
console.error('[HDS %s] Recording download stream %d is still awaiting generator although stream was closed 10s ago! '
|
|
778
|
+
+ 'This is a programming mistake by the camera implementation which prevents freeing up resources.', this.connection.remoteAddress, this.streamId);
|
|
752
779
|
}, 10000);
|
|
753
780
|
}
|
|
754
781
|
try {
|
|
@@ -767,14 +794,12 @@ class CameraRecordingStream extends events_1.EventEmitter {
|
|
|
767
794
|
if (this.closed) {
|
|
768
795
|
return;
|
|
769
796
|
}
|
|
770
|
-
debug(
|
|
771
|
-
// @ts-expect-error: forceConsistentCasingInFileNames compiler option
|
|
772
|
-
this.connection.remoteAddress, this.streamId, reason ? datastream_1.HDSProtocolSpecificErrorReason[reason] : "CLOSED");
|
|
797
|
+
debug('[HDS %s] Recording stream %d was closed manually with reason %s.', this.connection.remoteAddress, this.streamId, reason ? HDSProtocolSpecificErrorReason[reason] : 'CLOSED');
|
|
773
798
|
// the `isConsideredClosed` check just ensures that the won't ever throw here and that `handledClosed` is always executed.
|
|
774
799
|
if (!this.connection.isConsideredClosed()) {
|
|
775
800
|
this.connection.sendEvent("dataSend" /* Protocols.DATA_SEND */, "close" /* Topics.CLOSE */, {
|
|
776
801
|
streamId: this.streamId,
|
|
777
|
-
reason
|
|
802
|
+
reason,
|
|
778
803
|
});
|
|
779
804
|
}
|
|
780
805
|
this.handleClosed(() => this.delegate.closeRecordingStream(this.streamId, reason));
|
|
@@ -787,8 +812,8 @@ class CameraRecordingStream extends events_1.EventEmitter {
|
|
|
787
812
|
if (this.closed) {
|
|
788
813
|
return;
|
|
789
814
|
}
|
|
790
|
-
debug(
|
|
791
|
-
this.close(
|
|
815
|
+
debug('[HDS %s] Recording stream %d took longer than expected to fully close. Force closing now!', this.connection.remoteAddress, this.streamId);
|
|
816
|
+
this.close(HDSProtocolSpecificErrorReason.CANCELLED);
|
|
792
817
|
}, 12000);
|
|
793
818
|
}
|
|
794
819
|
}
|