ring-client-api 10.0.0-beta.5 → 10.0.0-beta.8

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.
@@ -0,0 +1,111 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.StreamingConnectionBase = void 0;
13
+ const peer_connection_1 = require("./peer-connection");
14
+ const subscribed_1 = require("../subscribed");
15
+ const rxjs_1 = require("rxjs");
16
+ const operators_1 = require("rxjs/operators");
17
+ const util_1 = require("../util");
18
+ class StreamingConnectionBase extends subscribed_1.Subscribed {
19
+ constructor(ws, options = {}) {
20
+ super();
21
+ this.ws = ws;
22
+ this.options = options;
23
+ this.onCallAnswered = new rxjs_1.ReplaySubject(1);
24
+ this.onCallEnded = new rxjs_1.ReplaySubject(1);
25
+ this.activated = false;
26
+ if (options.createPeerConnection) {
27
+ // we were passed a custom peer connection factory
28
+ this.pc = options.createPeerConnection();
29
+ // passing rtp packets is not supported for custom peer connections
30
+ this.onAudioRtp = new rxjs_1.Subject();
31
+ this.onVideoRtp = new rxjs_1.Subject();
32
+ }
33
+ else {
34
+ // no custom peer connection factory, use the werift and pass along rtp packets
35
+ const pc = new peer_connection_1.WeriftPeerConnection();
36
+ this.pc = pc;
37
+ this.onAudioRtp = pc.onAudioRtp;
38
+ this.onVideoRtp = pc.onVideoRtp;
39
+ }
40
+ this.onWsOpen = (0, rxjs_1.fromEvent)(this.ws, 'open');
41
+ const onMessage = (0, rxjs_1.fromEvent)(this.ws, 'message'), onError = (0, rxjs_1.fromEvent)(this.ws, 'error'), onClose = (0, rxjs_1.fromEvent)(this.ws, 'close');
42
+ this.addSubscriptions(onMessage
43
+ .pipe((0, operators_1.concatMap)((message) => {
44
+ return this.handleMessage(JSON.parse(message.data));
45
+ }))
46
+ .subscribe(), onError.subscribe((e) => {
47
+ (0, util_1.logError)(e);
48
+ this.callEnded();
49
+ }), onClose.subscribe(() => {
50
+ this.callEnded();
51
+ }), this.pc.onConnectionState.subscribe((state) => {
52
+ if (state === 'failed') {
53
+ (0, util_1.logError)('Stream connection failed');
54
+ this.callEnded();
55
+ }
56
+ if (state === 'closed') {
57
+ (0, util_1.logDebug)('Stream connection closed');
58
+ this.callEnded();
59
+ }
60
+ }));
61
+ }
62
+ activate() {
63
+ return __awaiter(this, void 0, void 0, function* () {
64
+ if (this.activated) {
65
+ return;
66
+ }
67
+ this.activated = true;
68
+ yield (0, rxjs_1.firstValueFrom)(this.pc.onConnectionState.pipe((0, operators_1.filter)((state) => state === 'connected')));
69
+ (0, util_1.logInfo)('Activating Session');
70
+ this.sendSessionMessage('activate_session');
71
+ });
72
+ }
73
+ activateCameraSpeaker() {
74
+ return __awaiter(this, void 0, void 0, function* () {
75
+ yield (0, rxjs_1.firstValueFrom)(this.onCallAnswered);
76
+ this.sendSessionMessage('camera_options', {
77
+ stealth_mode: false,
78
+ });
79
+ });
80
+ }
81
+ sendMessage(message) {
82
+ this.ws.send(JSON.stringify(message));
83
+ }
84
+ sendAudioPacket(rtp) {
85
+ if (this.pc instanceof peer_connection_1.WeriftPeerConnection) {
86
+ this.pc.returnAudioTrack.writeRtp(rtp);
87
+ }
88
+ else {
89
+ throw new Error('Cannot send audio packets to a custom peer connection implementation');
90
+ }
91
+ }
92
+ callEnded() {
93
+ try {
94
+ this.sendMessage({
95
+ reason: { code: 0, text: '' },
96
+ method: 'close',
97
+ });
98
+ this.ws.close();
99
+ }
100
+ catch (_) {
101
+ // ignore any errors since we are stopping the call
102
+ }
103
+ this.unsubscribe();
104
+ this.onCallEnded.next();
105
+ this.pc.close();
106
+ }
107
+ stop() {
108
+ this.callEnded();
109
+ }
110
+ }
111
+ exports.StreamingConnectionBase = StreamingConnectionBase;
@@ -1,7 +1,9 @@
1
- import { ReplaySubject } from 'rxjs';
2
- import { RingCamera } from './ring-camera';
3
- import { Subscribed } from './subscribed';
4
1
  import { RtpPacket } from '@koush/werift';
