homebridge-ring 11.0.2-beta.1 → 11.0.2
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/CHANGELOG.md +5 -9
- package/lib/api/streaming/streaming-connection-base.d.ts +3 -2
- package/lib/api/streaming/streaming-connection-base.js +31 -8
- package/lib/api/streaming/streaming-session.d.ts +2 -2
- package/lib/api/streaming/streaming-session.js +5 -5
- package/lib/homebridge/camera-source.js +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -2,20 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
-
### [11.0.2
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
### Bug Fixes
|
|
9
|
-
|
|
10
|
-
* **api:** prevent duplicate events from `onCallEnded` ([75696d5](https://github.com/dgreif/ring/commit/75696d510969f706248a0f83e98fb1c99fc07213)), closes [#941](https://github.com/dgreif/ring/issues/941)
|
|
11
|
-
* handle pcmu return audio ([ce29fb5](https://github.com/dgreif/ring/commit/ce29fb5638bc488c515518a0fadcaca900ebe750)), closes [#930](https://github.com/dgreif/ring/issues/930)
|
|
12
|
-
|
|
13
|
-
### [11.0.2-beta.0](https://github.com/dgreif/ring/compare/v11.0.1...v11.0.2-beta.0) (2022-05-21)
|
|
5
|
+
### [11.0.2](https://github.com/dgreif/ring/compare/v11.0.1...v11.0.2) (2022-05-22)
|
|
14
6
|
|
|
15
7
|
|
|
16
8
|
### Bug Fixes
|
|
17
9
|
|
|
10
|
+
* **api:** prevent duplicate events from `onCallEnded` ([14ee6eb](https://github.com/dgreif/ring/commit/14ee6eb90bb6ae568dcfd9e8e176c3001e422f9c)), closes [#941](https://github.com/dgreif/ring/issues/941)
|
|
18
11
|
* handle pcmu audio streams for incoming audio ([06f6ff1](https://github.com/dgreif/ring/commit/06f6ff10ce7c8f2b05b1a12b8f244daa200fa9ab)), closes [#930](https://github.com/dgreif/ring/issues/930)
|
|
12
|
+
* handle pcmu return audio ([7b86182](https://github.com/dgreif/ring/commit/7b8618261a6ccb85b9f760ee1fcc228be00fe5a6)), closes [#930](https://github.com/dgreif/ring/issues/930)
|
|
13
|
+
* **homebride:** use shared engines config to enforce node 16 requirement ([b748cb0](https://github.com/dgreif/ring/commit/b748cb027db0c43ae109e1ea77c6bc83f86e4913))
|
|
14
|
+
* prevent hanging promises from streams that fail to connect ([dd7638e](https://github.com/dgreif/ring/commit/dd7638e32626499c0be501be6b19b5d874fa974f))
|
|
19
15
|
|
|
20
16
|
### [11.0.1](https://github.com/dgreif/ring/compare/v11.0.0...v11.0.1) (2022-05-17)
|
|
21
17
|
|
|
@@ -21,10 +21,11 @@ export declare abstract class StreamingConnectionBase extends Subscribed {
|
|
|
21
21
|
}): Promise<void>;
|
|
22
22
|
protected abstract sendSessionMessage(method: string, body?: Record<any, any>): void;
|
|
23
23
|
private activated;
|
|
24
|
-
activate():
|
|
25
|
-
activateCameraSpeaker():
|
|
24
|
+
activate(): void;
|
|
25
|
+
activateCameraSpeaker(): void;
|
|
26
26
|
protected sendMessage(message: Record<any, any>): void;
|
|
27
27
|
sendAudioPacket(rtp: RtpPacket): void;
|
|
28
|
+
private hasEnded;
|
|
28
29
|
protected callEnded(): void;
|
|
29
30
|
stop(): void;
|
|
30
31
|
}
|
|
@@ -14,6 +14,7 @@ class StreamingConnectionBase extends subscribed_1.Subscribed {
|
|
|
14
14
|
this.onCallAnswered = new rxjs_1.ReplaySubject(1);
|
|
15
15
|
this.onCallEnded = new rxjs_1.ReplaySubject(1);
|
|
16
16
|
this.activated = false;
|
|
17
|
+
this.hasEnded = false;
|
|
17
18
|
if (options.createPeerConnection) {
|
|
18
19
|
// we were passed a custom peer connection factory
|
|
19
20
|
this.pc = options.createPeerConnection();
|
|
@@ -50,25 +51,43 @@ class StreamingConnectionBase extends subscribed_1.Subscribed {
|
|
|
50
51
|
}
|
|
51
52
|
}));
|
|
52
53
|
}
|
|
53
|
-
|
|
54
|
+
activate() {
|
|
54
55
|
if (this.activated) {
|
|
55
56
|
return;
|
|
56
57
|
}
|
|
57
58
|
this.activated = true;
|
|
58
|
-
|
|
59
|
-
(0,
|
|
60
|
-
|
|
59
|
+
// Fire and forget this call so that callers don't get hung up waiting for connection (which might not happen)
|
|
60
|
+
(0, rxjs_1.firstValueFrom)(this.pc.onConnectionState.pipe((0, operators_1.filter)((state) => state === 'connected')))
|
|
61
|
+
.then(() => {
|
|
62
|
+
(0, util_1.logInfo)('Activating Session');
|
|
63
|
+
this.sendSessionMessage('activate_session');
|
|
64
|
+
})
|
|
65
|
+
.catch((e) => {
|
|
66
|
+
(0, util_1.logError)(e);
|
|
67
|
+
});
|
|
61
68
|
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
69
|
+
activateCameraSpeaker() {
|
|
70
|
+
// Fire and forget this call so that callers don't get hung up waiting for answer (which might not happen)
|
|
71
|
+
(0, rxjs_1.firstValueFrom)(this.onCallAnswered)
|
|
72
|
+
.then(() => {
|
|
73
|
+
this.sendSessionMessage('camera_options', {
|
|
74
|
+
stealth_mode: false,
|
|
75
|
+
});
|
|
76
|
+
})
|
|
77
|
+
.catch((e) => {
|
|
78
|
+
(0, util_1.logError)(e);
|
|
66
79
|
});
|
|
67
80
|
}
|
|
68
81
|
sendMessage(message) {
|
|
82
|
+
if (this.hasEnded) {
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
69
85
|
this.ws.send(JSON.stringify(message));
|
|
70
86
|
}
|
|
71
87
|
sendAudioPacket(rtp) {
|
|
88
|
+
if (this.hasEnded) {
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
72
91
|
if (this.pc instanceof peer_connection_1.WeriftPeerConnection) {
|
|
73
92
|
this.pc.returnAudioTrack.writeRtp(rtp);
|
|
74
93
|
}
|
|
@@ -77,6 +96,9 @@ class StreamingConnectionBase extends subscribed_1.Subscribed {
|
|
|
77
96
|
}
|
|
78
97
|
}
|
|
79
98
|
callEnded() {
|
|
99
|
+
if (this.hasEnded) {
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
80
102
|
try {
|
|
81
103
|
this.sendMessage({
|
|
82
104
|
reason: { code: 0, text: '' },
|
|
@@ -87,6 +109,7 @@ class StreamingConnectionBase extends subscribed_1.Subscribed {
|
|
|
87
109
|
catch (_) {
|
|
88
110
|
// ignore any errors since we are stopping the call
|
|
89
111
|
}
|
|
112
|
+
this.hasEnded = true;
|
|
90
113
|
this.unsubscribe();
|
|
91
114
|
this.onCallEnded.next();
|
|
92
115
|
this.pc.close();
|
|
@@ -24,9 +24,9 @@ export declare class StreamingSession extends Subscribed {
|
|
|
24
24
|
constructor(camera: RingCamera, connection: RingEdgeConnection | WebrtcConnection);
|
|
25
25
|
private bindToConnection;
|
|
26
26
|
activated: boolean;
|
|
27
|
-
activate():
|
|
27
|
+
activate(): void;
|
|
28
28
|
cameraSpeakerActivated: boolean;
|
|
29
|
-
activateCameraSpeaker():
|
|
29
|
+
activateCameraSpeaker(): void;
|
|
30
30
|
reservePort(bufferPorts?: number): Promise<number>;
|
|
31
31
|
get isUsingOpus(): Promise<boolean>;
|
|
32
32
|
startTranscoding(ffmpegOptions: FfmpegOptions): Promise<void>;
|
|
@@ -38,19 +38,19 @@ class StreamingSession extends subscribed_1.Subscribed {
|
|
|
38
38
|
this.onUsingOpus.next(sdp.toLocaleLowerCase().includes(' opus/'));
|
|
39
39
|
}));
|
|
40
40
|
}
|
|
41
|
-
|
|
41
|
+
activate() {
|
|
42
42
|
if (this.activated || this.hasEnded) {
|
|
43
43
|
return;
|
|
44
44
|
}
|
|
45
45
|
this.activated = true;
|
|
46
|
-
|
|
46
|
+
this.connection.activate();
|
|
47
47
|
}
|
|
48
|
-
|
|
48
|
+
activateCameraSpeaker() {
|
|
49
49
|
if (this.cameraSpeakerActivated || this.hasEnded) {
|
|
50
50
|
return;
|
|
51
51
|
}
|
|
52
52
|
this.cameraSpeakerActivated = true;
|
|
53
|
-
|
|
53
|
+
this.connection.activateCameraSpeaker();
|
|
54
54
|
}
|
|
55
55
|
async reservePort(bufferPorts = 0) {
|
|
56
56
|
const ports = await (0, camera_utils_1.reservePorts)({ count: bufferPorts + 1 });
|
|
@@ -107,7 +107,7 @@ class StreamingSession extends subscribed_1.Subscribed {
|
|
|
107
107
|
this.onCallEnded.subscribe(() => ff.stop());
|
|
108
108
|
ff.writeStdin(inputSdp);
|
|
109
109
|
// Activate the stream now that ffmpeg is ready to receive
|
|
110
|
-
|
|
110
|
+
this.activate();
|
|
111
111
|
}
|
|
112
112
|
async transcodeReturnAudio(ffmpegOptions) {
|
|
113
113
|
if (this.hasEnded) {
|
|
@@ -167,7 +167,7 @@ class StreamingSessionWrapper {
|
|
|
167
167
|
}, audioSrtpSession = new werift_1.SrtpSession(getSessionConfig(remoteAudioSrtpOptions)), returnAudioTranscodedSplitter = new camera_utils_1.RtpSplitter(({ message }) => {
|
|
168
168
|
if (!cameraSpeakerActive) {
|
|
169
169
|
cameraSpeakerActive = true;
|
|
170
|
-
this.streamingSession.activateCameraSpeaker()
|
|
170
|
+
this.streamingSession.activateCameraSpeaker();
|
|
171
171
|
}
|
|
172
172
|
// decrypt the message
|
|
173
173
|
try {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "homebridge-ring",
|
|
3
|
-
"version": "11.0.2
|
|
3
|
+
"version": "11.0.2",
|
|
4
4
|
"description": "Homebridge plugin for Ring doorbells, cameras, security alarm system and smart lighting",
|
|
5
5
|
"main": "lib/homebridge/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -81,8 +81,8 @@
|
|
|
81
81
|
"typescript": "4.6.4"
|
|
82
82
|
},
|
|
83
83
|
"engines": {
|
|
84
|
-
"node": "
|
|
85
|
-
"homebridge": ">=
|
|
84
|
+
"node": "^16",
|
|
85
|
+
"homebridge": ">=1.4.0"
|
|
86
86
|
},
|
|
87
87
|
"bugs": {
|
|
88
88
|
"url": "https://github.com/dgreif/ring/issues"
|