hap-nodejs 1.1.1-beta.2 → 1.1.1-beta.3
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/@types/bonjour-hap.d.ts +50 -53
- package/README.md +16 -19
- package/dist/accessories/AirConditioner_accessory.js +28 -30
- package/dist/accessories/AirConditioner_accessory.js.map +1 -1
- package/dist/accessories/AppleTVRemote_accessory.js +69 -81
- package/dist/accessories/AppleTVRemote_accessory.js.map +1 -1
- package/dist/accessories/Camera_accessory.js +141 -136
- package/dist/accessories/Camera_accessory.js.map +1 -1
- package/dist/accessories/Fan_accessory.js +18 -22
- 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 +42 -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 +25 -26
- package/dist/accessories/Lock_accessory.js.map +1 -1
- package/dist/accessories/MotionSensor_accessory.js +13 -16
- 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 +34 -37
- 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 -15
- 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 +37 -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/index.d.ts +26 -28
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +40 -34
- 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 -21
- package/dist/internal-types.js.map +1 -1
- package/dist/lib/Accessory.d.ts +38 -37
- package/dist/lib/Accessory.d.ts.map +1 -1
- package/dist/lib/Accessory.js +286 -291
- package/dist/lib/Accessory.js.map +1 -1
- package/dist/lib/Advertiser.d.ts +7 -7
- package/dist/lib/Advertiser.d.ts.map +1 -1
- package/dist/lib/Advertiser.js +128 -136
- 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 +204 -208
- 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 +220 -229
- package/dist/lib/HAPServer.js.map +1 -1
- package/dist/lib/Service.d.ts +22 -22
- package/dist/lib/Service.d.ts.map +1 -1
- package/dist/lib/Service.js +63 -67
- 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 +28 -44
- 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 +179 -151
- package/dist/lib/camera/RTPStreamManagement.js.map +1 -1
- package/dist/lib/camera/RecordingManagement.d.ts +19 -17
- package/dist/lib/camera/RecordingManagement.d.ts.map +1 -1
- package/dist/lib/camera/RecordingManagement.js +160 -151
- 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 +33 -33
- package/dist/lib/controller/AdaptiveLightingController.d.ts.map +1 -1
- package/dist/lib/controller/AdaptiveLightingController.js +152 -144
- package/dist/lib/controller/AdaptiveLightingController.js.map +1 -1
- package/dist/lib/controller/CameraController.d.ts +22 -20
- package/dist/lib/controller/CameraController.d.ts.map +1 -1
- package/dist/lib/controller/CameraController.js +74 -78
- package/dist/lib/controller/CameraController.js.map +1 -1
- package/dist/lib/controller/Controller.d.ts +4 -4
- 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 +5 -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 +39 -37
- package/dist/lib/controller/RemoteController.d.ts.map +1 -1
- package/dist/lib/controller/RemoteController.js +208 -197
- 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 +39 -39
- 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 +57 -77
- package/dist/lib/datastream/DataStreamParser.js.map +1 -1
- package/dist/lib/datastream/DataStreamServer.d.ts +23 -22
- package/dist/lib/datastream/DataStreamServer.d.ts.map +1 -1
- package/dist/lib/datastream/DataStreamServer.js +154 -164
- 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/dbus/align.d.ts +2 -0
- package/dist/lib/dbus/align.d.ts.map +1 -0
- package/dist/lib/dbus/align.js +12 -0
- package/dist/lib/dbus/align.js.map +1 -0
- package/dist/lib/dbus/bus.d.ts +38 -0
- package/dist/lib/dbus/bus.d.ts.map +1 -0
- package/dist/lib/dbus/bus.js +222 -0
- package/dist/lib/dbus/bus.js.map +1 -0
- package/dist/lib/dbus/constants.d.ts +43 -0
- package/dist/lib/dbus/constants.d.ts.map +1 -0
- package/dist/lib/dbus/constants.js +53 -0
- package/dist/lib/dbus/constants.js.map +1 -0
- package/dist/lib/dbus/dbus-buffer.d.ts +30 -0
- package/dist/lib/dbus/dbus-buffer.d.ts.map +1 -0
- package/dist/lib/dbus/dbus-buffer.js +175 -0
- package/dist/lib/dbus/dbus-buffer.js.map +1 -0
- package/dist/lib/dbus/handshake.d.ts +2 -0
- package/dist/lib/dbus/handshake.d.ts.map +1 -0
- package/dist/lib/dbus/handshake.js +130 -0
- package/dist/lib/dbus/handshake.js.map +1 -0
- package/dist/lib/dbus/index.d.ts +3 -0
- package/dist/lib/dbus/index.d.ts.map +1 -0
- package/dist/lib/dbus/index.js +123 -0
- package/dist/lib/dbus/index.js.map +1 -0
- package/dist/lib/dbus/introspect.d.ts +30 -0
- package/dist/lib/dbus/introspect.d.ts.map +1 -0
- package/dist/lib/dbus/introspect.js +208 -0
- package/dist/lib/dbus/introspect.js.map +1 -0
- package/dist/lib/dbus/marshall.d.ts +2 -0
- package/dist/lib/dbus/marshall.d.ts.map +1 -0
- package/dist/lib/dbus/marshall.js +97 -0
- package/dist/lib/dbus/marshall.js.map +1 -0
- package/dist/lib/dbus/marshallers.d.ts +10 -0
- package/dist/lib/dbus/marshallers.d.ts.map +1 -0
- package/dist/lib/dbus/marshallers.js +329 -0
- package/dist/lib/dbus/marshallers.js.map +1 -0
- package/dist/lib/dbus/message.d.ts +4 -0
- package/dist/lib/dbus/message.d.ts.map +1 -0
- package/dist/lib/dbus/message.js +116 -0
- package/dist/lib/dbus/message.js.map +1 -0
- package/dist/lib/dbus/put.d.ts +21 -0
- package/dist/lib/dbus/put.d.ts.map +1 -0
- package/dist/lib/dbus/put.js +120 -0
- package/dist/lib/dbus/put.js.map +1 -0
- package/dist/lib/dbus/readline.d.ts +2 -0
- package/dist/lib/dbus/readline.d.ts.map +1 -0
- package/dist/lib/dbus/readline.js +27 -0
- package/dist/lib/dbus/readline.js.map +1 -0
- package/dist/lib/dbus/signature.d.ts +2 -0
- package/dist/lib/dbus/signature.d.ts.map +1 -0
- package/dist/lib/dbus/signature.js +58 -0
- package/dist/lib/dbus/signature.js.map +1 -0
- package/dist/lib/dbus/stdifaces.d.ts +3 -0
- package/dist/lib/dbus/stdifaces.d.ts.map +1 -0
- package/dist/lib/dbus/stdifaces.js +206 -0
- package/dist/lib/dbus/stdifaces.js.map +1 -0
- 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 +958 -1204
- 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 +620 -695
- package/dist/lib/definitions/ServiceDefinitions.js.map +1 -1
- package/dist/lib/definitions/generate-definitions.d.ts +3 -3
- package/dist/lib/definitions/generate-definitions.d.ts.map +1 -1
- package/dist/lib/definitions/generate-definitions.js +246 -253
- 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 +160 -165
- 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/model/AccessoryInfo.d.ts +4 -3
- package/dist/lib/model/AccessoryInfo.d.ts.map +1 -1
- package/dist/lib/model/AccessoryInfo.js +50 -53
- 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 +17 -22
- package/dist/lib/model/ControllerStorage.js.map +1 -1
- package/dist/lib/model/HAPStorage.d.ts +2 -2
- package/dist/lib/model/HAPStorage.d.ts.map +1 -1
- package/dist/lib/model/HAPStorage.js +4 -11
- 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 +19 -27
- package/dist/lib/model/IdentifierCache.js.map +1 -1
- package/dist/lib/tv/AccessControlManagement.d.ts +9 -9
- package/dist/lib/tv/AccessControlManagement.d.ts.map +1 -1
- package/dist/lib/tv/AccessControlManagement.js +27 -29
- 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 +6 -9
- 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 +4 -9
- 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 +109 -116
- package/dist/lib/util/eventedhttp.js.map +1 -1
- package/dist/lib/util/hapCrypto.d.ts +3 -2
- package/dist/lib/util/hapCrypto.d.ts.map +1 -1
- package/dist/lib/util/hapCrypto.js +31 -40
- 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 +4 -8
- package/dist/lib/util/hapStatusError.js.map +1 -1
- package/dist/lib/util/net-utils.d.ts +1 -1
- package/dist/lib/util/net-utils.js +17 -23
- package/dist/lib/util/net-utils.js.map +1 -1
- package/dist/lib/util/once.d.ts.map +1 -1
- package/dist/lib/util/once.js +2 -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 +3 -9
- package/dist/lib/util/promise-utils.js.map +1 -1
- package/dist/lib/util/request-util.d.ts +3 -2
- package/dist/lib/util/request-util.d.ts.map +1 -1
- package/dist/lib/util/request-util.js +11 -19
- 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 +28 -43
- 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 +48 -45
- package/@types/simple-plist.d.ts +0 -4
- package/dist/lib/gen/HomeKit.d.ts +0 -7
- package/dist/lib/gen/HomeKit.d.ts.map +0 -1
- package/dist/lib/gen/HomeKit.js +0 -8
- package/dist/lib/gen/HomeKit.js.map +0 -1
|
@@ -1,25 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
const
|
|
15
|
-
const uuid = tslib_1.__importStar(require("../util/uuid"));
|
|
16
|
-
const RTPProxy_1 = tslib_1.__importDefault(require("./RTPProxy"));
|
|
17
|
-
const debug = (0, debug_1.default)("HAP-NodeJS:Camera:RTPStreamManagement");
|
|
1
|
+
import assert from 'node:assert';
|
|
2
|
+
import { Buffer } from 'node:buffer';
|
|
3
|
+
import { randomBytes } from 'node:crypto';
|
|
4
|
+
import { isIPv4 } from 'node:net';
|
|
5
|
+
import createDebug from 'debug';
|
|
6
|
+
import { Characteristic } from '../Characteristic.js';
|
|
7
|
+
import { CameraController } from '../controller/index.js';
|
|
8
|
+
import { Service } from '../Service.js';
|
|
9
|
+
import { HapStatusError } from '../util/hapStatusError.js';
|
|
10
|
+
import { once } from '../util/once.js';
|
|
11
|
+
import { decode, encode, writeUInt16, writeUInt32 } from '../util/tlv.js';
|
|
12
|
+
import { unparse, write } from '../util/uuid.js';
|
|
13
|
+
import RTPProxy from './RTPProxy.js';
|
|
14
|
+
const debug = createDebug('HAP-NodeJS:Camera:RTPStreamManagement');
|
|
18
15
|
// ---------------------------------- TLV DEFINITIONS START ----------------------------------
|
|
16
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
19
17
|
var StreamingStatusTypes;
|
|
20
18
|
(function (StreamingStatusTypes) {
|
|
21
19
|
StreamingStatusTypes[StreamingStatusTypes["STATUS"] = 1] = "STATUS";
|
|
22
20
|
})(StreamingStatusTypes || (StreamingStatusTypes = {}));
|
|
21
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
23
22
|
var StreamingStatus;
|
|
24
23
|
(function (StreamingStatus) {
|
|
25
24
|
StreamingStatus[StreamingStatus["AVAILABLE"] = 0] = "AVAILABLE";
|
|
@@ -27,16 +26,19 @@ var StreamingStatus;
|
|
|
27
26
|
StreamingStatus[StreamingStatus["UNAVAILABLE"] = 2] = "UNAVAILABLE";
|
|
28
27
|
})(StreamingStatus || (StreamingStatus = {}));
|
|
29
28
|
// ----------
|
|
29
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
30
30
|
var SupportedVideoStreamConfigurationTypes;
|
|
31
31
|
(function (SupportedVideoStreamConfigurationTypes) {
|
|
32
32
|
SupportedVideoStreamConfigurationTypes[SupportedVideoStreamConfigurationTypes["VIDEO_CODEC_CONFIGURATION"] = 1] = "VIDEO_CODEC_CONFIGURATION";
|
|
33
33
|
})(SupportedVideoStreamConfigurationTypes || (SupportedVideoStreamConfigurationTypes = {}));
|
|
34
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
34
35
|
var VideoCodecConfigurationTypes;
|
|
35
36
|
(function (VideoCodecConfigurationTypes) {
|
|
36
37
|
VideoCodecConfigurationTypes[VideoCodecConfigurationTypes["CODEC_TYPE"] = 1] = "CODEC_TYPE";
|
|
37
38
|
VideoCodecConfigurationTypes[VideoCodecConfigurationTypes["CODEC_PARAMETERS"] = 2] = "CODEC_PARAMETERS";
|
|
38
39
|
VideoCodecConfigurationTypes[VideoCodecConfigurationTypes["ATTRIBUTES"] = 3] = "ATTRIBUTES";
|
|
39
40
|
})(VideoCodecConfigurationTypes || (VideoCodecConfigurationTypes = {}));
|
|
41
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
40
42
|
var VideoCodecParametersTypes;
|
|
41
43
|
(function (VideoCodecParametersTypes) {
|
|
42
44
|
VideoCodecParametersTypes[VideoCodecParametersTypes["PROFILE_ID"] = 1] = "PROFILE_ID";
|
|
@@ -45,6 +47,7 @@ var VideoCodecParametersTypes;
|
|
|
45
47
|
VideoCodecParametersTypes[VideoCodecParametersTypes["CVO_ENABLED"] = 4] = "CVO_ENABLED";
|
|
46
48
|
VideoCodecParametersTypes[VideoCodecParametersTypes["CVO_ID"] = 5] = "CVO_ID";
|
|
47
49
|
})(VideoCodecParametersTypes || (VideoCodecParametersTypes = {}));
|
|
50
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
48
51
|
var VideoAttributesTypes;
|
|
49
52
|
(function (VideoAttributesTypes) {
|
|
50
53
|
VideoAttributesTypes[VideoAttributesTypes["IMAGE_WIDTH"] = 1] = "IMAGE_WIDTH";
|
|
@@ -54,53 +57,61 @@ var VideoAttributesTypes;
|
|
|
54
57
|
/**
|
|
55
58
|
* @group Camera
|
|
56
59
|
*/
|
|
57
|
-
|
|
60
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
61
|
+
export var VideoCodecType;
|
|
58
62
|
(function (VideoCodecType) {
|
|
59
63
|
VideoCodecType[VideoCodecType["H264"] = 0] = "H264";
|
|
60
64
|
// while the namespace is already reserved for H265 it isn't currently supported.
|
|
61
65
|
// H265 = 0x01,
|
|
62
|
-
})(VideoCodecType || (
|
|
66
|
+
})(VideoCodecType || (VideoCodecType = {}));
|
|
63
67
|
/**
|
|
64
68
|
* @group Camera
|
|
65
69
|
*/
|
|
66
|
-
|
|
70
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
71
|
+
export var H264Profile;
|
|
67
72
|
(function (H264Profile) {
|
|
68
73
|
H264Profile[H264Profile["BASELINE"] = 0] = "BASELINE";
|
|
69
74
|
H264Profile[H264Profile["MAIN"] = 1] = "MAIN";
|
|
70
75
|
H264Profile[H264Profile["HIGH"] = 2] = "HIGH";
|
|
71
|
-
})(H264Profile || (
|
|
76
|
+
})(H264Profile || (H264Profile = {}));
|
|
72
77
|
/**
|
|
73
78
|
* @group Camera
|
|
74
79
|
*/
|
|
75
|
-
|
|
80
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
81
|
+
export var H264Level;
|
|
76
82
|
(function (H264Level) {
|
|
77
83
|
H264Level[H264Level["LEVEL3_1"] = 0] = "LEVEL3_1";
|
|
78
84
|
H264Level[H264Level["LEVEL3_2"] = 1] = "LEVEL3_2";
|
|
79
85
|
H264Level[H264Level["LEVEL4_0"] = 2] = "LEVEL4_0";
|
|
80
|
-
})(H264Level || (
|
|
86
|
+
})(H264Level || (H264Level = {}));
|
|
81
87
|
/**
|
|
82
88
|
* @group Camera
|
|
83
89
|
*/
|
|
84
|
-
|
|
90
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
91
|
+
export var VideoCodecPacketizationMode;
|
|
85
92
|
(function (VideoCodecPacketizationMode) {
|
|
86
93
|
VideoCodecPacketizationMode[VideoCodecPacketizationMode["NON_INTERLEAVED"] = 0] = "NON_INTERLEAVED";
|
|
87
|
-
})(VideoCodecPacketizationMode || (
|
|
94
|
+
})(VideoCodecPacketizationMode || (VideoCodecPacketizationMode = {}));
|
|
95
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
88
96
|
var VideoCodecCVO;
|
|
89
97
|
(function (VideoCodecCVO) {
|
|
90
98
|
VideoCodecCVO[VideoCodecCVO["UNSUPPORTED"] = 0] = "UNSUPPORTED";
|
|
91
99
|
VideoCodecCVO[VideoCodecCVO["SUPPORTED"] = 1] = "SUPPORTED";
|
|
92
100
|
})(VideoCodecCVO || (VideoCodecCVO = {}));
|
|
93
101
|
// ----------
|
|
102
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
94
103
|
var SupportedAudioStreamConfigurationTypes;
|
|
95
104
|
(function (SupportedAudioStreamConfigurationTypes) {
|
|
96
105
|
SupportedAudioStreamConfigurationTypes[SupportedAudioStreamConfigurationTypes["AUDIO_CODEC_CONFIGURATION"] = 1] = "AUDIO_CODEC_CONFIGURATION";
|
|
97
106
|
SupportedAudioStreamConfigurationTypes[SupportedAudioStreamConfigurationTypes["COMFORT_NOISE_SUPPORT"] = 2] = "COMFORT_NOISE_SUPPORT";
|
|
98
107
|
})(SupportedAudioStreamConfigurationTypes || (SupportedAudioStreamConfigurationTypes = {}));
|
|
108
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
99
109
|
var AudioCodecConfigurationTypes;
|
|
100
110
|
(function (AudioCodecConfigurationTypes) {
|
|
101
111
|
AudioCodecConfigurationTypes[AudioCodecConfigurationTypes["CODEC_TYPE"] = 1] = "CODEC_TYPE";
|
|
102
112
|
AudioCodecConfigurationTypes[AudioCodecConfigurationTypes["CODEC_PARAMETERS"] = 2] = "CODEC_PARAMETERS";
|
|
103
113
|
})(AudioCodecConfigurationTypes || (AudioCodecConfigurationTypes = {}));
|
|
114
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
104
115
|
var AudioCodecTypes;
|
|
105
116
|
(function (AudioCodecTypes) {
|
|
106
117
|
AudioCodecTypes[AudioCodecTypes["PCMU"] = 0] = "PCMU";
|
|
@@ -111,33 +122,37 @@ var AudioCodecTypes;
|
|
|
111
122
|
AudioCodecTypes[AudioCodecTypes["AMR"] = 5] = "AMR";
|
|
112
123
|
AudioCodecTypes[AudioCodecTypes["AMR_WB"] = 6] = "AMR_WB";
|
|
113
124
|
})(AudioCodecTypes || (AudioCodecTypes = {}));
|
|
125
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
114
126
|
var AudioCodecParametersTypes;
|
|
115
127
|
(function (AudioCodecParametersTypes) {
|
|
116
128
|
AudioCodecParametersTypes[AudioCodecParametersTypes["CHANNEL"] = 1] = "CHANNEL";
|
|
117
129
|
AudioCodecParametersTypes[AudioCodecParametersTypes["BIT_RATE"] = 2] = "BIT_RATE";
|
|
118
130
|
AudioCodecParametersTypes[AudioCodecParametersTypes["SAMPLE_RATE"] = 3] = "SAMPLE_RATE";
|
|
119
|
-
AudioCodecParametersTypes[AudioCodecParametersTypes["PACKET_TIME"] = 4] = "PACKET_TIME";
|
|
131
|
+
AudioCodecParametersTypes[AudioCodecParametersTypes["PACKET_TIME"] = 4] = "PACKET_TIME";
|
|
120
132
|
})(AudioCodecParametersTypes || (AudioCodecParametersTypes = {}));
|
|
121
133
|
/**
|
|
122
134
|
* @group Camera
|
|
123
135
|
*/
|
|
124
|
-
|
|
136
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
137
|
+
export var AudioBitrate;
|
|
125
138
|
(function (AudioBitrate) {
|
|
126
139
|
AudioBitrate[AudioBitrate["VARIABLE"] = 0] = "VARIABLE";
|
|
127
140
|
AudioBitrate[AudioBitrate["CONSTANT"] = 1] = "CONSTANT";
|
|
128
|
-
})(AudioBitrate || (
|
|
141
|
+
})(AudioBitrate || (AudioBitrate = {}));
|
|
129
142
|
/**
|
|
130
143
|
* @group Camera
|
|
131
144
|
*/
|
|
132
|
-
|
|
145
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
146
|
+
export var AudioSamplerate;
|
|
133
147
|
(function (AudioSamplerate) {
|
|
134
148
|
AudioSamplerate[AudioSamplerate["KHZ_8"] = 0] = "KHZ_8";
|
|
135
149
|
AudioSamplerate[AudioSamplerate["KHZ_16"] = 1] = "KHZ_16";
|
|
136
150
|
AudioSamplerate[AudioSamplerate["KHZ_24"] = 2] = "KHZ_24";
|
|
137
151
|
// 3, 4, 5 are theoretically defined, but no idea to what kHz value they correspond to
|
|
138
152
|
// probably KHZ_32, KHZ_44_1, KHZ_48 (as supported by Secure Video recordings)
|
|
139
|
-
})(AudioSamplerate || (
|
|
153
|
+
})(AudioSamplerate || (AudioSamplerate = {}));
|
|
140
154
|
// ----------
|
|
155
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
141
156
|
var SupportedRTPConfigurationTypes;
|
|
142
157
|
(function (SupportedRTPConfigurationTypes) {
|
|
143
158
|
SupportedRTPConfigurationTypes[SupportedRTPConfigurationTypes["SRTP_CRYPTO_SUITE"] = 2] = "SRTP_CRYPTO_SUITE";
|
|
@@ -145,13 +160,15 @@ var SupportedRTPConfigurationTypes;
|
|
|
145
160
|
/**
|
|
146
161
|
* @group Camera
|
|
147
162
|
*/
|
|
148
|
-
|
|
163
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
164
|
+
export var SRTPCryptoSuites;
|
|
149
165
|
(function (SRTPCryptoSuites) {
|
|
150
166
|
SRTPCryptoSuites[SRTPCryptoSuites["AES_CM_128_HMAC_SHA1_80"] = 0] = "AES_CM_128_HMAC_SHA1_80";
|
|
151
167
|
SRTPCryptoSuites[SRTPCryptoSuites["AES_CM_256_HMAC_SHA1_80"] = 1] = "AES_CM_256_HMAC_SHA1_80";
|
|
152
168
|
SRTPCryptoSuites[SRTPCryptoSuites["NONE"] = 2] = "NONE";
|
|
153
|
-
})(SRTPCryptoSuites || (
|
|
169
|
+
})(SRTPCryptoSuites || (SRTPCryptoSuites = {}));
|
|
154
170
|
// ----------
|
|
171
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
155
172
|
var SetupEndpointsTypes;
|
|
156
173
|
(function (SetupEndpointsTypes) {
|
|
157
174
|
SetupEndpointsTypes[SetupEndpointsTypes["SESSION_ID"] = 1] = "SESSION_ID";
|
|
@@ -159,6 +176,7 @@ var SetupEndpointsTypes;
|
|
|
159
176
|
SetupEndpointsTypes[SetupEndpointsTypes["VIDEO_SRTP_PARAMETERS"] = 4] = "VIDEO_SRTP_PARAMETERS";
|
|
160
177
|
SetupEndpointsTypes[SetupEndpointsTypes["AUDIO_SRTP_PARAMETERS"] = 5] = "AUDIO_SRTP_PARAMETERS";
|
|
161
178
|
})(SetupEndpointsTypes || (SetupEndpointsTypes = {}));
|
|
179
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
162
180
|
var AddressTypes;
|
|
163
181
|
(function (AddressTypes) {
|
|
164
182
|
AddressTypes[AddressTypes["ADDRESS_VERSION"] = 1] = "ADDRESS_VERSION";
|
|
@@ -166,17 +184,20 @@ var AddressTypes;
|
|
|
166
184
|
AddressTypes[AddressTypes["VIDEO_RTP_PORT"] = 3] = "VIDEO_RTP_PORT";
|
|
167
185
|
AddressTypes[AddressTypes["AUDIO_RTP_PORT"] = 4] = "AUDIO_RTP_PORT";
|
|
168
186
|
})(AddressTypes || (AddressTypes = {}));
|
|
187
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
169
188
|
var IPAddressVersion;
|
|
170
189
|
(function (IPAddressVersion) {
|
|
171
190
|
IPAddressVersion[IPAddressVersion["IPV4"] = 0] = "IPV4";
|
|
172
191
|
IPAddressVersion[IPAddressVersion["IPV6"] = 1] = "IPV6";
|
|
173
192
|
})(IPAddressVersion || (IPAddressVersion = {}));
|
|
193
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
174
194
|
var SRTPParametersTypes;
|
|
175
195
|
(function (SRTPParametersTypes) {
|
|
176
196
|
SRTPParametersTypes[SRTPParametersTypes["SRTP_CRYPTO_SUITE"] = 1] = "SRTP_CRYPTO_SUITE";
|
|
177
197
|
SRTPParametersTypes[SRTPParametersTypes["MASTER_KEY"] = 2] = "MASTER_KEY";
|
|
178
|
-
SRTPParametersTypes[SRTPParametersTypes["MASTER_SALT"] = 3] = "MASTER_SALT";
|
|
198
|
+
SRTPParametersTypes[SRTPParametersTypes["MASTER_SALT"] = 3] = "MASTER_SALT";
|
|
179
199
|
})(SRTPParametersTypes || (SRTPParametersTypes = {}));
|
|
200
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
180
201
|
var SetupEndpointsResponseTypes;
|
|
181
202
|
(function (SetupEndpointsResponseTypes) {
|
|
182
203
|
SetupEndpointsResponseTypes[SetupEndpointsResponseTypes["SESSION_ID"] = 1] = "SESSION_ID";
|
|
@@ -187,6 +208,7 @@ var SetupEndpointsResponseTypes;
|
|
|
187
208
|
SetupEndpointsResponseTypes[SetupEndpointsResponseTypes["VIDEO_SSRC"] = 6] = "VIDEO_SSRC";
|
|
188
209
|
SetupEndpointsResponseTypes[SetupEndpointsResponseTypes["AUDIO_SSRC"] = 7] = "AUDIO_SSRC";
|
|
189
210
|
})(SetupEndpointsResponseTypes || (SetupEndpointsResponseTypes = {}));
|
|
211
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
190
212
|
var SetupEndpointsStatus;
|
|
191
213
|
(function (SetupEndpointsStatus) {
|
|
192
214
|
SetupEndpointsStatus[SetupEndpointsStatus["SUCCESS"] = 0] = "SUCCESS";
|
|
@@ -194,12 +216,14 @@ var SetupEndpointsStatus;
|
|
|
194
216
|
SetupEndpointsStatus[SetupEndpointsStatus["ERROR"] = 2] = "ERROR";
|
|
195
217
|
})(SetupEndpointsStatus || (SetupEndpointsStatus = {}));
|
|
196
218
|
// ----------
|
|
219
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
197
220
|
var SelectedRTPStreamConfigurationTypes;
|
|
198
221
|
(function (SelectedRTPStreamConfigurationTypes) {
|
|
199
222
|
SelectedRTPStreamConfigurationTypes[SelectedRTPStreamConfigurationTypes["SESSION_CONTROL"] = 1] = "SESSION_CONTROL";
|
|
200
223
|
SelectedRTPStreamConfigurationTypes[SelectedRTPStreamConfigurationTypes["SELECTED_VIDEO_PARAMETERS"] = 2] = "SELECTED_VIDEO_PARAMETERS";
|
|
201
224
|
SelectedRTPStreamConfigurationTypes[SelectedRTPStreamConfigurationTypes["SELECTED_AUDIO_PARAMETERS"] = 3] = "SELECTED_AUDIO_PARAMETERS";
|
|
202
225
|
})(SelectedRTPStreamConfigurationTypes || (SelectedRTPStreamConfigurationTypes = {}));
|
|
226
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
203
227
|
var SessionControlTypes;
|
|
204
228
|
(function (SessionControlTypes) {
|
|
205
229
|
SessionControlTypes[SessionControlTypes["SESSION_IDENTIFIER"] = 1] = "SESSION_IDENTIFIER";
|
|
@@ -213,6 +237,7 @@ var SessionControlCommand;
|
|
|
213
237
|
SessionControlCommand[SessionControlCommand["RESUME_SESSION"] = 3] = "RESUME_SESSION";
|
|
214
238
|
SessionControlCommand[SessionControlCommand["RECONFIGURE_SESSION"] = 4] = "RECONFIGURE_SESSION";
|
|
215
239
|
})(SessionControlCommand || (SessionControlCommand = {}));
|
|
240
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
216
241
|
var SelectedVideoParametersTypes;
|
|
217
242
|
(function (SelectedVideoParametersTypes) {
|
|
218
243
|
SelectedVideoParametersTypes[SelectedVideoParametersTypes["CODEC_TYPE"] = 1] = "CODEC_TYPE";
|
|
@@ -220,6 +245,7 @@ var SelectedVideoParametersTypes;
|
|
|
220
245
|
SelectedVideoParametersTypes[SelectedVideoParametersTypes["ATTRIBUTES"] = 3] = "ATTRIBUTES";
|
|
221
246
|
SelectedVideoParametersTypes[SelectedVideoParametersTypes["RTP_PARAMETERS"] = 4] = "RTP_PARAMETERS";
|
|
222
247
|
})(SelectedVideoParametersTypes || (SelectedVideoParametersTypes = {}));
|
|
248
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
223
249
|
var VideoRTPParametersTypes;
|
|
224
250
|
(function (VideoRTPParametersTypes) {
|
|
225
251
|
VideoRTPParametersTypes[VideoRTPParametersTypes["PAYLOAD_TYPE"] = 1] = "PAYLOAD_TYPE";
|
|
@@ -228,6 +254,7 @@ var VideoRTPParametersTypes;
|
|
|
228
254
|
VideoRTPParametersTypes[VideoRTPParametersTypes["MIN_RTCP_INTERVAL"] = 4] = "MIN_RTCP_INTERVAL";
|
|
229
255
|
VideoRTPParametersTypes[VideoRTPParametersTypes["MAX_MTU"] = 5] = "MAX_MTU";
|
|
230
256
|
})(VideoRTPParametersTypes || (VideoRTPParametersTypes = {}));
|
|
257
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
231
258
|
var SelectedAudioParametersTypes;
|
|
232
259
|
(function (SelectedAudioParametersTypes) {
|
|
233
260
|
SelectedAudioParametersTypes[SelectedAudioParametersTypes["CODEC_TYPE"] = 1] = "CODEC_TYPE";
|
|
@@ -235,6 +262,7 @@ var SelectedAudioParametersTypes;
|
|
|
235
262
|
SelectedAudioParametersTypes[SelectedAudioParametersTypes["RTP_PARAMETERS"] = 3] = "RTP_PARAMETERS";
|
|
236
263
|
SelectedAudioParametersTypes[SelectedAudioParametersTypes["COMFORT_NOISE"] = 4] = "COMFORT_NOISE";
|
|
237
264
|
})(SelectedAudioParametersTypes || (SelectedAudioParametersTypes = {}));
|
|
265
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
238
266
|
var AudioRTPParametersTypes;
|
|
239
267
|
(function (AudioRTPParametersTypes) {
|
|
240
268
|
AudioRTPParametersTypes[AudioRTPParametersTypes["PAYLOAD_TYPE"] = 1] = "PAYLOAD_TYPE";
|
|
@@ -243,14 +271,14 @@ var AudioRTPParametersTypes;
|
|
|
243
271
|
AudioRTPParametersTypes[AudioRTPParametersTypes["MIN_RTCP_INTERVAL"] = 4] = "MIN_RTCP_INTERVAL";
|
|
244
272
|
AudioRTPParametersTypes[AudioRTPParametersTypes["COMFORT_NOISE_PAYLOAD_TYPE"] = 6] = "COMFORT_NOISE_PAYLOAD_TYPE";
|
|
245
273
|
})(AudioRTPParametersTypes || (AudioRTPParametersTypes = {}));
|
|
246
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
247
274
|
function isLegacySRTPOptions(options) {
|
|
248
|
-
return
|
|
275
|
+
return 'srtp' in options;
|
|
249
276
|
}
|
|
250
277
|
/**
|
|
251
278
|
* @group Camera
|
|
252
279
|
*/
|
|
253
|
-
|
|
280
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
281
|
+
export var AudioStreamingCodecType;
|
|
254
282
|
(function (AudioStreamingCodecType) {
|
|
255
283
|
AudioStreamingCodecType["PCMU"] = "PCMU";
|
|
256
284
|
AudioStreamingCodecType["PCMA"] = "PCMA";
|
|
@@ -259,29 +287,31 @@ var AudioStreamingCodecType;
|
|
|
259
287
|
AudioStreamingCodecType["MSBC"] = "mSBC";
|
|
260
288
|
AudioStreamingCodecType["AMR"] = "AMR";
|
|
261
289
|
AudioStreamingCodecType["AMR_WB"] = "AMR-WB";
|
|
262
|
-
})(AudioStreamingCodecType || (
|
|
290
|
+
})(AudioStreamingCodecType || (AudioStreamingCodecType = {}));
|
|
263
291
|
/**
|
|
264
292
|
* @group Camera
|
|
265
293
|
*/
|
|
266
|
-
|
|
294
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
295
|
+
export var AudioStreamingSamplerate;
|
|
267
296
|
(function (AudioStreamingSamplerate) {
|
|
268
297
|
AudioStreamingSamplerate[AudioStreamingSamplerate["KHZ_8"] = 8] = "KHZ_8";
|
|
269
298
|
AudioStreamingSamplerate[AudioStreamingSamplerate["KHZ_16"] = 16] = "KHZ_16";
|
|
270
299
|
AudioStreamingSamplerate[AudioStreamingSamplerate["KHZ_24"] = 24] = "KHZ_24";
|
|
271
|
-
})(AudioStreamingSamplerate || (
|
|
300
|
+
})(AudioStreamingSamplerate || (AudioStreamingSamplerate = {}));
|
|
272
301
|
/**
|
|
273
302
|
* @group Camera
|
|
274
303
|
*/
|
|
275
|
-
|
|
304
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
305
|
+
export var StreamRequestTypes;
|
|
276
306
|
(function (StreamRequestTypes) {
|
|
277
307
|
StreamRequestTypes["RECONFIGURE"] = "reconfigure";
|
|
278
308
|
StreamRequestTypes["START"] = "start";
|
|
279
309
|
StreamRequestTypes["STOP"] = "stop";
|
|
280
|
-
})(StreamRequestTypes || (
|
|
310
|
+
})(StreamRequestTypes || (StreamRequestTypes = {}));
|
|
281
311
|
/**
|
|
282
312
|
* @group Camera
|
|
283
313
|
*/
|
|
284
|
-
class RTPStreamManagement {
|
|
314
|
+
export class RTPStreamManagement {
|
|
285
315
|
id;
|
|
286
316
|
delegate;
|
|
287
317
|
service;
|
|
@@ -297,18 +327,18 @@ class RTPStreamManagement {
|
|
|
297
327
|
activeConnectionClosedListener;
|
|
298
328
|
sessionIdentifier = undefined;
|
|
299
329
|
/**
|
|
300
|
-
* @private
|
|
330
|
+
* @private
|
|
301
331
|
*/
|
|
302
332
|
streamStatus = 0 /* StreamingStatus.AVAILABLE */; // use _updateStreamStatus to update this property
|
|
303
333
|
ipVersion; // ip version for the current session
|
|
304
|
-
selectedConfiguration =
|
|
305
|
-
setupEndpointsResponse =
|
|
334
|
+
selectedConfiguration = ''; // base64 representation of the currently selected configuration
|
|
335
|
+
setupEndpointsResponse = ''; // response of the SetupEndpoints Characteristic
|
|
306
336
|
/**
|
|
307
|
-
* @private
|
|
337
|
+
* @private
|
|
308
338
|
*/
|
|
309
339
|
audioProxy;
|
|
310
340
|
/**
|
|
311
|
-
* @private
|
|
341
|
+
* @private
|
|
312
342
|
*/
|
|
313
343
|
videoProxy;
|
|
314
344
|
/**
|
|
@@ -332,7 +362,7 @@ class RTPStreamManagement {
|
|
|
332
362
|
this.supportedCryptoSuites.push(2 /* SRTPCryptoSuites.NONE */);
|
|
333
363
|
}
|
|
334
364
|
if (!options.video) {
|
|
335
|
-
throw new Error(
|
|
365
|
+
throw new Error('Video parameters cannot be undefined in options');
|
|
336
366
|
}
|
|
337
367
|
this.supportedRTPConfiguration = RTPStreamManagement._supportedRTPConfiguration(this.supportedCryptoSuites);
|
|
338
368
|
this.supportedVideoStreamConfiguration = RTPStreamManagement._supportedVideoStreamConfiguration(options.video);
|
|
@@ -353,7 +383,7 @@ class RTPStreamManagement {
|
|
|
353
383
|
handleFactoryReset() {
|
|
354
384
|
this.resetSelectedStreamConfiguration();
|
|
355
385
|
this.resetSetupEndpointsResponse();
|
|
356
|
-
this.service.updateCharacteristic(
|
|
386
|
+
this.service.updateCharacteristic(Characteristic.Active, true);
|
|
357
387
|
// on a factory reset the assumption is that all connections were already terminated and thus "handleStopStream" was already called
|
|
358
388
|
}
|
|
359
389
|
destroy() {
|
|
@@ -362,46 +392,46 @@ class RTPStreamManagement {
|
|
|
362
392
|
}
|
|
363
393
|
}
|
|
364
394
|
constructService(id) {
|
|
365
|
-
const managementService = new
|
|
395
|
+
const managementService = new Service.CameraRTPStreamManagement('', id.toString());
|
|
366
396
|
// this service is required only when recording is enabled. We don't really have access to this info here,
|
|
367
397
|
// so we just add the characteristic. Doesn't really hurt.
|
|
368
|
-
managementService.setCharacteristic(
|
|
398
|
+
managementService.setCharacteristic(Characteristic.Active, true);
|
|
369
399
|
return managementService;
|
|
370
400
|
}
|
|
371
401
|
setupServiceHandlers() {
|
|
372
|
-
if (!this.service.testCharacteristic(
|
|
402
|
+
if (!this.service.testCharacteristic(Characteristic.Active)) {
|
|
373
403
|
// the active characteristic might not be present on some older configurations.
|
|
374
|
-
this.service.setCharacteristic(
|
|
404
|
+
this.service.setCharacteristic(Characteristic.Active, true);
|
|
375
405
|
}
|
|
376
|
-
this.service.getCharacteristic(
|
|
406
|
+
this.service.getCharacteristic(Characteristic.Active)
|
|
377
407
|
.on("change" /* CharacteristicEventTypes.CHANGE */, () => this.stateChangeDelegate?.())
|
|
378
408
|
.setProps({ adminOnlyAccess: [1 /* Access.WRITE */] });
|
|
379
409
|
// ensure that configurations are up-to-date and reflected in the characteristic values
|
|
380
|
-
this.service.setCharacteristic(
|
|
381
|
-
this.service.setCharacteristic(
|
|
382
|
-
this.service.setCharacteristic(
|
|
410
|
+
this.service.setCharacteristic(Characteristic.SupportedRTPConfiguration, this.supportedRTPConfiguration);
|
|
411
|
+
this.service.setCharacteristic(Characteristic.SupportedVideoStreamConfiguration, this.supportedVideoStreamConfiguration);
|
|
412
|
+
this.service.setCharacteristic(Characteristic.SupportedAudioStreamConfiguration, this.supportedAudioStreamConfiguration);
|
|
383
413
|
this._updateStreamStatus(0 /* StreamingStatus.AVAILABLE */); // reset streaming status to available
|
|
384
|
-
this.service.setCharacteristic(
|
|
385
|
-
this.service.getCharacteristic(
|
|
386
|
-
.on("get" /* CharacteristicEventTypes.GET */, callback => {
|
|
414
|
+
this.service.setCharacteristic(Characteristic.SetupEndpoints, this.setupEndpointsResponse); // reset SetupEndpoints to default
|
|
415
|
+
this.service.getCharacteristic(Characteristic.SelectedRTPStreamConfiguration)
|
|
416
|
+
.on("get" /* CharacteristicEventTypes.GET */, (callback) => {
|
|
387
417
|
if (this.streamingIsDisabled()) {
|
|
388
|
-
callback(null,
|
|
418
|
+
callback(null, encode(1 /* SelectedRTPStreamConfigurationTypes.SESSION_CONTROL */, encode(2 /* SessionControlTypes.COMMAND */, SessionControlCommand.SUSPEND_SESSION)).toString('base64'));
|
|
389
419
|
return;
|
|
390
420
|
}
|
|
391
421
|
callback(null, this.selectedConfiguration);
|
|
392
422
|
})
|
|
393
423
|
.on("set" /* CharacteristicEventTypes.SET */, this._handleSelectedStreamConfigurationWrite.bind(this));
|
|
394
|
-
this.service.getCharacteristic(
|
|
395
|
-
.on("get" /* CharacteristicEventTypes.GET */, callback => {
|
|
424
|
+
this.service.getCharacteristic(Characteristic.SetupEndpoints)
|
|
425
|
+
.on("get" /* CharacteristicEventTypes.GET */, (callback) => {
|
|
396
426
|
if (this.streamingIsDisabled()) {
|
|
397
|
-
callback(null,
|
|
427
|
+
callback(null, encode(2 /* SetupEndpointsResponseTypes.STATUS */, 2 /* SetupEndpointsStatus.ERROR */).toString('base64'));
|
|
398
428
|
return;
|
|
399
429
|
}
|
|
400
430
|
callback(null, this.setupEndpointsResponse);
|
|
401
431
|
})
|
|
402
432
|
.on("set" /* CharacteristicEventTypes.SET */, (value, callback, context, connection) => {
|
|
403
433
|
if (!connection) {
|
|
404
|
-
debug(
|
|
434
|
+
debug('Set event handler for SetupEndpoints cannot be called from plugin. Connection undefined!');
|
|
405
435
|
callback(-70410 /* HAPStatus.INVALID_VALUE_IN_REQUEST */);
|
|
406
436
|
return;
|
|
407
437
|
}
|
|
@@ -429,15 +459,15 @@ class RTPStreamManagement {
|
|
|
429
459
|
}
|
|
430
460
|
}
|
|
431
461
|
streamingIsDisabled(callback) {
|
|
432
|
-
if (!this.service.getCharacteristic(
|
|
433
|
-
if (typeof callback ===
|
|
434
|
-
callback(new
|
|
462
|
+
if (!this.service.getCharacteristic(Characteristic.Active).value) {
|
|
463
|
+
if (typeof callback === 'function') {
|
|
464
|
+
callback(new HapStatusError(-70412 /* HAPStatus.NOT_ALLOWED_IN_CURRENT_STATE */));
|
|
435
465
|
}
|
|
436
466
|
return true;
|
|
437
467
|
}
|
|
438
468
|
if (this.disabledThroughOperatingMode?.()) {
|
|
439
|
-
if (typeof callback ===
|
|
440
|
-
callback(new
|
|
469
|
+
if (typeof callback === 'function') {
|
|
470
|
+
callback(new HapStatusError(-70412 /* HAPStatus.NOT_ALLOWED_IN_CURRENT_STATE */));
|
|
441
471
|
}
|
|
442
472
|
return true;
|
|
443
473
|
}
|
|
@@ -447,10 +477,10 @@ class RTPStreamManagement {
|
|
|
447
477
|
if (this.streamingIsDisabled(callback)) {
|
|
448
478
|
return;
|
|
449
479
|
}
|
|
450
|
-
const data = Buffer.from(value,
|
|
451
|
-
const objects =
|
|
452
|
-
const sessionControl =
|
|
453
|
-
const sessionIdentifier =
|
|
480
|
+
const data = Buffer.from(value, 'base64');
|
|
481
|
+
const objects = decode(data);
|
|
482
|
+
const sessionControl = decode(objects[1 /* SelectedRTPStreamConfigurationTypes.SESSION_CONTROL */]);
|
|
483
|
+
const sessionIdentifier = unparse(sessionControl[1 /* SessionControlTypes.SESSION_IDENTIFIER */]);
|
|
454
484
|
const requestType = sessionControl[2 /* SessionControlTypes.COMMAND */][0];
|
|
455
485
|
if (sessionIdentifier !== this.sessionIdentifier) {
|
|
456
486
|
debug(`Received unknown session Identifier with request to ${SessionControlCommand[requestType]}`);
|
|
@@ -467,13 +497,13 @@ class RTPStreamManagement {
|
|
|
467
497
|
};
|
|
468
498
|
switch (requestType) {
|
|
469
499
|
case SessionControlCommand.START_SESSION: {
|
|
470
|
-
const selectedVideoParameters =
|
|
471
|
-
const selectedAudioParameters =
|
|
500
|
+
const selectedVideoParameters = decode(objects[2 /* SelectedRTPStreamConfigurationTypes.SELECTED_VIDEO_PARAMETERS */]);
|
|
501
|
+
const selectedAudioParameters = decode(objects[3 /* SelectedRTPStreamConfigurationTypes.SELECTED_AUDIO_PARAMETERS */]);
|
|
472
502
|
this._handleStartStream(selectedVideoParameters, selectedAudioParameters, streamCallback);
|
|
473
503
|
break;
|
|
474
504
|
}
|
|
475
505
|
case SessionControlCommand.RECONFIGURE_SESSION: {
|
|
476
|
-
const reconfiguredVideoParameters =
|
|
506
|
+
const reconfiguredVideoParameters = decode(objects[2 /* SelectedRTPStreamConfigurationTypes.SELECTED_VIDEO_PARAMETERS */]);
|
|
477
507
|
this.handleReconfigureStream(reconfiguredVideoParameters, streamCallback);
|
|
478
508
|
break;
|
|
479
509
|
}
|
|
@@ -485,38 +515,36 @@ class RTPStreamManagement {
|
|
|
485
515
|
default:
|
|
486
516
|
debug(`Unhandled request type ${SessionControlCommand[requestType]}`);
|
|
487
517
|
callback(-70410 /* HAPStatus.INVALID_VALUE_IN_REQUEST */);
|
|
488
|
-
return;
|
|
489
518
|
}
|
|
490
519
|
}
|
|
491
520
|
_handleStartStream(videoConfiguration, audioConfiguration, callback) {
|
|
492
521
|
// selected video configuration
|
|
493
|
-
// noinspection JSUnusedLocalSymbols
|
|
494
522
|
const videoCodec = videoConfiguration[1 /* SelectedVideoParametersTypes.CODEC_TYPE */]; // always 0x00 for h264
|
|
495
523
|
const videoParametersTLV = videoConfiguration[2 /* SelectedVideoParametersTypes.CODEC_PARAMETERS */];
|
|
496
524
|
const videoAttributesTLV = videoConfiguration[3 /* SelectedVideoParametersTypes.ATTRIBUTES */];
|
|
497
525
|
const videoRTPParametersTLV = videoConfiguration[4 /* SelectedVideoParametersTypes.RTP_PARAMETERS */];
|
|
498
526
|
// video parameters
|
|
499
|
-
const videoParameters =
|
|
527
|
+
const videoParameters = decode(videoParametersTLV);
|
|
500
528
|
const h264Profile = videoParameters[1 /* VideoCodecParametersTypes.PROFILE_ID */][0];
|
|
501
529
|
const h264Level = videoParameters[2 /* VideoCodecParametersTypes.LEVEL */][0];
|
|
502
530
|
const packetizationMode = videoParameters[3 /* VideoCodecParametersTypes.PACKETIZATION_MODE */][0];
|
|
503
531
|
const cvoEnabled = videoParameters[4 /* VideoCodecParametersTypes.CVO_ENABLED */];
|
|
504
|
-
let cvoId
|
|
532
|
+
let cvoId;
|
|
505
533
|
if (cvoEnabled && cvoEnabled[0] === 1 /* VideoCodecCVO.SUPPORTED */) {
|
|
506
534
|
cvoId = videoParameters[5 /* VideoCodecParametersTypes.CVO_ID */].readUInt8(0);
|
|
507
535
|
}
|
|
508
536
|
// video attributes
|
|
509
|
-
const videoAttributes =
|
|
537
|
+
const videoAttributes = decode(videoAttributesTLV);
|
|
510
538
|
const width = videoAttributes[1 /* VideoAttributesTypes.IMAGE_WIDTH */].readUInt16LE(0);
|
|
511
539
|
const height = videoAttributes[2 /* VideoAttributesTypes.IMAGE_HEIGHT */].readUInt16LE(0);
|
|
512
540
|
const frameRate = videoAttributes[3 /* VideoAttributesTypes.FRAME_RATE */].readUInt8(0);
|
|
513
541
|
// video rtp parameters
|
|
514
|
-
const videoRTPParameters =
|
|
542
|
+
const videoRTPParameters = decode(videoRTPParametersTLV);
|
|
515
543
|
const videoPayloadType = videoRTPParameters[1 /* VideoRTPParametersTypes.PAYLOAD_TYPE */].readUInt8(0); // 99
|
|
516
544
|
const videoSSRC = videoRTPParameters[2 /* VideoRTPParametersTypes.SYNCHRONIZATION_SOURCE */].readUInt32LE(0);
|
|
517
545
|
const videoMaximumBitrate = videoRTPParameters[3 /* VideoRTPParametersTypes.MAX_BIT_RATE */].readUInt16LE(0);
|
|
518
546
|
const videoRTCPInterval = videoRTPParameters[4 /* VideoRTPParametersTypes.MIN_RTCP_INTERVAL */].readFloatLE(0);
|
|
519
|
-
let maxMTU = this.ipVersion ===
|
|
547
|
+
let maxMTU = this.ipVersion === 'ipv6' ? 1228 : 1378; // default values ipv4: 1378 bytes; ipv6: 1228 bytes
|
|
520
548
|
if (videoRTPParameters[5 /* VideoRTPParametersTypes.MAX_MTU */]) {
|
|
521
549
|
maxMTU = videoRTPParameters[5 /* VideoRTPParametersTypes.MAX_MTU */].readUInt16LE(0);
|
|
522
550
|
}
|
|
@@ -526,13 +554,13 @@ class RTPStreamManagement {
|
|
|
526
554
|
const audioRTPParametersTLV = audioConfiguration[3 /* SelectedAudioParametersTypes.RTP_PARAMETERS */];
|
|
527
555
|
const comfortNoise = !!audioConfiguration[4 /* SelectedAudioParametersTypes.COMFORT_NOISE */].readUInt8(0);
|
|
528
556
|
// audio parameters
|
|
529
|
-
const audioParameters =
|
|
557
|
+
const audioParameters = decode(audioParametersTLV);
|
|
530
558
|
const channels = audioParameters[1 /* AudioCodecParametersTypes.CHANNEL */][0];
|
|
531
559
|
const audioBitrate = audioParameters[2 /* AudioCodecParametersTypes.BIT_RATE */][0];
|
|
532
560
|
const samplerate = audioParameters[3 /* AudioCodecParametersTypes.SAMPLE_RATE */][0];
|
|
533
561
|
const rtpPacketTime = audioParameters[4 /* AudioCodecParametersTypes.PACKET_TIME */].readUInt8(0);
|
|
534
562
|
// audio rtp parameters
|
|
535
|
-
const audioRTPParameters =
|
|
563
|
+
const audioRTPParameters = decode(audioRTPParametersTLV);
|
|
536
564
|
const audioPayloadType = audioRTPParameters[1 /* AudioRTPParametersTypes.PAYLOAD_TYPE */].readUInt8(0); // 110
|
|
537
565
|
const audioSSRC = audioRTPParameters[2 /* AudioRTPParametersTypes.SYNCHRONIZATION_SOURCE */].readUInt32LE(0);
|
|
538
566
|
const audioMaximumBitrate = audioRTPParameters[3 /* AudioRTPParametersTypes.MAX_BIT_RATE */].readUInt16LE(0);
|
|
@@ -548,10 +576,10 @@ class RTPStreamManagement {
|
|
|
548
576
|
codec: videoCodec.readUInt8(0),
|
|
549
577
|
profile: h264Profile,
|
|
550
578
|
level: h264Level,
|
|
551
|
-
packetizationMode
|
|
552
|
-
cvoId
|
|
553
|
-
width
|
|
554
|
-
height
|
|
579
|
+
packetizationMode,
|
|
580
|
+
cvoId,
|
|
581
|
+
width,
|
|
582
|
+
height,
|
|
555
583
|
fps: frameRate,
|
|
556
584
|
pt: videoPayloadType,
|
|
557
585
|
ssrc: videoSSRC,
|
|
@@ -625,18 +653,18 @@ class RTPStreamManagement {
|
|
|
625
653
|
const videoAttributesTLV = videoConfiguration[3 /* SelectedVideoParametersTypes.ATTRIBUTES */];
|
|
626
654
|
const videoRTPParametersTLV = videoConfiguration[4 /* SelectedVideoParametersTypes.RTP_PARAMETERS */];
|
|
627
655
|
// video attributes
|
|
628
|
-
const videoAttributes =
|
|
656
|
+
const videoAttributes = decode(videoAttributesTLV);
|
|
629
657
|
const width = videoAttributes[1 /* VideoAttributesTypes.IMAGE_WIDTH */].readUInt16LE(0);
|
|
630
658
|
const height = videoAttributes[2 /* VideoAttributesTypes.IMAGE_HEIGHT */].readUInt16LE(0);
|
|
631
659
|
const frameRate = videoAttributes[3 /* VideoAttributesTypes.FRAME_RATE */].readUInt8(0);
|
|
632
660
|
// video rtp parameters
|
|
633
|
-
const videoRTPParameters =
|
|
661
|
+
const videoRTPParameters = decode(videoRTPParametersTLV);
|
|
634
662
|
const videoMaximumBitrate = videoRTPParameters[3 /* VideoRTPParametersTypes.MAX_BIT_RATE */].readUInt16LE(0);
|
|
635
663
|
// seems to be always zero, use default of 0.5
|
|
636
664
|
const videoRTCPInterval = videoRTPParameters[4 /* VideoRTPParametersTypes.MIN_RTCP_INTERVAL */].readFloatLE(0) || 0.5;
|
|
637
665
|
const reconfiguredVideoInfo = {
|
|
638
|
-
width
|
|
639
|
-
height
|
|
666
|
+
width,
|
|
667
|
+
height,
|
|
640
668
|
fps: frameRate,
|
|
641
669
|
max_bit_rate: videoMaximumBitrate,
|
|
642
670
|
rtcp_interval: videoRTCPInterval,
|
|
@@ -660,15 +688,15 @@ class RTPStreamManagement {
|
|
|
660
688
|
if (this.streamingIsDisabled(callback)) {
|
|
661
689
|
return;
|
|
662
690
|
}
|
|
663
|
-
const data = Buffer.from(value,
|
|
664
|
-
const objects =
|
|
665
|
-
const sessionIdentifier =
|
|
691
|
+
const data = Buffer.from(value, 'base64');
|
|
692
|
+
const objects = decode(data);
|
|
693
|
+
const sessionIdentifier = unparse(objects[1 /* SetupEndpointsTypes.SESSION_ID */]);
|
|
666
694
|
if (this.streamStatus !== 0 /* StreamingStatus.AVAILABLE */) {
|
|
667
|
-
this.setupEndpointsResponse =
|
|
695
|
+
this.setupEndpointsResponse = encode(1 /* SetupEndpointsResponseTypes.SESSION_ID */, write(sessionIdentifier), 2 /* SetupEndpointsResponseTypes.STATUS */, 1 /* SetupEndpointsStatus.BUSY */).toString('base64');
|
|
668
696
|
callback();
|
|
669
697
|
return;
|
|
670
698
|
}
|
|
671
|
-
(
|
|
699
|
+
assert(this.activeConnection == null, 'Found non-nil `activeConnection` when trying to setup streaming endpoints, even though streamStatus is reported to be AVAILABLE!');
|
|
672
700
|
this.activeConnection = connection;
|
|
673
701
|
this.activeConnection.setMaxListeners(this.activeConnection.getMaxListeners() + 1);
|
|
674
702
|
this.activeConnection.on("closed" /* HAPConnectionEvent.CLOSED */, this.activeConnectionClosedListener);
|
|
@@ -676,29 +704,29 @@ class RTPStreamManagement {
|
|
|
676
704
|
this._updateStreamStatus(1 /* StreamingStatus.IN_USE */);
|
|
677
705
|
// Address
|
|
678
706
|
const targetAddressPayload = objects[3 /* SetupEndpointsTypes.CONTROLLER_ADDRESS */];
|
|
679
|
-
const processedAddressInfo =
|
|
707
|
+
const processedAddressInfo = decode(targetAddressPayload);
|
|
680
708
|
const addressVersion = processedAddressInfo[1 /* AddressTypes.ADDRESS_VERSION */][0];
|
|
681
|
-
const controllerAddress = processedAddressInfo[2 /* AddressTypes.ADDRESS */].toString(
|
|
709
|
+
const controllerAddress = processedAddressInfo[2 /* AddressTypes.ADDRESS */].toString('utf8');
|
|
682
710
|
const targetVideoPort = processedAddressInfo[3 /* AddressTypes.VIDEO_RTP_PORT */].readUInt16LE(0);
|
|
683
711
|
const targetAudioPort = processedAddressInfo[4 /* AddressTypes.AUDIO_RTP_PORT */].readUInt16LE(0);
|
|
684
712
|
// Video SRTP Params
|
|
685
713
|
const videoSRTPPayload = objects[4 /* SetupEndpointsTypes.VIDEO_SRTP_PARAMETERS */];
|
|
686
|
-
const processedVideoInfo =
|
|
714
|
+
const processedVideoInfo = decode(videoSRTPPayload);
|
|
687
715
|
const videoCryptoSuite = processedVideoInfo[1 /* SRTPParametersTypes.SRTP_CRYPTO_SUITE */][0];
|
|
688
716
|
const videoMasterKey = processedVideoInfo[2 /* SRTPParametersTypes.MASTER_KEY */];
|
|
689
717
|
const videoMasterSalt = processedVideoInfo[3 /* SRTPParametersTypes.MASTER_SALT */];
|
|
690
718
|
// Audio SRTP Params
|
|
691
719
|
const audioSRTPPayload = objects[5 /* SetupEndpointsTypes.AUDIO_SRTP_PARAMETERS */];
|
|
692
|
-
const processedAudioInfo =
|
|
720
|
+
const processedAudioInfo = decode(audioSRTPPayload);
|
|
693
721
|
const audioCryptoSuite = processedAudioInfo[1 /* SRTPParametersTypes.SRTP_CRYPTO_SUITE */][0];
|
|
694
722
|
const audioMasterKey = processedAudioInfo[2 /* SRTPParametersTypes.MASTER_KEY */];
|
|
695
723
|
const audioMasterSalt = processedAudioInfo[3 /* SRTPParametersTypes.MASTER_SALT */];
|
|
696
|
-
debug(
|
|
724
|
+
debug('Session: ', sessionIdentifier, '\nControllerAddress: ', controllerAddress, '\nVideoPort: ', targetVideoPort, '\nAudioPort: ', targetAudioPort, '\nVideo Crypto: ', videoCryptoSuite, '\nVideo Master Key: ', videoMasterKey, '\nVideo Master Salt: ', videoMasterSalt, '\nAudio Crypto: ', audioCryptoSuite, '\nAudio Master Key: ', audioMasterKey, '\nAudio Master Salt: ', audioMasterSalt);
|
|
697
725
|
const prepareRequest = {
|
|
698
726
|
sessionID: sessionIdentifier,
|
|
699
727
|
sourceAddress: connection.localAddress,
|
|
700
728
|
targetAddress: controllerAddress,
|
|
701
|
-
addressVersion: addressVersion === 1 /* IPAddressVersion.IPV6 */ ?
|
|
729
|
+
addressVersion: addressVersion === 1 /* IPAddressVersion.IPV6 */ ? 'ipv6' : 'ipv4',
|
|
702
730
|
video: {
|
|
703
731
|
port: targetVideoPort,
|
|
704
732
|
srtpCryptoSuite: videoCryptoSuite,
|
|
@@ -714,11 +742,11 @@ class RTPStreamManagement {
|
|
|
714
742
|
};
|
|
715
743
|
const promises = [];
|
|
716
744
|
if (this.requireProxy) {
|
|
717
|
-
prepareRequest.targetAddress = connection.getLocalAddress(addressVersion === 1 /* IPAddressVersion.IPV6 */ ?
|
|
718
|
-
this.videoProxy = new
|
|
745
|
+
prepareRequest.targetAddress = connection.getLocalAddress(addressVersion === 1 /* IPAddressVersion.IPV6 */ ? 'ipv6' : 'ipv4'); // ip versions must be the same
|
|
746
|
+
this.videoProxy = new RTPProxy({
|
|
719
747
|
outgoingAddress: controllerAddress,
|
|
720
748
|
outgoingPort: targetVideoPort,
|
|
721
|
-
outgoingSSRC:
|
|
749
|
+
outgoingSSRC: randomBytes(4).readUInt32LE(0), // videoSSRC
|
|
722
750
|
disabled: false,
|
|
723
751
|
});
|
|
724
752
|
promises.push(this.videoProxy.setup().then(() => {
|
|
@@ -726,10 +754,10 @@ class RTPStreamManagement {
|
|
|
726
754
|
prepareRequest.video.proxy_rtcp = this.videoProxy.incomingRTCPPort();
|
|
727
755
|
}));
|
|
728
756
|
if (!this.disableAudioProxy) {
|
|
729
|
-
this.audioProxy = new
|
|
757
|
+
this.audioProxy = new RTPProxy({
|
|
730
758
|
outgoingAddress: controllerAddress,
|
|
731
759
|
outgoingPort: targetAudioPort,
|
|
732
|
-
outgoingSSRC:
|
|
760
|
+
outgoingSSRC: randomBytes(4).readUInt32LE(0), // audioSSRC
|
|
733
761
|
disabled: this.videoOnly,
|
|
734
762
|
});
|
|
735
763
|
promises.push(this.audioProxy.setup().then(() => {
|
|
@@ -739,10 +767,10 @@ class RTPStreamManagement {
|
|
|
739
767
|
}
|
|
740
768
|
}
|
|
741
769
|
Promise.all(promises).then(() => {
|
|
742
|
-
this.delegate.prepareStream(prepareRequest,
|
|
770
|
+
this.delegate.prepareStream(prepareRequest, once((error, response) => {
|
|
743
771
|
if (error || !response) {
|
|
744
772
|
debug(`PrepareStream request encountered an error: ${error ? error.message : undefined}`);
|
|
745
|
-
this.setupEndpointsResponse =
|
|
773
|
+
this.setupEndpointsResponse = encode(1 /* SetupEndpointsResponseTypes.SESSION_ID */, write(sessionIdentifier), 2 /* SetupEndpointsResponseTypes.STATUS */, 2 /* SetupEndpointsStatus.ERROR */).toString('base64');
|
|
746
774
|
this.handleSessionClosed();
|
|
747
775
|
callback(error);
|
|
748
776
|
}
|
|
@@ -766,12 +794,12 @@ class RTPStreamManagement {
|
|
|
766
794
|
let videoSSRC;
|
|
767
795
|
let audioSSRC;
|
|
768
796
|
if (!this.videoOnly && !response.audio) {
|
|
769
|
-
throw new Error(
|
|
797
|
+
throw new Error('Audio was enabled but not supplied in PrepareStreamResponse!');
|
|
770
798
|
}
|
|
771
799
|
// Provide default values if audio was not supplied
|
|
772
800
|
const audio = response.audio || {
|
|
773
801
|
port: request.audio.port,
|
|
774
|
-
ssrc:
|
|
802
|
+
ssrc: CameraController.generateSynchronisationSource(),
|
|
775
803
|
srtp_key: request.audio.srtp_key,
|
|
776
804
|
srtp_salt: request.audio.srtp_salt,
|
|
777
805
|
};
|
|
@@ -779,7 +807,7 @@ class RTPStreamManagement {
|
|
|
779
807
|
const videoInfo = response.video;
|
|
780
808
|
const audioInfo = audio;
|
|
781
809
|
if (response.addressOverride) {
|
|
782
|
-
addressVersion =
|
|
810
|
+
addressVersion = isIPv4(response.addressOverride) ? 'ipv4' : 'ipv6';
|
|
783
811
|
address = response.addressOverride;
|
|
784
812
|
}
|
|
785
813
|
else {
|
|
@@ -792,11 +820,11 @@ class RTPStreamManagement {
|
|
|
792
820
|
audioPort = audioInfo.port;
|
|
793
821
|
if (request.video.srtpCryptoSuite !== 2 /* SRTPCryptoSuites.NONE */
|
|
794
822
|
&& (videoInfo.srtp_key === undefined || videoInfo.srtp_salt === undefined)) {
|
|
795
|
-
throw new Error(
|
|
823
|
+
throw new Error('SRTP was selected for the prepared video stream, but no \'srtp_key\' or \'srtp_salt\' was specified!');
|
|
796
824
|
}
|
|
797
825
|
if (request.audio.srtpCryptoSuite !== 2 /* SRTPCryptoSuites.NONE */
|
|
798
826
|
&& (audioInfo.srtp_key === undefined || audioInfo.srtp_salt === undefined)) {
|
|
799
|
-
throw new Error(
|
|
827
|
+
throw new Error('SRTP was selected for the prepared audio stream, but no \'srtp_key\' or \'srtp_salt\' was specified!');
|
|
800
828
|
}
|
|
801
829
|
videoCryptoSuite = request.video.srtpCryptoSuite;
|
|
802
830
|
videoSRTPKey = videoInfo.srtp_key || Buffer.alloc(0); // key and salt are zero-length for cryptoSuite = NONE
|
|
@@ -838,39 +866,39 @@ class RTPStreamManagement {
|
|
|
838
866
|
}
|
|
839
867
|
}
|
|
840
868
|
this.ipVersion = addressVersion; // we need to save this in order to calculate some default mtu values later
|
|
841
|
-
const accessoryAddress =
|
|
842
|
-
const videoSRTPParameters =
|
|
843
|
-
const audioSRTPParameters =
|
|
844
|
-
this.setupEndpointsResponse =
|
|
869
|
+
const accessoryAddress = encode(1 /* AddressTypes.ADDRESS_VERSION */, addressVersion === 'ipv4' ? 0 /* IPAddressVersion.IPV4 */ : 1 /* IPAddressVersion.IPV6 */, 2 /* AddressTypes.ADDRESS */, address, 3 /* AddressTypes.VIDEO_RTP_PORT */, writeUInt16(videoPort), 4 /* AddressTypes.AUDIO_RTP_PORT */, writeUInt16(audioPort));
|
|
870
|
+
const videoSRTPParameters = encode(1 /* SRTPParametersTypes.SRTP_CRYPTO_SUITE */, videoCryptoSuite, 2 /* SRTPParametersTypes.MASTER_KEY */, videoSRTPKey, 3 /* SRTPParametersTypes.MASTER_SALT */, videoSRTPSalt);
|
|
871
|
+
const audioSRTPParameters = encode(1 /* SRTPParametersTypes.SRTP_CRYPTO_SUITE */, audioCryptoSuite, 2 /* SRTPParametersTypes.MASTER_KEY */, audioSRTPKey, 3 /* SRTPParametersTypes.MASTER_SALT */, audioSRTPSalt);
|
|
872
|
+
this.setupEndpointsResponse = encode(1 /* SetupEndpointsResponseTypes.SESSION_ID */, write(identifier), 2 /* SetupEndpointsResponseTypes.STATUS */, 0 /* SetupEndpointsStatus.SUCCESS */, 3 /* SetupEndpointsResponseTypes.ACCESSORY_ADDRESS */, accessoryAddress, 4 /* SetupEndpointsResponseTypes.VIDEO_SRTP_PARAMETERS */, videoSRTPParameters, 5 /* SetupEndpointsResponseTypes.AUDIO_SRTP_PARAMETERS */, audioSRTPParameters, 6 /* SetupEndpointsResponseTypes.VIDEO_SSRC */, writeUInt32(videoSSRC), 7 /* SetupEndpointsResponseTypes.AUDIO_SSRC */, writeUInt32(audioSSRC)).toString('base64');
|
|
845
873
|
callback();
|
|
846
874
|
}
|
|
847
875
|
_updateStreamStatus(status) {
|
|
848
876
|
this.streamStatus = status;
|
|
849
|
-
this.service.updateCharacteristic(
|
|
877
|
+
this.service.updateCharacteristic(Characteristic.StreamingStatus, encode(1 /* StreamingStatusTypes.STATUS */, this.streamStatus).toString('base64'));
|
|
850
878
|
}
|
|
851
879
|
static _supportedRTPConfiguration(supportedCryptoSuites) {
|
|
852
880
|
if (supportedCryptoSuites.length === 1 && supportedCryptoSuites[0] === 2 /* SRTPCryptoSuites.NONE */) {
|
|
853
|
-
debug(
|
|
881
|
+
debug('Client claims it doesn\'t support SRTP. The stream may stops working with future iOS releases.');
|
|
854
882
|
}
|
|
855
|
-
return
|
|
883
|
+
return encode(2 /* SupportedRTPConfigurationTypes.SRTP_CRYPTO_SUITE */, supportedCryptoSuites).toString('base64');
|
|
856
884
|
}
|
|
857
885
|
static _supportedVideoStreamConfiguration(videoOptions) {
|
|
858
886
|
if (!videoOptions.codec) {
|
|
859
|
-
throw new Error(
|
|
887
|
+
throw new Error('Video codec cannot be undefined');
|
|
860
888
|
}
|
|
861
889
|
if (!videoOptions.resolutions) {
|
|
862
|
-
throw new Error(
|
|
890
|
+
throw new Error('Video resolutions cannot be undefined');
|
|
863
891
|
}
|
|
864
|
-
let codecParameters =
|
|
892
|
+
let codecParameters = encode(1 /* VideoCodecParametersTypes.PROFILE_ID */, videoOptions.codec.profiles, 2 /* VideoCodecParametersTypes.LEVEL */, videoOptions.codec.levels, 3 /* VideoCodecParametersTypes.PACKETIZATION_MODE */, 0 /* VideoCodecPacketizationMode.NON_INTERLEAVED */);
|
|
865
893
|
if (videoOptions.cvoId != null) {
|
|
866
894
|
codecParameters = Buffer.concat([
|
|
867
895
|
codecParameters,
|
|
868
|
-
|
|
896
|
+
encode(4 /* VideoCodecParametersTypes.CVO_ENABLED */, 1 /* VideoCodecCVO.SUPPORTED */, 5 /* VideoCodecParametersTypes.CVO_ID */, videoOptions.cvoId),
|
|
869
897
|
]);
|
|
870
898
|
}
|
|
871
|
-
const videoStreamConfiguration =
|
|
899
|
+
const videoStreamConfiguration = encode(1 /* VideoCodecConfigurationTypes.CODEC_TYPE */, 0 /* VideoCodecType.H264 */, 2 /* VideoCodecConfigurationTypes.CODEC_PARAMETERS */, codecParameters, 3 /* VideoCodecConfigurationTypes.ATTRIBUTES */, videoOptions.resolutions.map((resolution) => {
|
|
872
900
|
if (resolution.length !== 3) {
|
|
873
|
-
throw new Error(
|
|
901
|
+
throw new Error('Unexpected video resolution');
|
|
874
902
|
}
|
|
875
903
|
const width = Buffer.alloc(2);
|
|
876
904
|
const height = Buffer.alloc(2);
|
|
@@ -878,16 +906,16 @@ class RTPStreamManagement {
|
|
|
878
906
|
width.writeUInt16LE(resolution[0], 0);
|
|
879
907
|
height.writeUInt16LE(resolution[1], 0);
|
|
880
908
|
frameRate.writeUInt8(resolution[2], 0);
|
|
881
|
-
return
|
|
909
|
+
return encode(1 /* VideoAttributesTypes.IMAGE_WIDTH */, width, 2 /* VideoAttributesTypes.IMAGE_HEIGHT */, height, 3 /* VideoAttributesTypes.FRAME_RATE */, frameRate);
|
|
882
910
|
}));
|
|
883
|
-
return
|
|
911
|
+
return encode(1 /* SupportedVideoStreamConfigurationTypes.VIDEO_CODEC_CONFIGURATION */, videoStreamConfiguration).toString('base64');
|
|
884
912
|
}
|
|
885
913
|
checkForLegacyAudioCodecRepresentation(codecs) {
|
|
886
914
|
const codecMap = {};
|
|
887
|
-
codecs.slice().forEach(codec => {
|
|
915
|
+
codecs.slice().forEach((codec) => {
|
|
888
916
|
const previous = codecMap[codec.type];
|
|
889
917
|
if (previous) {
|
|
890
|
-
if (typeof previous.samplerate ===
|
|
918
|
+
if (typeof previous.samplerate === 'number') {
|
|
891
919
|
previous.samplerate = [previous.samplerate];
|
|
892
920
|
}
|
|
893
921
|
previous.samplerate = previous.samplerate.concat(codec.samplerate);
|
|
@@ -908,14 +936,14 @@ class RTPStreamManagement {
|
|
|
908
936
|
const supportedCodecs = (audioOptions && audioOptions.codecs) || [];
|
|
909
937
|
this.checkForLegacyAudioCodecRepresentation(supportedCodecs);
|
|
910
938
|
if (supportedCodecs.length === 0) { // Fake a Codec if we haven't got anything
|
|
911
|
-
debug(
|
|
939
|
+
debug('Client doesn\'t support any audio codec that HomeKit supports.');
|
|
912
940
|
this.videoOnly = true;
|
|
913
941
|
supportedCodecs.push({
|
|
914
942
|
type: "OPUS" /* AudioStreamingCodecType.OPUS */, // Opus @16K required by Apple Watch AFAIK
|
|
915
943
|
samplerate: [16 /* AudioStreamingSamplerate.KHZ_16 */, 24 /* AudioStreamingSamplerate.KHZ_24 */], // 16 and 24 must be supported
|
|
916
944
|
});
|
|
917
945
|
}
|
|
918
|
-
const codecConfigurations = supportedCodecs.map(codec => {
|
|
946
|
+
const codecConfigurations = supportedCodecs.map((codec) => {
|
|
919
947
|
let type;
|
|
920
948
|
switch (codec.type) {
|
|
921
949
|
case "OPUS" /* AudioStreamingCodecType.OPUS */:
|
|
@@ -940,9 +968,9 @@ class RTPStreamManagement {
|
|
|
940
968
|
type = 6 /* AudioCodecTypes.AMR_WB */;
|
|
941
969
|
break;
|
|
942
970
|
default:
|
|
943
|
-
throw new Error(
|
|
971
|
+
throw new Error(`Unsupported codec: ${codec.type}`);
|
|
944
972
|
}
|
|
945
|
-
const providedSamplerates = (typeof codec.samplerate ===
|
|
973
|
+
const providedSamplerates = (typeof codec.samplerate === 'number' ? [codec.samplerate] : codec.samplerate).map((rate) => {
|
|
946
974
|
let samplerate;
|
|
947
975
|
switch (rate) {
|
|
948
976
|
case 8 /* AudioStreamingSamplerate.KHZ_8 */:
|
|
@@ -955,32 +983,33 @@ class RTPStreamManagement {
|
|
|
955
983
|
samplerate = 2 /* AudioSamplerate.KHZ_24 */;
|
|
956
984
|
break;
|
|
957
985
|
default:
|
|
958
|
-
|
|
986
|
+
// eslint-disable-next-line no-console
|
|
987
|
+
console.log('Unsupported sample rate: ', codec.samplerate);
|
|
959
988
|
samplerate = -1;
|
|
960
989
|
}
|
|
961
990
|
return samplerate;
|
|
962
991
|
}).filter(rate => rate !== -1);
|
|
963
992
|
if (providedSamplerates.length === 0) {
|
|
964
|
-
throw new Error(
|
|
993
|
+
throw new Error('Audio samplerate cannot be empty!');
|
|
965
994
|
}
|
|
966
|
-
const audioParameters =
|
|
967
|
-
return
|
|
995
|
+
const audioParameters = encode(1 /* AudioCodecParametersTypes.CHANNEL */, Math.max(1, codec.audioChannels || 1), 2 /* AudioCodecParametersTypes.BIT_RATE */, codec.bitrate || 0 /* AudioBitrate.VARIABLE */, 3 /* AudioCodecParametersTypes.SAMPLE_RATE */, providedSamplerates);
|
|
996
|
+
return encode(1 /* AudioCodecConfigurationTypes.CODEC_TYPE */, type, 2 /* AudioCodecConfigurationTypes.CODEC_PARAMETERS */, audioParameters);
|
|
968
997
|
});
|
|
969
|
-
return
|
|
998
|
+
return encode(1 /* SupportedAudioStreamConfigurationTypes.AUDIO_CODEC_CONFIGURATION */, codecConfigurations, 2 /* SupportedAudioStreamConfigurationTypes.COMFORT_NOISE_SUPPORT */, comfortNoise ? 1 : 0).toString('base64');
|
|
970
999
|
}
|
|
971
1000
|
resetSetupEndpointsResponse() {
|
|
972
|
-
this.setupEndpointsResponse =
|
|
973
|
-
this.service.updateCharacteristic(
|
|
1001
|
+
this.setupEndpointsResponse = encode(2 /* SetupEndpointsResponseTypes.STATUS */, 2 /* SetupEndpointsStatus.ERROR */).toString('base64');
|
|
1002
|
+
this.service.updateCharacteristic(Characteristic.SetupEndpoints, this.setupEndpointsResponse);
|
|
974
1003
|
}
|
|
975
1004
|
resetSelectedStreamConfiguration() {
|
|
976
|
-
this.selectedConfiguration =
|
|
977
|
-
this.service.updateCharacteristic(
|
|
1005
|
+
this.selectedConfiguration = encode(1 /* SelectedRTPStreamConfigurationTypes.SESSION_CONTROL */, encode(2 /* SessionControlTypes.COMMAND */, SessionControlCommand.SUSPEND_SESSION)).toString('base64');
|
|
1006
|
+
this.service.updateCharacteristic(Characteristic.SelectedRTPStreamConfiguration, this.selectedConfiguration);
|
|
978
1007
|
}
|
|
979
1008
|
/**
|
|
980
1009
|
* @private
|
|
981
1010
|
*/
|
|
982
1011
|
serialize() {
|
|
983
|
-
const characteristicValue = this.service.getCharacteristic(
|
|
1012
|
+
const characteristicValue = this.service.getCharacteristic(Characteristic.Active).value;
|
|
984
1013
|
if (characteristicValue === true) {
|
|
985
1014
|
return undefined;
|
|
986
1015
|
}
|
|
@@ -993,8 +1022,8 @@ class RTPStreamManagement {
|
|
|
993
1022
|
* @private
|
|
994
1023
|
*/
|
|
995
1024
|
deserialize(serialized) {
|
|
996
|
-
(
|
|
997
|
-
this.service.updateCharacteristic(
|
|
1025
|
+
assert(serialized.id === this.id, `Tried to initialize RTPStreamManagement ${this.id} with data from management with id ${serialized.id}!`);
|
|
1026
|
+
this.service.updateCharacteristic(Characteristic.Active, serialized.active);
|
|
998
1027
|
}
|
|
999
1028
|
/**
|
|
1000
1029
|
* @private
|
|
@@ -1003,5 +1032,4 @@ class RTPStreamManagement {
|
|
|
1003
1032
|
this.stateChangeDelegate = delegate;
|
|
1004
1033
|
}
|
|
1005
1034
|
}
|
|
1006
|
-
exports.RTPStreamManagement = RTPStreamManagement;
|
|
1007
1035
|
//# sourceMappingURL=RTPStreamManagement.js.map
|