2
+ import { ReplaySubject, Subject } from 'rxjs';
3
+ import { RingEdgeConnection } from './ring-edge-connection';
4
+ import { WebrtcConnection } from './webrtc-connection';
5
+ import { RingCamera } from '../ring-camera';
6
+ import { Subscribed } from '../subscribed';
5
7
  declare type SpawnInput = string | number;
6
8
  export interface FfmpegOptions {
7
9
  input?: SpawnInput[];
@@ -9,27 +11,22 @@ export interface FfmpegOptions {
9
11
  audio?: SpawnInput[];
10
12
  output: SpawnInput[];
11
13
  }
12
- export declare class LiveCall extends Subscribed {
13
- private sessionId;
14
- private camera;
15
- private readonly ws;
16
- private readonly onWsOpen;
17
- private readonly onMessage;
18
- private readonly pc;
19
- readonly onCallAnswered: ReplaySubject<string>;
14
+ export declare class StreamingSession extends Subscribed {
15
+ private readonly camera;
16
+ private connection;
20
17
  readonly onCallEnded: ReplaySubject<void>;
18
+ readonly onVideoRtp: Subject<RtpPacket>;
19
+ readonly onAudioRtp: Subject<RtpPacket>;
21
20
  private readonly audioSplitter;
22
21
  private readonly videoSplitter;
23
- readonly onVideoRtp: import("rxjs").Subject<RtpPacket>;
24
- readonly onAudioRtp: import("rxjs").Subject<RtpPacket>;
25
- constructor(sessionId: string, camera: RingCamera);
26
- private handleMessage;
27
- reservePort(bufferPorts?: number): Promise<number>;
28
- startTranscoding(ffmpegOptions: FfmpegOptions): Promise<void>;
22
+ constructor(camera: RingCamera, connection: RingEdgeConnection | WebrtcConnection);
23
+ private bindToConnection;
29
24
  activated: boolean;
30
25
  activate(): Promise<void>;
26
+ cameraSpeakerActivated: boolean;
31
27
  activateCameraSpeaker(): Promise<void>;
32
- private sendMessage;
28
+ reservePort(bufferPorts?: number): Promise<number>;
29
+ startTranscoding(ffmpegOptions: FfmpegOptions): Promise<void>;
33
30
  private callEnded;
34
31
  stop(): void;
35
32
  sendAudioPacket(rtp: RtpPacket): void;
@@ -9,15 +9,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  });
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.LiveCall = void 0;
13
- const ws_1 = require("ws");
12
+ exports.StreamingSession = void 0;
13
+ const camera_utils_1 = require("@homebridge/camera-utils");
14
14
  const rxjs_1 = require("rxjs");
15
- const peer_connection_1 = require("./peer-connection");
16
- const util_1 = require("./util");
15
+ const ffmpeg_1 = require("../ffmpeg");
16
+ const util_1 = require("../util");
17
17
  const operators_1 = require("rxjs/operators");
18
- const subscribed_1 = require("./subscribed");
19
- const camera_utils_1 = require("@homebridge/camera-utils");
20
- const ffmpeg_1 = require("./ffmpeg");
18
+ const subscribed_1 = require("../subscribed");
21
19
  function getCleanSdp(sdp, includeVideo) {
22
20
  return sdp
23
21
  .split('\nm=')
@@ -26,62 +24,39 @@ function getCleanSdp(sdp, includeVideo) {
26
24
  .filter((section) => includeVideo || !section.startsWith('m=video'))
27
25
  .join('\n');
28
26
  }
29
- function parseLiveCallSession(sessionId) {
30
- const encodedSession = sessionId.split('.')[1], buff = Buffer.from(encodedSession, 'base64'), text = buff.toString('ascii');
31
- return JSON.parse(text);
32
- }
33
- class LiveCall extends subscribed_1.Subscribed {
34
- constructor(sessionId, camera) {
27
+ class StreamingSession extends subscribed_1.Subscribed {
28
+ constructor(camera, connection) {
35
29
  super();
36
- this.sessionId = sessionId;
37
30
  this.camera = camera;
38
- this.onCallAnswered = new rxjs_1.ReplaySubject(1);
31
+ this.connection = connection;
39
32
  this.onCallEnded = new rxjs_1.ReplaySubject(1);
33
+ this.onVideoRtp = new rxjs_1.Subject();
34
+ this.onAudioRtp = new rxjs_1.Subject();
40
35
  this.audioSplitter = new camera_utils_1.RtpSplitter();
41
36
  this.videoSplitter = new camera_utils_1.RtpSplitter();
42
37
  this.activated = false;
43
- const liveCallSession = parseLiveCallSession(sessionId);
44
- this.pc = new peer_connection_1.PeerConnection();
45
- this.ws = new ws_1.WebSocket(`wss://${liveCallSession.rms_fqdn}:${liveCallSession.webrtc_port}/`, {
46
- headers: {
47
- API_VERSION: '3.1',
48
- API_TOKEN: sessionId,
49
- CLIENT_INFO: 'Ring/3.49.0;Platform/Android;OS/7.0;Density/2.0;Device/samsung-SM-T710;Locale/en-US;TimeZone/GMT-07:00',
50
- },
38
+ this.cameraSpeakerActivated = false;
39
+ this.bindToConnection(connection);
40
+ }
41
+ bindToConnection(connection) {
42
+ this.addSubscriptions(connection.onAudioRtp.subscribe(this.onAudioRtp), connection.onVideoRtp.subscribe(this.onVideoRtp));
43
+ }
44
+ activate() {
45
+ return __awaiter(this, void 0, void 0, function* () {
46
+ if (this.activated) {
47
+ return;
48
+ }
49
+ this.activated = true;
50
+ yield this.connection.activate();
51
51
  });
52
- this.onAudioRtp = this.pc.onAudioRtp;
53
- this.onVideoRtp = this.pc.onVideoRtp;
54
- this.onMessage = (0, rxjs_1.fromEvent)(this.ws, 'message');
55
- this.onWsOpen = (0, rxjs_1.fromEvent)(this.ws, 'open');
56
- const onError = (0, rxjs_1.fromEvent)(this.ws, 'error'), onClose = (0, rxjs_1.fromEvent)(this.ws, 'close');
57
- this.addSubscriptions(this.onMessage
58
- .pipe((0, operators_1.concatMap)((message) => {
59
- return this.handleMessage(JSON.parse(message.data));
60
- }))
61
- .subscribe(), this.onWsOpen.subscribe(() => {
62
- (0, util_1.logDebug)(`WebSocket connected for ${this.camera.name}`);
63
- }), onError.subscribe((e) => {
64
- (0, util_1.logError)(e);
65
- this.callEnded();
66
- }), onClose.subscribe(() => {
67
- this.callEnded();
68
- }));
69
52
  }
70
- handleMessage(message) {
53
+ activateCameraSpeaker() {
71
54
  return __awaiter(this, void 0, void 0, function* () {
72
- switch (message.method) {
73
- case 'sdp':
74
- const answer = yield this.pc.createAnswer(message);
75
- this.sendMessage(Object.assign({ method: 'sdp' }, answer));
76
- this.onCallAnswered.next(message.sdp);
77
- return;
78
- case 'ice':
79
- yield this.pc.addIceCandidate({
80
- candidate: message.ice,
81
- sdpMLineIndex: message.mlineindex,
82
- });
83
- return;
55
+ if (this.cameraSpeakerActivated) {
56
+ return;
84
57
  }
58
+ this.cameraSpeakerActivated = true;
59
+ yield this.connection.activateCameraSpeaker();
85
60
  });
86
61
  }
87
62
  reservePort(bufferPorts = 0) {
@@ -103,7 +78,7 @@ class LiveCall extends subscribed_1.Subscribed {
103
78
  ...(ffmpegOptions.input || []),
104
79
  '-i',
105
80
  'pipe:',
106
- ], ringSdp = yield (0, rxjs_1.firstValueFrom)(this.onCallAnswered), inputSdp = getCleanSdp(ringSdp, transcodeVideoStream)
81
+ ], ringSdp = yield (0, rxjs_1.firstValueFrom)(this.connection.onCallAnswered), inputSdp = getCleanSdp(ringSdp, transcodeVideoStream)
107
82
  .replace(/m=audio \d+/, `m=audio ${audioPort}`)
108
83
  .replace(/m=video \d+/, `m=video ${videoPort}`), ff = new camera_utils_1.FfmpegProcess({
109
84
  ffmpegArgs: ffmpegInputArguments.concat(...(ffmpegOptions.audio || ['-acodec', 'aac']), ...(transcodeVideoStream
@@ -139,48 +114,10 @@ class LiveCall extends subscribed_1.Subscribed {
139
114
  yield this.activate();
140
115
  });
141
116
  }
142
- activate() {
143
- return __awaiter(this, void 0, void 0, function* () {
144
- if (this.activated) {
145
- return;
146
- }
147
- this.activated = true;
148
- yield (0, rxjs_1.firstValueFrom)(this.pc.onConnectionState.pipe((0, operators_1.filter)((state) => state === 'connected')));
149
- (0, util_1.logInfo)('Activating Session');
150
- this.sendMessage({ method: 'activate_session' });
151
- this.sendMessage({
152
- video_enabled: true,
153
- audio_enabled: true,
154
- method: 'stream_options',
155
- });
156
- });
157
- }
158
- activateCameraSpeaker() {
159
- return __awaiter(this, void 0, void 0, function* () {
160
- yield (0, rxjs_1.firstValueFrom)(this.onCallAnswered);
161
- this.sendMessage({
162
- stealth_mode: false,
163
- method: 'camera_options',
164
- });
165
- });
166
- }
167
- sendMessage(message) {
168
- this.ws.send(JSON.stringify(message));
169
- }
170
117
  callEnded() {
171
- try {
172
- this.sendMessage({
173
- reason: { code: 0, text: '' },
174
- method: 'close',
175
- });
176
- this.ws.close();
177
- }
178
- catch (_) {
179
- // ignore any errors since we are stopping the call
180
- }
181
118
  this.unsubscribe();
182
119
  this.onCallEnded.next();
183
- this.pc.close();
120
+ this.connection.stop();
184
121
  this.audioSplitter.close();
185
122
  this.videoSplitter.close();
186
123
  }
@@ -188,7 +125,7 @@ class LiveCall extends subscribed_1.Subscribed {
188
125
  this.callEnded();
189
126
  }
190
127
  sendAudioPacket(rtp) {
191
- this.pc.returnAudioTrack.writeRtp(rtp);
128
+ this.connection.sendAudioPacket(rtp);
192
129
  }
193
130
  }
194
- exports.LiveCall = LiveCall;
131
+ exports.StreamingSession = StreamingSession;
@@ -0,0 +1,23 @@
1
+ import { RingCamera } from '../ring-camera';
2
+ import { StreamingConnectionBase, StreamingConnectionOptions } from './streaming-connection-base';
3
+ interface InitializationMessage {
4
+ method: 'initialization';
5
+ text: 'Done';
6
+ }
7
+ interface OfferMessage {
8
+ method: 'sdp';
9
+ sdp: string;
10
+ type: 'offer';
11
+ }
12
+ interface IceCandidateMessage {
13
+ method: 'ice';
14
+ ice: string;
15
+ mlineindex: number;
16
+ }
17
+ export declare class WebrtcConnection extends StreamingConnectionBase {
18
+ private sessionId;
19
+ constructor(sessionId: string, camera: RingCamera, options: StreamingConnectionOptions);
20
+ protected handleMessage(message: InitializationMessage | OfferMessage | IceCandidateMessage): Promise<void>;
21
+ protected sendSessionMessage(method: string, body?: Record<any, any>): void;
22
+ }
23
+ export {};
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.WebrtcConnection = void 0;
13
+ const ws_1 = require("ws");
14
+ const streaming_connection_base_1 = require("./streaming-connection-base");
15
+ const util_1 = require("../util");
16
+ function parseLiveCallSession(sessionId) {
17
+ const encodedSession = sessionId.split('.')[1], buff = Buffer.from(encodedSession, 'base64'), text = buff.toString('ascii');
18
+ return JSON.parse(text);
19
+ }
20
+ class WebrtcConnection extends streaming_connection_base_1.StreamingConnectionBase {
21
+ constructor(sessionId, camera, options) {
22
+ const liveCallSession = parseLiveCallSession(sessionId);
23
+ super(new ws_1.WebSocket(`wss://${liveCallSession.rms_fqdn}:${liveCallSession.webrtc_port}/`, {
24
+ headers: {
25
+ API_VERSION: '3.1',
26
+ API_TOKEN: sessionId,
27
+ CLIENT_INFO: 'Ring/3.49.0;Platform/Android;OS/7.0;Density/2.0;Device/samsung-SM-T710;Locale/en-US;TimeZone/GMT-07:00',
28
+ },
29
+ }), options);
30
+ this.sessionId = sessionId;
31
+ this.addSubscriptions(this.onWsOpen.subscribe(() => {
32
+ (0, util_1.logDebug)(`WebSocket connected for ${camera.name}`);
33
+ }));
34
+ }
35
+ handleMessage(message) {
36
+ return __awaiter(this, void 0, void 0, function* () {
37
+ switch (message.method) {
38
+ case 'sdp':
39
+ const answer = yield this.pc.createAnswer(message);
40
+ this.sendSessionMessage('sdp', answer);
41
+ this.onCallAnswered.next(message.sdp);
42
+ this.sendSessionMessage('stream_options', {
43
+ audio_enabled: true,
44
+ video_enabled: true,
45
+ });
46
+ return;
47
+ case 'ice':
48
+ yield this.pc.addIceCandidate({
49
+ candidate: message.ice,
50
+ sdpMLineIndex: message.mlineindex,
51
+ });
52
+ return;
53
+ }
54
+ });
55
+ }
56
+ sendSessionMessage(method, body = {}) {
57
+ this.sendMessage(Object.assign(Object.assign({}, body), { method }));
58
+ }
59
+ }
60
+ exports.WebrtcConnection = WebrtcConnection;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ring-client-api",
3
- "version": "10.0.0-beta.5",
3
+ "version": "10.0.0-beta.8",
4
4
  "description": "Unofficial API for Ring doorbells, cameras, security alarm system and smart lighting",
5
5
  "main": "lib/api/index.js",
6
6
  "bin": {
@@ -14,13 +14,13 @@
14
14
  "watch:tests": "jest --watch",
15
15
  "lint": "eslint '**/*.ts' --fix",
16
16
  "build": "rm -rf lib && tsc --declaration",
17
- "build-quick": "rm -rf lib && esbuild ./{api,examples,homebridge}/*.ts --target=es2017 --format=cjs --outdir=lib",
18
- "example": "npm run build-quick && node ./lib/examples/example.js",
19
- "api-example": "npm run build-quick && node ./lib/examples/api-example.js",
20
- "record-example": "npm run build-quick && node ./lib/examples/record-example.js",
21
- "return-audio-example": "npm run build-quick && node ./lib/examples/return-audio-example.js",
22
- "stream-example": "npm run build-quick && node ./lib/examples/stream-example.js",
23
- "browser-example": "npm run build-quick && node ./lib/examples/browser-example.js",
17
+ "build-quick": "rm -rf lib && esbuild ./{api,examples,homebridge}/*.ts ./api/streaming/*.ts --target=es2017 --format=cjs --outdir=lib",
18
+ "example": "node -r @swc-node/register ./lib/examples/example.js",
19
+ "api-example": "node -r @swc-node/register ./lib/examples/api-example.js",
20
+ "record-example": "node -r @swc-node/register ./lib/examples/record-example.js",
21
+ "return-audio-example": "node -r @swc-node/register ./lib/examples/return-audio-example.js",
22
+ "stream-example": "node -r @swc-node/register ./lib/examples/stream-example.js",
23
+ "browser-example": "node -r @swc-node/register ./lib/examples/browser-example.js",
24
24
  "auth-cli": "npm run build-quick && ./ring-auth-cli.js",
25
25
  "device-data-cli": "npm run build-quick && ./ring-device-data-cli.js",
26
26
  "hb": "npm run build-quick && ./build/package-homebridge.sh && homebridge -P ./release-homebridge -U ./.homebridge",
@@ -56,44 +56,45 @@
56
56
  "license": "MIT",
57
57
  "dependencies": {
58
58
  "@eneris/push-receiver": "^3.0.1",
59
- "@homebridge/camera-utils": "2.1.0",
60
- "@homebridge/plugin-ui-utils": "0.0.19",
59
+ "@homebridge/camera-utils": "^2.1.0",
60
+ "@homebridge/plugin-ui-utils": "^0.0.19",
61
61
  "@koush/werift": "0.14.5-beta9",
62
62
  "@types/socket.io-client": "1.4.36",
63
- "colors": "1.4.0",
64
- "debug": "4.3.4",
65
- "got": "11.8.3",
66
- "rxjs": "7.5.5",
67
- "socket.io-client": "2.4.0",
68
- "systeminformation": "5.11.9",
69
- "uuid": "8.3.2",
70
- "ws": "8.5.0"
63
+ "colors": "^1.4.0",
64
+ "debug": "^4.3.4",
65
+ "got": "^11.8.3",
66
+ "rxjs": "^7.5.5",
67
+ "socket.io-client": "^2.4.0",
68
+ "systeminformation": "^5.11.14",
69
+ "uuid": "^8.3.2",
70
+ "ws": "^8.6.0"
71
71
  },
72
72
  "devDependencies": {
73
+ "@swc-node/register": "^1.5.1",
73
74
  "@types/debug": "4.1.7",
74
- "@types/jest": "27.4.1",
75
- "@types/node": "17.0.23",
75
+ "@types/jest": "27.5.0",
76
+ "@types/node": "17.0.31",
76
77
  "@types/uuid": "8.3.4",
77
78
  "@types/ws": "^8.5.3",
78
- "@typescript-eslint/eslint-plugin": "5.18.0",
79
- "@typescript-eslint/parser": "5.18.0",
79
+ "@typescript-eslint/eslint-plugin": "5.22.0",
80
+ "@typescript-eslint/parser": "5.22.0",
80
81
  "concurrently": "^7.1.0",
81
82
  "conventional-github-releaser": "3.1.5",
82
83
  "dotenv": "16.0.0",
83
- "esbuild": "^0.14.34",
84
- "eslint": "8.13.0",
84
+ "esbuild": "^0.14.38",
85
+ "eslint": "8.14.0",
85
86
  "eslint-config-prettier": "8.5.0",
86
- "eslint-plugin-jest": "26.1.4",
87
+ "eslint-plugin-jest": "26.1.5",
87
88
  "eslint-plugin-prettier": "4.0.0",
88
- "express": "4.17.3",
89
- "homebridge": "1.4.0",
90
- "jest": "27.5.1",
89
+ "express": "4.18.1",
90
+ "homebridge": "1.4.1",
91
+ "jest": "28.1.0",
91
92
  "prettier": "2.6.2",
92
93
  "reflect-metadata": "0.1.13",
93
94
  "rimraf": "3.0.2",
94
95
  "standard-version": "9.3.2",
95
- "ts-jest": "27.1.4",
96
- "typescript": "4.6.3"
96
+ "ts-jest": "28.0.1",
97
+ "typescript": "4.6.4"
97
98
  },
98
99
  "engines": {
99
100
  "node": "^12.20 || ^14 || ^16",
@@ -1,41 +0,0 @@
1
- import { ReplaySubject } from 'rxjs';
2
- import { RingCamera } from './ring-camera';
3
- import { Subscribed } from './subscribed';
4
- import { RtpPacket } from '@koush/werift';
5
- declare type SpawnInput = string | number;
6
- export interface FfmpegOptions {
7
- input?: SpawnInput[];
8
- video?: SpawnInput[] | false;
9
- audio?: SpawnInput[];
10
- output: SpawnInput[];
11
- }
12
- export declare class LiveCallRingEdge extends Subscribed {
13
- private camera;
14
- private readonly ws;
15
- private readonly onWsOpen;
16
- private readonly onMessage;
17
- private readonly pc;
18
- readonly onSessionId: ReplaySubject<string>;
19
- readonly onCallAnswered: ReplaySubject<string>;
20
- readonly onCallEnded: ReplaySubject<void>;
21
- private readonly audioSplitter;
22
- private readonly videoSplitter;
23
- readonly onVideoRtp: import("rxjs").Subject<RtpPacket>;
24
- readonly onAudioRtp: import("rxjs").Subject<RtpPacket>;
25
- private readonly onOfferSent;
26
- constructor(authToken: string, camera: RingCamera);
27
- private initiateCall;
28
- private sessionId;
29
- private handleMessage;
30
- reservePort(bufferPorts?: number): Promise<number>;
31
- startTranscoding(ffmpegOptions: FfmpegOptions): Promise<void>;
32
- activated: boolean;
33
- activate(): Promise<void>;
34
- activateCameraSpeaker(): Promise<void>;
35
- private sendSessionMessage;
36
- private sendMessage;
37
- private callEnded;
38
- stop(): void;
39
- sendAudioPacket(rtp: RtpPacket): void;
40
- }
41
- export {};