homebridge-ring 11.0.3 → 11.0.4

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 CHANGED
@@ -2,6 +2,14 @@
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.4](https://github.com/dgreif/ring/compare/v11.0.3...v11.0.4) (2022-05-29)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * handle unanswered calls when transcoding ([6f9d3df](https://github.com/dgreif/ring/commit/6f9d3dfa079f046a6b5cfa140fd67eb210669429))
11
+ * update werift and ring edge connection strategy ([7b786f3](https://github.com/dgreif/ring/commit/7b786f3ffd9ad8eb4a8f03f5eac9ca6c67517aae))
12
+
5
13
  ### [11.0.3](https://github.com/dgreif/ring/compare/v11.0.2...v11.0.3) (2022-05-28)
6
14
 
7
15
 
@@ -13,7 +13,7 @@ export interface BasicPeerConnection {
13
13
  type: 'answer';
14
14
  sdp: string;
15
15
  }): Promise<void>;
16
- addIceCandidate(candidate: RTCIceCandidate): Promise<void>;
16
+ addIceCandidate(candidate: Partial<RTCIceCandidate>): Promise<void>;
17
17
  onIceCandidate: Observable<RTCIceCandidate>;
18
18
  onConnectionState: Observable<ConnectionState>;
19
19
  close(): void;
@@ -6,7 +6,7 @@ const werift_1 = require("werift");
6
6
  const rxjs_1 = require("rxjs");
7
7
  const util_1 = require("../util");
8
8
  const subscribed_1 = require("../subscribed");
9
- const debug = false, ringIceServers = [
9
+ const ringIceServers = [
10
10
  'stun:stun.kinesisvideo.us-east-1.amazonaws.com:443',
11
11
  'stun:stun.kinesisvideo.us-east-2.amazonaws.com:443',
12
12
  'stun:stun.kinesisvideo.us-west-2.amazonaws.com:443',
@@ -59,6 +59,7 @@ class WeriftPeerConnection extends subscribed_1.Subscribed {
59
59
  },
60
60
  iceServers: ringIceServers.map((server) => ({ urls: server })),
61
61
  iceTransportPolicy: 'all',
62
+ bundlePolicy: 'disable',
62
63
  })), audioTransceiver = pc.addTransceiver(this.returnAudioTrack, {
63
64
  direction: 'sendrecv',
64
65
  }), videoTransceiver = pc.addTransceiver('video', {
@@ -71,11 +72,9 @@ class WeriftPeerConnection extends subscribed_1.Subscribed {
71
72
  track.onReceiveRtcp.subscribe((rtcp) => {
72
73
  this.onAudioRtcp.next(rtcp);
73
74
  });
74
- if (debug) {
75
- track.onReceiveRtp.once(() => {
76
- (0, util_1.logInfo)('received first audio packet');
77
- });
78
- }
75
+ track.onReceiveRtp.once(() => {
76
+ (0, util_1.logDebug)('received first audio packet');
77
+ });
79
78
  });
80
79
  videoTransceiver.onTrack.subscribe((track) => {
81
80
  track.onReceiveRtp.subscribe((rtp) => {
@@ -85,9 +84,7 @@ class WeriftPeerConnection extends subscribed_1.Subscribed {
85
84
  this.onVideoRtcp.next(rtcp);
86
85
  });
87
86
  track.onReceiveRtp.once(() => {
88
- if (debug) {
89
- (0, util_1.logInfo)('received first video packet');
90
- }
87
+ (0, util_1.logDebug)('received first video packet');
91
88
  this.addSubscriptions((0, rxjs_1.merge)(this.onRequestKeyFrame, (0, rxjs_1.interval)(4000)).subscribe(() => {
92
89
  videoTransceiver.receiver
93
90
  .sendRtcpPLI(track.ssrc)
@@ -54,17 +54,7 @@ class RingEdgeConnection extends streaming_connection_base_1.StreamingConnection
54
54
  body: {
55
55
  doorbot_id: camera.id,
56
56
  ice: iceCandidate.candidate,
57
- mlineindex: 0,
58
- },
59
- });
60
- // HACK: send ice candidate with both mline indexes to convince ring edge to connect both audio and video
61
- // Without this, only audio will connect unless you connect from the network of the Ring Edge router
62
- this.sendMessage({
63
- method: 'ice',
64
- body: {
65
- doorbot_id: camera.id,
66
- ice: iceCandidate.candidate,
67
- mlineindex: 1,
57
+ mlineindex: iceCandidate.sdpMLineIndex,
68
58
  },
69
59
  });
70
60
  }));
@@ -76,7 +66,7 @@ class RingEdgeConnection extends streaming_connection_base_1.StreamingConnection
76
66
  body: {
77
67
  doorbot_id: this.camera.id,
78
68
  stream_options: { audio_enabled: true, video_enabled: true },
79
- sdp: sdp.replace('\na=group:BUNDLE 0 1', ''),
69
+ sdp,
80
70
  },
81
71
  });
82
72
  this.onOfferSent.next();
@@ -62,7 +62,15 @@ class StreamingSession extends subscribed_1.Subscribed {
62
62
  if (this.hasEnded) {
63
63
  return;
64
64
  }
65
- const videoPort = await this.reservePort(1), audioPort = await this.reservePort(1), transcodeVideoStream = ffmpegOptions.video !== false, ringSdp = await (0, rxjs_1.firstValueFrom)(this.connection.onCallAnswered), usingOpus = await this.isUsingOpus, ffmpegInputArguments = [
65
+ const videoPort = await this.reservePort(1), audioPort = await this.reservePort(1), transcodeVideoStream = ffmpegOptions.video !== false, ringSdp = await Promise.race([
66
+ (0, rxjs_1.firstValueFrom)(this.connection.onCallAnswered),
67
+ (0, rxjs_1.firstValueFrom)(this.onCallEnded),
68
+ ]);
69
+ if (!ringSdp) {
70
+ (0, util_1.logDebug)('Call ended before answered');
71
+ return;
72
+ }
73
+ const usingOpus = await this.isUsingOpus, ffmpegInputArguments = [
66
74
  '-hide_banner',
67
75
  '-protocol_whitelist',
68
76
  'pipe,udp,rtp,file,crypto',
@@ -103,7 +111,7 @@ class StreamingSession extends subscribed_1.Subscribed {
103
111
  }))
104
112
  .subscribe());
105
113
  }
106
- this.onCallEnded.subscribe(() => ff.stop());
114
+ this.onCallEnded.pipe((0, operators_1.take)(1)).subscribe(() => ff.stop());
107
115
  ff.writeStdin(inputSdp);
108
116
  // Request a key frame now that ffmpeg is ready to receive
109
117
  this.requestKeyFrame();
@@ -142,7 +150,7 @@ class StreamingSession extends subscribed_1.Subscribed {
142
150
  info: util_1.logDebug,
143
151
  },
144
152
  });
