ring-client-api 10.0.0-beta.3 → 10.0.0-beta.6
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 +46 -0
- package/README.md +0 -3
- package/lib/api/api.d.ts +2 -4
- package/lib/api/api.js +64 -23
- package/lib/api/index.js +5 -1
- package/lib/api/ring-camera.d.ts +22 -16
- package/lib/api/ring-camera.js +52 -37
- package/lib/api/ring-types.d.ts +76 -26
- package/lib/api/ring-types.js +18 -7
- package/lib/api/{peer-connection.d.ts → streaming/peer-connection.d.ts} +21 -4
- package/lib/api/{peer-connection.js → streaming/peer-connection.js} +17 -6
- package/lib/api/streaming/ring-edge-connection.d.ts +65 -0
- package/lib/api/streaming/ring-edge-connection.js +155 -0
- package/lib/api/streaming/streaming-connection-base.d.ts +30 -0
- package/lib/api/streaming/streaming-connection-base.js +111 -0
- package/lib/api/{live-call.d.ts → streaming/streaming-session.d.ts} +15 -18
- package/lib/api/{live-call.js → streaming/streaming-session.js} +32 -94
- package/lib/api/streaming/webrtc-connection.d.ts +23 -0
- package/lib/api/streaming/webrtc-connection.js +60 -0
- package/lib/api/util.js +8 -1
- package/lib/test/api/ring-camera.spec.js +3 -1
- package/package.json +31 -30
- package/lib/api/live-call-ring-edge.d.ts +0 -41
- package/lib/api/live-call-ring-edge.js +0 -294
|
@@ -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.
|
|
13
|
-
const
|
|
12
|
+
exports.StreamingSession = void 0;
|
|
13
|
+
const camera_utils_1 = require("@homebridge/camera-utils");
|
|
14
14
|
const rxjs_1 = require("rxjs");
|
|
15
|
-
const
|
|
16
|
-
const util_1 = require("
|
|
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("
|
|
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
|
-
|
|
30
|
-
|
|
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.
|
|
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
|
-
|
|
44
|
-
this.
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
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
|
-
|
|
53
|
+
activateCameraSpeaker() {
|
|
71
54
|
return __awaiter(this, void 0, void 0, function* () {
|
|
72
|
-
|
|
73
|
-
|
|
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,47 +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.onCallAnswered);
|
|
149
|
-
this.sendMessage({ method: 'activate_session' });
|
|
150
|
-
this.sendMessage({
|
|
151
|
-
video_enabled: true,
|
|
152
|
-
audio_enabled: true,
|
|
153
|
-
method: 'stream_options',
|
|
154
|
-
});
|
|
155
|
-
});
|
|
156
|
-
}
|
|
157
|
-
activateCameraSpeaker() {
|
|
158
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
159
|
-
yield (0, rxjs_1.firstValueFrom)(this.onCallAnswered);
|
|
160
|
-
this.sendMessage({
|
|
161
|
-
stealth_mode: false,
|
|
162
|
-
method: 'camera_options',
|
|
163
|
-
});
|
|
164
|
-
});
|
|
165
|
-
}
|
|
166
|
-
sendMessage(message) {
|
|
167
|
-
this.ws.send(JSON.stringify(message));
|
|
168
|
-
}
|
|
169
117
|
callEnded() {
|
|
170
|
-
try {
|
|
171
|
-
this.sendMessage({
|
|
172
|
-
reason: { code: 0, text: '' },
|
|
173
|
-
method: 'close',
|
|
174
|
-
});
|
|
175
|
-
this.ws.close();
|
|
176
|
-
}
|
|
177
|
-
catch (_) {
|
|
178
|
-
// ignore any errors since we are stopping the call
|
|
179
|
-
}
|
|
180
118
|
this.unsubscribe();
|
|
181
119
|
this.onCallEnded.next();
|
|
182
|
-
this.
|
|
120
|
+
this.connection.stop();
|
|
183
121
|
this.audioSplitter.close();
|
|
184
122
|
this.videoSplitter.close();
|
|
185
123
|
}
|
|
@@ -187,7 +125,7 @@ class LiveCall extends subscribed_1.Subscribed {
|
|
|
187
125
|
this.callEnded();
|
|
188
126
|
}
|
|
189
127
|
sendAudioPacket(rtp) {
|
|
190
|
-
this.
|
|
128
|
+
this.connection.sendAudioPacket(rtp);
|
|
191
129
|
}
|
|
192
130
|
}
|
|
193
|
-
exports.
|
|
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/lib/api/util.js
CHANGED
|
@@ -18,7 +18,8 @@ const colors_1 = require("colors");
|
|
|
18
18
|
const readline_1 = require("readline");
|
|
19
19
|
const uuid_1 = require("uuid");
|
|
20
20
|
const systeminformation_1 = require("systeminformation");
|
|
21
|
-
const
|
|
21
|
+
const logger_1 = __importDefault(require("@eneris/push-receiver/dist/utils/logger"));
|
|
22
|
+
const debugLogger = (0, debug_1.default)('ring'), uuidNamespace = 'e53ffdc0-e91d-4ce1-bec2-df939d94739d';
|
|
22
23
|
let logger = {
|
|
23
24
|
logInfo(message) {
|
|
24
25
|
debugLogger(message);
|
|
@@ -120,3 +121,9 @@ function randomString(length) {
|
|
|
120
121
|
return uuid.replace(/-/g, '').substring(0, length).toLowerCase();
|
|
121
122
|
}
|
|
122
123
|
exports.randomString = randomString;
|
|
124
|
+
// Override push receiver logging to avoid ECONNRESET errors leaking
|
|
125
|
+
function logPushReceiver(...args) {
|
|
126
|
+
logDebug('[Push Receiver]');
|
|
127
|
+
logDebug(args[0]);
|
|
128
|
+
}
|
|
129
|
+
logger_1.default.error = logPushReceiver;
|
|
@@ -4,7 +4,9 @@ const api_1 = require("../../api");
|
|
|
4
4
|
describe('Ring Camera', () => {
|
|
5
5
|
describe('battery level', () => {
|
|
6
6
|
it('should handle string battery life', () => {
|
|
7
|
-
expect((0, api_1.getBatteryLevel)({
|
|
7
|
+
expect((0, api_1.getBatteryLevel)({
|
|
8
|
+
battery_life: '49',
|
|
9
|
+
})).toEqual(49);
|
|
8
10
|
});
|
|
9
11
|
it('should handle null battery life', () => {
|
|
10
12
|
expect((0, api_1.getBatteryLevel)({ battery_life: null })).toEqual(null);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ring-client-api",
|
|
3
|
-
"version": "10.0.0-beta.
|
|
3
|
+
"version": "10.0.0-beta.6",
|
|
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,7 +14,7 @@
|
|
|
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",
|
|
17
|
+
"build-quick": "rm -rf lib && esbuild ./{api,examples,homebridge}/*.ts ./api/streaming/*.ts --target=es2017 --format=cjs --outdir=lib",
|
|
18
18
|
"example": "npm run build-quick && node ./lib/examples/example.js",
|
|
19
19
|
"api-example": "npm run build-quick && node ./lib/examples/api-example.js",
|
|
20
20
|
"record-example": "npm run build-quick && node ./lib/examples/record-example.js",
|
|
@@ -55,44 +55,45 @@
|
|
|
55
55
|
"author": "dgreif",
|
|
56
56
|
"license": "MIT",
|
|
57
57
|
"dependencies": {
|
|
58
|
-
"@
|
|
59
|
-
"@homebridge/
|
|
60
|
-
"@
|
|
58
|
+
"@eneris/push-receiver": "^3.0.1",
|
|
59
|
+
"@homebridge/camera-utils": "^2.1.0",
|
|
60
|
+
"@homebridge/plugin-ui-utils": "^0.0.19",
|
|
61
|
+
"@koush/werift": "0.14.5-beta9",
|
|
61
62
|
"@types/socket.io-client": "1.4.36",
|
|
62
|
-
"colors": "1.4.0",
|
|
63
|
-
"debug": "4.3.
|
|
64
|
-
"got": "11.8.3",
|
|
65
|
-
"rxjs": "7.5.
|
|
66
|
-
"socket.io-client": "2.4.0",
|
|
67
|
-
"systeminformation": "5.
|
|
68
|
-
"uuid": "8.3.2",
|
|
69
|
-
"ws": "8.
|
|
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"
|
|
70
71
|
},
|
|
71
72
|
"devDependencies": {
|
|
72
73
|
"@types/debug": "4.1.7",
|
|
73
|
-
"@types/jest": "27.
|
|
74
|
-
"@types/node": "17.0.
|
|
74
|
+
"@types/jest": "27.5.0",
|
|
75
|
+
"@types/node": "17.0.31",
|
|
75
76
|
"@types/uuid": "8.3.4",
|
|
76
|
-
"@types/ws": "^8.
|
|
77
|
-
"@typescript-eslint/eslint-plugin": "5.
|
|
78
|
-
"@typescript-eslint/parser": "5.
|
|
79
|
-
"concurrently": "^7.
|
|
77
|
+
"@types/ws": "^8.5.3",
|
|
78
|
+
"@typescript-eslint/eslint-plugin": "5.22.0",
|
|
79
|
+
"@typescript-eslint/parser": "5.22.0",
|
|
80
|
+
"concurrently": "^7.1.0",
|
|
80
81
|
"conventional-github-releaser": "3.1.5",
|
|
81
|
-
"dotenv": "
|
|
82
|
-
"esbuild": "^0.14.
|
|
83
|
-
"eslint": "8.
|
|
84
|
-
"eslint-config-prettier": "8.
|
|
85
|
-
"eslint-plugin-jest": "
|
|
82
|
+
"dotenv": "16.0.0",
|
|
83
|
+
"esbuild": "^0.14.38",
|
|
84
|
+
"eslint": "8.14.0",
|
|
85
|
+
"eslint-config-prettier": "8.5.0",
|
|
86
|
+
"eslint-plugin-jest": "26.1.5",
|
|
86
87
|
"eslint-plugin-prettier": "4.0.0",
|
|
87
|
-
"express": "4.
|
|
88
|
-
"homebridge": "1.4.
|
|
89
|
-
"jest": "
|
|
90
|
-
"prettier": "2.
|
|
88
|
+
"express": "4.18.1",
|
|
89
|
+
"homebridge": "1.4.1",
|
|
90
|
+
"jest": "28.1.0",
|
|
91
|
+
"prettier": "2.6.2",
|
|
91
92
|
"reflect-metadata": "0.1.13",
|
|
92
93
|
"rimraf": "3.0.2",
|
|
93
94
|
"standard-version": "9.3.2",
|
|
94
|
-
"ts-jest": "
|
|
95
|
-
"typescript": "4.
|
|
95
|
+
"ts-jest": "28.0.1",
|
|
96
|
+
"typescript": "4.6.4"
|
|
96
97
|
},
|
|
97
98
|
"engines": {
|
|
98
99
|
"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 {};
|