ring-client-api 13.2.1 → 14.0.0-beta.1
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/lib/api.d.ts +10 -8
- package/lib/api.js +57 -64
- package/lib/device-data.js +6 -9
- package/lib/ffmpeg.js +2 -6
- package/lib/index.d.ts +7 -7
- package/lib/index.js +7 -23
- package/lib/location.d.ts +32 -31
- package/lib/location.js +67 -72
- package/lib/refresh-token.js +6 -11
- package/lib/rest-client.d.ts +4 -4
- package/lib/rest-client.js +40 -51
- package/lib/ring-auth-cli.js +2 -4
- package/lib/ring-camera.d.ts +26 -23
- package/lib/ring-camera.js +64 -61
- package/lib/ring-chime.d.ts +7 -7
- package/lib/ring-chime.js +14 -18
- package/lib/ring-device-data-cli.js +2 -4
- package/lib/ring-device.d.ts +7 -7
- package/lib/ring-device.js +16 -20
- package/lib/ring-intercom.d.ts +8 -8
- package/lib/ring-intercom.js +23 -27
- package/lib/ring-types.d.ts +142 -133
- package/lib/ring-types.js +137 -153
- package/lib/streaming/peer-connection.d.ts +5 -3
- package/lib/streaming/peer-connection.js +25 -30
- package/lib/streaming/simple-webrtc-session.d.ts +3 -3
- package/lib/streaming/simple-webrtc-session.js +3 -7
- package/lib/streaming/streaming-messages.d.ts +6 -5
- package/lib/streaming/streaming-messages.js +6 -9
- package/lib/streaming/streaming-session.d.ts +5 -5
- package/lib/streaming/streaming-session.js +34 -38
- package/lib/streaming/webrtc-connection.d.ts +5 -5
- package/lib/streaming/webrtc-connection.js +39 -43
- package/lib/subscribed.d.ts +1 -1
- package/lib/subscribed.js +1 -5
- package/lib/test/rest-client.spec.js +44 -45
- package/lib/test/ring-camera.spec.js +12 -13
- package/lib/util.js +33 -54
- package/package.json +17 -19
package/lib/ring-types.js
CHANGED
|
@@ -1,115 +1,106 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
RingCameraKind["cocoa_camera"] = "cocoa_camera";
|
|
105
|
-
RingCameraKind["cocoa_doorbell"] = "cocoa_doorbell";
|
|
106
|
-
RingCameraKind["cocoa_floodlight"] = "cocoa_floodlight";
|
|
107
|
-
RingCameraKind["cocoa_spotlight"] = "cocoa_spotlight";
|
|
108
|
-
RingCameraKind["stickup_cam_mini"] = "stickup_cam_mini";
|
|
109
|
-
RingCameraKind["onvif_camera"] = "onvif_camera";
|
|
110
|
-
})(RingCameraKind || (exports.RingCameraKind = RingCameraKind = {}));
|
|
111
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
112
|
-
exports.RingCameraModel = {
|
|
1
|
+
export const RingDeviceType = {
|
|
2
|
+
BaseStation: 'hub.redsky',
|
|
3
|
+
BaseStationPro: 'hub.kili',
|
|
4
|
+
Keypad: 'security-keypad',
|
|
5
|
+
SecurityPanel: 'security-panel',
|
|
6
|
+
ContactSensor: 'sensor.contact',
|
|
7
|
+
MotionSensor: 'sensor.motion',
|
|
8
|
+
FloodFreezeSensor: 'sensor.flood-freeze',
|
|
9
|
+
FreezeSensor: 'sensor.freeze',
|
|
10
|
+
TemperatureSensor: 'sensor.temperature',
|
|
11
|
+
WaterSensor: 'sensor.water',
|
|
12
|
+
TiltSensor: 'sensor.tilt',
|
|
13
|
+
GlassbreakSensor: 'sensor.glassbreak',
|
|
14
|
+
RangeExtender: 'range-extender.zwave',
|
|
15
|
+
ZigbeeAdapter: 'adapter.zigbee',
|
|
16
|
+
AccessCodeVault: 'access-code.vault',
|
|
17
|
+
AccessCode: 'access-code',
|
|
18
|
+
SmokeAlarm: 'alarm.smoke',
|
|
19
|
+
CoAlarm: 'alarm.co',
|
|
20
|
+
SmokeCoListener: 'listener.smoke-co',
|
|
21
|
+
MultiLevelSwitch: 'switch.multilevel',
|
|
22
|
+
Fan: 'switch.multilevel',
|
|
23
|
+
MultiLevelBulb: 'switch.multilevel.bulb',
|
|
24
|
+
Switch: 'switch',
|
|
25
|
+
BeamsMotionSensor: 'motion-sensor.beams',
|
|
26
|
+
BeamsSwitch: 'switch.beams',
|
|
27
|
+
BeamsMultiLevelSwitch: 'switch.multilevel.beams',
|
|
28
|
+
BeamsLightGroupSwitch: 'group.light-group.beams',
|
|
29
|
+
BeamsTransformerSwitch: 'switch.transformer.beams',
|
|
30
|
+
BeamsDevice: 'device.beams',
|
|
31
|
+
RetrofitBridge: 'bridge.flatline',
|
|
32
|
+
RetrofitZone: 'sensor.zone',
|
|
33
|
+
Thermostat: 'temperature-control.thermostat',
|
|
34
|
+
Sensor: 'sensor',
|
|
35
|
+
RingNetAdapter: 'adapter.ringnet',
|
|
36
|
+
CodeVault: 'access-code.vault',
|
|
37
|
+
SecurityAccessCode: 'access-code',
|
|
38
|
+
ZWaveAdapter: 'adapter.zwave',
|
|
39
|
+
ZWaveExtender: 'range-extender.zwave',
|
|
40
|
+
PanicButton: 'security-panic',
|
|
41
|
+
UnknownZWave: 'unknown.zwave',
|
|
42
|
+
OnvifCamera: 'onvif_camera',
|
|
43
|
+
ThirdPartyGarageDoorOpener: 'third_party_gdo',
|
|
44
|
+
IntercomHandsetAudio: 'intercom_handset_audio',
|
|
45
|
+
WaterValve: 'valve.water',
|
|
46
|
+
};
|
|
47
|
+
export const RingDeviceCategory = {
|
|
48
|
+
Outlets: 1,
|
|
49
|
+
Lights: 2,
|
|
50
|
+
Sensors: 5,
|
|
51
|
+
Appliances: 7,
|
|
52
|
+
Locks: 10,
|
|
53
|
+
Thermostats: 11,
|
|
54
|
+
Cameras: 12,
|
|
55
|
+
Alarms: 15,
|
|
56
|
+
Fans: 17,
|
|
57
|
+
Security: 22,
|
|
58
|
+
Unknown: 29,
|
|
59
|
+
SensorsMotion: 30,
|
|
60
|
+
Controller: 31,
|
|
61
|
+
RangeExtenders: 32,
|
|
62
|
+
Keypads: 33,
|
|
63
|
+
Sirens: 34,
|
|
64
|
+
PanicButtons: 35,
|
|
65
|
+
WaterValves: 37,
|
|
66
|
+
};
|
|
67
|
+
export const RingCameraKind = {
|
|
68
|
+
doorbot: 'doorbot',
|
|
69
|
+
doorbell: 'doorbell',
|
|
70
|
+
doorbell_v3: 'doorbell_v3',
|
|
71
|
+
doorbell_v4: 'doorbell_v4',
|
|
72
|
+
doorbell_v5: 'doorbell_v5',
|
|
73
|
+
doorbell_oyster: 'doorbell_oyster', // used for the Ring Video Doorbell 4
|
|
74
|
+
doorbell_portal: 'doorbell_portal',
|
|
75
|
+
doorbell_scallop: 'doorbell_scallop',
|
|
76
|
+
doorbell_scallop_lite: 'doorbell_scallop_lite',
|
|
77
|
+
doorbell_graham_cracker: 'doorbell_graham_cracker',
|
|
78
|
+
lpd_v1: 'lpd_v1',
|
|
79
|
+
lpd_v2: 'lpd_v2',
|
|
80
|
+
lpd_v4: 'lpd_v4',
|
|
81
|
+
jbox_v1: 'jbox_v1',
|
|
82
|
+
stickup_cam: 'stickup_cam',
|
|
83
|
+
stickup_cam_v3: 'stickup_cam_v3',
|
|
84
|
+
stickup_cam_elite: 'stickup_cam_elite',
|
|
85
|
+
stickup_cam_longfin: 'stickup_cam_longfin',
|
|
86
|
+
stickup_cam_lunar: 'stickup_cam_lunar',
|
|
87
|
+
spotlightw_v2: 'spotlightw_v2',
|
|
88
|
+
hp_cam_v1: 'hp_cam_v1',
|
|
89
|
+
hp_cam_v2: 'hp_cam_v2',
|
|
90
|
+
stickup_cam_v4: 'stickup_cam_v4',
|
|
91
|
+
floodlight_v1: 'floodlight_v1',
|
|
92
|
+
floodlight_v2: 'floodlight_v2',
|
|
93
|
+
floodlight_pro: 'floodlight_pro',
|
|
94
|
+
cocoa_camera: 'cocoa_camera', // appears to be used for all next gen stickup cams (wired/battery/solar)
|
|
95
|
+
cocoa_doorbell: 'cocoa_doorbell',
|
|
96
|
+
cocoa_doorbell_v2: 'cocoa_doorbell_v2',
|
|
97
|
+
cocoa_doorbell_v3: 'cocoa_doorbell_v3',
|
|
98
|
+
cocoa_floodlight: 'cocoa_floodlight',
|
|
99
|
+
cocoa_spotlight: 'cocoa_spotlight', // used for the Spotlight Cam Plus (potentially other Spotlight models)
|
|
100
|
+
stickup_cam_mini: 'stickup_cam_mini',
|
|
101
|
+
onvif_camera: 'onvif_camera',
|
|
102
|
+
};
|
|
103
|
+
export const RingCameraModel = {
|
|
113
104
|
doorbot: 'Doorbell',
|
|
114
105
|
doorbell: 'Doorbell',
|
|
115
106
|
doorbell_v3: 'Doorbell',
|
|
@@ -138,12 +129,14 @@ exports.RingCameraModel = {
|
|
|
138
129
|
floodlight_pro: 'Floodlight Pro',
|
|
139
130
|
cocoa_camera: 'Stick Up Cam',
|
|
140
131
|
cocoa_doorbell: 'Doorbell Gen 2',
|
|
132
|
+
cocoa_doorbell_v2: 'Battery Doorbell Plus',
|
|
133
|
+
cocoa_doorbell_v3: 'Battery Doorbell Pro',
|
|
141
134
|
cocoa_floodlight: 'Floodlight Cam Plus',
|
|
142
135
|
cocoa_spotlight: 'Spotlight Cam Plus',
|
|
143
136
|
stickup_cam_mini: 'Indoor Cam',
|
|
144
137
|
onvif_camera: 'ONVIF Camera',
|
|
145
138
|
};
|
|
146
|
-
|
|
139
|
+
export const allAlarmStates = [
|
|
147
140
|
'burglar-alarm',
|
|
148
141
|
'entry-delay',
|
|
149
142
|
'fire-alarm',
|
|
@@ -154,54 +147,45 @@ exports.allAlarmStates = [
|
|
|
154
147
|
'burglar-accelerated-alarm',
|
|
155
148
|
'fire-accelerated-alarm',
|
|
156
149
|
];
|
|
157
|
-
|
|
150
|
+
export const deviceTypesWithVolume = [
|
|
158
151
|
RingDeviceType.BaseStation,
|
|
159
152
|
RingDeviceType.Keypad,
|
|
160
153
|
];
|
|
161
|
-
|
|
162
|
-
exports.ChimeModel = {
|
|
154
|
+
export const ChimeModel = {
|
|
163
155
|
chime: 'Chime',
|
|
164
156
|
chime_pro: 'Chime Pro',
|
|
165
157
|
chime_v2: 'Chime v2',
|
|
166
158
|
chime_pro_v2: 'Chime Pro v2',
|
|
167
159
|
};
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
})(DoorbellType || (exports.DoorbellType = DoorbellType = {}));
|
|
175
|
-
// eslint-disable-next-line no-shadow
|
|
176
|
-
var NotificationDetectionType;
|
|
177
|
-
(function (NotificationDetectionType) {
|
|
160
|
+
export const DoorbellType = {
|
|
161
|
+
Mechanical: 0,
|
|
162
|
+
Digital: 1,
|
|
163
|
+
None: 2,
|
|
164
|
+
};
|
|
165
|
+
export const NotificationDetectionType = {
|
|
178
166
|
// Note, this list may not be complete
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
DispatchSignalType["Fire"] = "user-verified-fire-xa";
|
|
203
|
-
})(DispatchSignalType || (exports.DispatchSignalType = DispatchSignalType = {}));
|
|
204
|
-
exports.disabledLocationModes = ['disabled', 'unset'];
|
|
205
|
-
function isWebSocketSupportedAsset({ kind }) {
|
|
167
|
+
Human: 'human',
|
|
168
|
+
Loitering: 'loitering',
|
|
169
|
+
Motion: 'motion',
|
|
170
|
+
OtherMotion: 'other_motion',
|
|
171
|
+
NotAvailable: 'null',
|
|
172
|
+
StreamBroken: 'stream_broken',
|
|
173
|
+
};
|
|
174
|
+
export const PushNotificationAction = {
|
|
175
|
+
Ding: 'com.ring.pn.live-event.ding',
|
|
176
|
+
Motion: 'com.ring.pn.live-event.motion',
|
|
177
|
+
IntercomDing: 'com.ring.pn.live-event.intercom',
|
|
178
|
+
IntercomUnlock: 'com.ring.push.INTERCOM_UNLOCK_FROM_APP',
|
|
179
|
+
AlarmModeNone: 'com.ring.push.HANDLE_NEW_SECURITY_PANEL_MODE_NONE_NOTICE',
|
|
180
|
+
AlarmModeSome: 'com.ring.push.HANDLE_NEW_SECURITY_PANEL_MODE_SOME_NOTICE',
|
|
181
|
+
AlarmSoundSiren: 'com.ring.push.HANDLE_NEW_USER_SOUND_SIREN',
|
|
182
|
+
AlarmSilenceSiren: 'com.ring.push.HANDLE_NEW_NON_ALARM_SIREN_SILENCED',
|
|
183
|
+
};
|
|
184
|
+
export const DispatchSignalType = {
|
|
185
|
+
Burglar: 'user-verified-burglar-xa',
|
|
186
|
+
Fire: 'user-verified-fire-xa',
|
|
187
|
+
};
|
|
188
|
+
export const disabledLocationModes = ['disabled', 'unset'];
|
|
189
|
+
export function isWebSocketSupportedAsset({ kind }) {
|
|
206
190
|
return kind.startsWith('base_station') || kind.startsWith('beams_bridge');
|
|
207
191
|
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import type { RTCIceCandidate, RtpPacket } from 'werift';
|
|
2
|
+
import { type ConnectionState, MediaStreamTrack, type RtcpPacket } from 'werift';
|
|
3
|
+
import type { Observable } from 'rxjs';
|
|
4
|
+
import { ReplaySubject, Subject } from 'rxjs';
|
|
5
|
+
import { Subscribed } from '../subscribed.ts';
|
|
4
6
|
export interface BasicPeerConnection {
|
|
5
7
|
createOffer(): Promise<{
|
|
6
8
|
sdp: string;
|
|
@@ -1,11 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const werift_1 = require("werift");
|
|
6
|
-
const rxjs_1 = require("rxjs");
|
|
7
|
-
const util_1 = require("../util");
|
|
8
|
-
const subscribed_1 = require("../subscribed");
|
|
1
|
+
import { MediaStreamTrack, RTCPeerConnection, RTCRtpCodecParameters, } from 'werift';
|
|
2
|
+
import { interval, merge, ReplaySubject, Subject } from 'rxjs';
|
|
3
|
+
import { logDebug, logError, logInfo } from "../util.js";
|
|
4
|
+
import { Subscribed } from "../subscribed.js";
|
|
9
5
|
const ringIceServers = [
|
|
10
6
|
'stun:stun.kinesisvideo.us-east-1.amazonaws.com:443',
|
|
11
7
|
'stun:stun.kinesisvideo.us-east-2.amazonaws.com:443',
|
|
@@ -16,27 +12,27 @@ const ringIceServers = [
|
|
|
16
12
|
'stun:stun3.l.google.com:19302',
|
|
17
13
|
'stun:stun4.l.google.com:19302',
|
|
18
14
|
];
|
|
19
|
-
class WeriftPeerConnection extends
|
|
15
|
+
export class WeriftPeerConnection extends Subscribed {
|
|
20
16
|
pc;
|
|
21
|
-
onAudioRtp = new
|
|
22
|
-
onAudioRtcp = new
|
|
23
|
-
onVideoRtp = new
|
|
24
|
-
onVideoRtcp = new
|
|
25
|
-
onIceCandidate = new
|
|
26
|
-
onConnectionState = new
|
|
27
|
-
returnAudioTrack = new
|
|
28
|
-
onRequestKeyFrame = new
|
|
17
|
+
onAudioRtp = new Subject();
|
|
18
|
+
onAudioRtcp = new Subject();
|
|
19
|
+
onVideoRtp = new Subject();
|
|
20
|
+
onVideoRtcp = new Subject();
|
|
21
|
+
onIceCandidate = new Subject();
|
|
22
|
+
onConnectionState = new ReplaySubject(1);
|
|
23
|
+
returnAudioTrack = new MediaStreamTrack({ kind: 'audio' });
|
|
24
|
+
onRequestKeyFrame = new Subject();
|
|
29
25
|
constructor() {
|
|
30
26
|
super();
|
|
31
|
-
const pc = (this.pc = new
|
|
27
|
+
const pc = (this.pc = new RTCPeerConnection({
|
|
32
28
|
codecs: {
|
|
33
29
|
audio: [
|
|
34
|
-
new
|
|
30
|
+
new RTCRtpCodecParameters({
|
|
35
31
|
mimeType: 'audio/opus',
|
|
36
32
|
clockRate: 48000,
|
|
37
33
|
channels: 2,
|
|
38
34
|
}),
|
|
39
|
-
new
|
|
35
|
+
new RTCRtpCodecParameters({
|
|
40
36
|
mimeType: 'audio/PCMU',
|
|
41
37
|
clockRate: 8000,
|
|
42
38
|
channels: 1,
|
|
@@ -44,7 +40,7 @@ class WeriftPeerConnection extends subscribed_1.Subscribed {
|
|
|
44
40
|
}),
|
|
45
41
|
],
|
|
46
42
|
video: [
|
|
47
|
-
new
|
|
43
|
+
new RTCRtpCodecParameters({
|
|
48
44
|
mimeType: 'video/H264',
|
|
49
45
|
clockRate: 90000,
|
|
50
46
|
rtcpFeedback: [
|
|
@@ -56,7 +52,7 @@ class WeriftPeerConnection extends subscribed_1.Subscribed {
|
|
|
56
52
|
],
|
|
57
53
|
parameters: 'packetization-mode=1;profile-level-id=640029;level-asymmetry-allowed=1',
|
|
58
54
|
}),
|
|
59
|
-
new
|
|
55
|
+
new RTCRtpCodecParameters({
|
|
60
56
|
mimeType: 'video/rtx',
|
|
61
57
|
clockRate: 90000,
|
|
62
58
|
}),
|
|
@@ -78,7 +74,7 @@ class WeriftPeerConnection extends subscribed_1.Subscribed {
|
|
|
78
74
|
this.onAudioRtcp.next(rtcp);
|
|
79
75
|
});
|
|
80
76
|
track.onReceiveRtp.once(() => {
|
|
81
|
-
|
|
77
|
+
logDebug('received first audio packet');
|
|
82
78
|
});
|
|
83
79
|
});
|
|
84
80
|
videoTransceiver.onTrack.subscribe((track) => {
|
|
@@ -89,11 +85,11 @@ class WeriftPeerConnection extends subscribed_1.Subscribed {
|
|
|
89
85
|
this.onVideoRtcp.next(rtcp);
|
|
90
86
|
});
|
|
91
87
|
track.onReceiveRtp.once(() => {
|
|
92
|
-
|
|
93
|
-
this.addSubscriptions(
|
|
88
|
+
logDebug('received first video packet');
|
|
89
|
+
this.addSubscriptions(merge(this.onRequestKeyFrame, interval(4000)).subscribe(() => {
|
|
94
90
|
videoTransceiver.receiver
|
|
95
91
|
.sendRtcpPLI(track.ssrc)
|
|
96
|
-
.catch((e) =>
|
|
92
|
+
.catch((e) => logError(e));
|
|
97
93
|
}));
|
|
98
94
|
this.requestKeyFrame();
|
|
99
95
|
});
|
|
@@ -104,13 +100,13 @@ class WeriftPeerConnection extends subscribed_1.Subscribed {
|
|
|
104
100
|
}
|
|
105
101
|
});
|
|
106
102
|
pc.iceConnectionStateChange.subscribe(() => {
|
|
107
|
-
|
|
103
|
+
logInfo(`iceConnectionStateChange: ${pc.iceConnectionState}`);
|
|
108
104
|
if (pc.iceConnectionState === 'closed') {
|
|
109
105
|
this.onConnectionState.next('closed');
|
|
110
106
|
}
|
|
111
107
|
});
|
|
112
108
|
pc.connectionStateChange.subscribe(() => {
|
|
113
|
-
|
|
109
|
+
logInfo(`connectionStateChange: ${pc.connectionState}`);
|
|
114
110
|
this.onConnectionState.next(pc.connectionState);
|
|
115
111
|
});
|
|
116
112
|
}
|
|
@@ -129,8 +125,7 @@ class WeriftPeerConnection extends subscribed_1.Subscribed {
|
|
|
129
125
|
this.onRequestKeyFrame.next();
|
|
130
126
|
}
|
|
131
127
|
close() {
|
|
132
|
-
this.pc.close().catch(
|
|
128
|
+
this.pc.close().catch(logError);
|
|
133
129
|
this.unsubscribe();
|
|
134
130
|
}
|
|
135
131
|
}
|
|
136
|
-
exports.WeriftPeerConnection = WeriftPeerConnection;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { RingCamera } from '../ring-camera';
|
|
2
|
-
import { RingRestClient } from '../rest-client';
|
|
1
|
+
import type { RingCamera } from '../ring-camera.ts';
|
|
2
|
+
import type { RingRestClient } from '../rest-client.ts';
|
|
3
3
|
export declare class SimpleWebRtcSession {
|
|
4
|
+
readonly sessionId: string;
|
|
4
5
|
private readonly camera;
|
|
5
6
|
private restClient;
|
|
6
|
-
readonly sessionId: string;
|
|
7
7
|
constructor(camera: RingCamera, restClient: RingRestClient);
|
|
8
8
|
start(sdp: string): Promise<string>;
|
|
9
9
|
end(): Promise<any>;
|
|
@@ -1,14 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SimpleWebRtcSession = void 0;
|
|
4
|
-
const util_1 = require("../util");
|
|
1
|
+
import { generateUuid } from "../util.js";
|
|
5
2
|
function liveViewUrl(path) {
|
|
6
3
|
return `https://api.ring.com/integrations/v1/liveview/${path}`;
|
|
7
4
|
}
|
|
8
|
-
class SimpleWebRtcSession {
|
|
5
|
+
export class SimpleWebRtcSession {
|
|
6
|
+
sessionId = generateUuid();
|
|
9
7
|
camera;
|
|
10
8
|
restClient;
|
|
11
|
-
sessionId = (0, util_1.generateUuid)();
|
|
12
9
|
constructor(camera, restClient) {
|
|
13
10
|
this.camera = camera;
|
|
14
11
|
this.restClient = restClient;
|
|
@@ -47,4 +44,3 @@ class SimpleWebRtcSession {
|
|
|
47
44
|
});
|
|
48
45
|
}
|
|
49
46
|
}
|
|
50
|
-
exports.SimpleWebRtcSession = SimpleWebRtcSession;
|
|
@@ -46,11 +46,12 @@ interface StreamInfoMessage {
|
|
|
46
46
|
transcoding_reason: 'codec_mismatch' | string;
|
|
47
47
|
};
|
|
48
48
|
}
|
|
49
|
-
declare
|
|
50
|
-
NormalClose
|
|
51
|
-
AuthenticationFailed
|
|
52
|
-
Timeout
|
|
53
|
-
}
|
|
49
|
+
declare const CloseReasonCode: {
|
|
50
|
+
readonly NormalClose: 0;
|
|
51
|
+
readonly AuthenticationFailed: 5;
|
|
52
|
+
readonly Timeout: 6;
|
|
53
|
+
};
|
|
54
|
+
type CloseReasonCode = (typeof CloseReasonCode)[keyof typeof CloseReasonCode];
|
|
54
55
|
interface CloseMessage {
|
|
55
56
|
method: 'close';
|
|
56
57
|
body: {
|
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
// eslint-disable-next-line no-shadow
|
|
4
|
-
var CloseReasonCode;
|
|
5
|
-
(function (CloseReasonCode) {
|
|
6
|
-
CloseReasonCode[CloseReasonCode["NormalClose"] = 0] = "NormalClose";
|
|
1
|
+
const CloseReasonCode = {
|
|
2
|
+
NormalClose: 0,
|
|
7
3
|
// reason: { code: 5, text: '[rsl-apps/webrtc-liveview-server/Session.cpp:429] [Auth] [0xd540]: [rsl-apps/session-manager/Manager.cpp:227] [AppAuth] Unauthorized: invalid or expired token' }
|
|
8
4
|
// reason: { code: 5, text: 'Authentication failed: -1' }
|
|
9
5
|
// reason: { code: 5, text: 'Sessions with the provided ID not found' }
|
|
10
|
-
|
|
6
|
+
AuthenticationFailed: 5,
|
|
11
7
|
// reason: { code: 6, text: 'Timeout waiting for ping' }
|
|
12
|
-
|
|
13
|
-
}
|
|
8
|
+
Timeout: 6,
|
|
9
|
+
};
|
|
10
|
+
export {};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { RtpPacket } from 'werift';
|
|
2
2
|
import { ReplaySubject, Subject } from 'rxjs';
|
|
3
|
-
import { WebrtcConnection } from './webrtc-connection';
|
|
4
|
-
import { RingCamera } from '../ring-camera';
|
|
5
|
-
import { Subscribed } from '../subscribed';
|
|
3
|
+
import type { WebrtcConnection } from './webrtc-connection.ts';
|
|
4
|
+
import type { RingCamera } from '../ring-camera.ts';
|
|
5
|
+
import { Subscribed } from '../subscribed.ts';
|
|
6
6
|
type SpawnInput = string | number;
|
|
7
7
|
export interface FfmpegOptions {
|
|
8
8
|
input?: SpawnInput[];
|
|
@@ -12,8 +12,6 @@ export interface FfmpegOptions {
|
|
|
12
12
|
output: SpawnInput[];
|
|
13
13
|
}
|
|
14
14
|
export declare class StreamingSession extends Subscribed {
|
|
15
|
-
private readonly camera;
|
|
16
|
-
private connection;
|
|
17
15
|
readonly onCallEnded: ReplaySubject<void>;
|
|
18
16
|
private readonly onUsingOpus;
|
|
19
17
|
readonly onVideoRtp: Subject<RtpPacket>;
|
|
@@ -21,6 +19,8 @@ export declare class StreamingSession extends Subscribed {
|
|
|
21
19
|
private readonly audioSplitter;
|
|
22
20
|
private readonly videoSplitter;
|
|
23
21
|
private readonly returnAudioSplitter;
|
|
22
|
+
private readonly camera;
|
|
23
|
+
private connection;
|
|
24
24
|
constructor(camera: RingCamera, connection: WebrtcConnection);
|
|
25
25
|
private bindToConnection;
|
|
26
26
|
/**
|