145
- this.onCallEnded.subscribe(() => ff.stop());
153
+ this.onCallEnded.pipe((0, operators_1.take)(1)).subscribe(() => ff.stop());
146
154
  }
147
155
  callEnded() {
148
156
  if (this.hasEnded) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "homebridge-ring",
3
- "version": "11.0.3",
3
+ "version": "11.0.4",
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": {
@@ -42,7 +42,7 @@
42
42
  "@eneris/push-receiver": "^3.0.1",
43
43
  "@homebridge/camera-utils": "^2.1.1",
44
44
  "@homebridge/plugin-ui-utils": "^0.0.19",
45
- "werift": "^0.15.3",
45
+ "werift": "0.15.4",
46
46
  "@types/socket.io-client": "1.4.36",
47
47
  "colors": "^1.4.0",
48
48
  "debug": "^4.3.4",
@@ -65,7 +65,7 @@
65
65
  "concurrently": "^7.2.1",
66
66
  "conventional-github-releaser": "3.1.5",
67
67
  "dotenv": "16.0.1",
68
- "esbuild": "^0.14.41",
68
+ "esbuild": "^0.14.42",
69
69
  "eslint": "8.16.0",
70
70
  "eslint-config-prettier": "8.5.0",
71
71
  "eslint-plugin-jest": "26.4.2",