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.
Files changed (39) hide show
  1. package/lib/api.d.ts +10 -8
  2. package/lib/api.js +57 -64
  3. package/lib/device-data.js +6 -9
  4. package/lib/ffmpeg.js +2 -6
  5. package/lib/index.d.ts +7 -7
  6. package/lib/index.js +7 -23
  7. package/lib/location.d.ts +32 -31
  8. package/lib/location.js +67 -72
  9. package/lib/refresh-token.js +6 -11
  10. package/lib/rest-client.d.ts +4 -4
  11. package/lib/rest-client.js +40 -51
  12. package/lib/ring-auth-cli.js +2 -4
  13. package/lib/ring-camera.d.ts +26 -23
  14. package/lib/ring-camera.js +64 -61
  15. package/lib/ring-chime.d.ts +7 -7
  16. package/lib/ring-chime.js +14 -18
  17. package/lib/ring-device-data-cli.js +2 -4
  18. package/lib/ring-device.d.ts +7 -7
  19. package/lib/ring-device.js +16 -20
  20. package/lib/ring-intercom.d.ts +8 -8
  21. package/lib/ring-intercom.js +23 -27
  22. package/lib/ring-types.d.ts +142 -133
  23. package/lib/ring-types.js +137 -153
  24. package/lib/streaming/peer-connection.d.ts +5 -3
  25. package/lib/streaming/peer-connection.js +25 -30
  26. package/lib/streaming/simple-webrtc-session.d.ts +3 -3
  27. package/lib/streaming/simple-webrtc-session.js +3 -7
  28. package/lib/streaming/streaming-messages.d.ts +6 -5
  29. package/lib/streaming/streaming-messages.js +6 -9
  30. package/lib/streaming/streaming-session.d.ts +5 -5
  31. package/lib/streaming/streaming-session.js +34 -38
  32. package/lib/streaming/webrtc-connection.d.ts +5 -5
  33. package/lib/streaming/webrtc-connection.js +39 -43
  34. package/lib/subscribed.d.ts +1 -1
  35. package/lib/subscribed.js +1 -5
  36. package/lib/test/rest-client.spec.js +44 -45
  37. package/lib/test/ring-camera.spec.js +12 -13
  38. package/lib/util.js +33 -54
  39. package/package.json +17 -19
package/lib/ring-types.js CHANGED
@@ -1,115 +1,106 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.disabledLocationModes = exports.DispatchSignalType = exports.PushNotificationAction = exports.NotificationDetectionType = exports.DoorbellType = exports.ChimeModel = exports.deviceTypesWithVolume = exports.allAlarmStates = exports.RingCameraModel = exports.RingCameraKind = exports.RingDeviceCategory = exports.RingDeviceType = void 0;
4
- exports.isWebSocketSupportedAsset = isWebSocketSupportedAsset;
5
- // eslint-disable-next-line no-shadow
6
- var RingDeviceType;
7
- (function (RingDeviceType) {
8
- RingDeviceType["BaseStation"] = "hub.redsky";
9
- RingDeviceType["BaseStationPro"] = "hub.kili";
10
- RingDeviceType["Keypad"] = "security-keypad";
11
- RingDeviceType["SecurityPanel"] = "security-panel";
12
- RingDeviceType["ContactSensor"] = "sensor.contact";
13
- RingDeviceType["MotionSensor"] = "sensor.motion";
14
- RingDeviceType["FloodFreezeSensor"] = "sensor.flood-freeze";
15
- RingDeviceType["FreezeSensor"] = "sensor.freeze";
16
- RingDeviceType["TemperatureSensor"] = "sensor.temperature";
17
- RingDeviceType["WaterSensor"] = "sensor.water";
18
- RingDeviceType["TiltSensor"] = "sensor.tilt";
19
- RingDeviceType["GlassbreakSensor"] = "sensor.glassbreak";
20
- RingDeviceType["RangeExtender"] = "range-extender.zwave";
21
- RingDeviceType["ZigbeeAdapter"] = "adapter.zigbee";
22
- RingDeviceType["AccessCodeVault"] = "access-code.vault";
23
- RingDeviceType["AccessCode"] = "access-code";
24
- RingDeviceType["SmokeAlarm"] = "alarm.smoke";
25
- RingDeviceType["CoAlarm"] = "alarm.co";
26
- RingDeviceType["SmokeCoListener"] = "listener.smoke-co";
27
- RingDeviceType["MultiLevelSwitch"] = "switch.multilevel";
28
- RingDeviceType["Fan"] = "switch.multilevel";
29
- RingDeviceType["MultiLevelBulb"] = "switch.multilevel.bulb";
30
- RingDeviceType["Switch"] = "switch";
31
- RingDeviceType["BeamsMotionSensor"] = "motion-sensor.beams";
32
- RingDeviceType["BeamsSwitch"] = "switch.beams";
33
- RingDeviceType["BeamsMultiLevelSwitch"] = "switch.multilevel.beams";
34
- RingDeviceType["BeamsLightGroupSwitch"] = "group.light-group.beams";
35
- RingDeviceType["BeamsTransformerSwitch"] = "switch.transformer.beams";
36
- RingDeviceType["BeamsDevice"] = "device.beams";
37
- RingDeviceType["RetrofitBridge"] = "bridge.flatline";
38
- RingDeviceType["RetrofitZone"] = "sensor.zone";
39
- RingDeviceType["Thermostat"] = "temperature-control.thermostat";
40
- RingDeviceType["Sensor"] = "sensor";
41
- RingDeviceType["RingNetAdapter"] = "adapter.ringnet";
42
- RingDeviceType["CodeVault"] = "access-code.vault";
43
- RingDeviceType["SecurityAccessCode"] = "access-code";
44
- RingDeviceType["ZWaveAdapter"] = "adapter.zwave";
45
- RingDeviceType["ZWaveExtender"] = "range-extender.zwave";
46
- RingDeviceType["PanicButton"] = "security-panic";
47
- RingDeviceType["UnknownZWave"] = "unknown.zwave";
48
- RingDeviceType["OnvifCamera"] = "onvif_camera";
49
- RingDeviceType["ThirdPartyGarageDoorOpener"] = "third_party_gdo";
50
- RingDeviceType["IntercomHandsetAudio"] = "intercom_handset_audio";
51
- RingDeviceType["WaterValve"] = "valve.water";
52
- })(RingDeviceType || (exports.RingDeviceType = RingDeviceType = {}));
53
- // eslint-disable-next-line no-shadow
54
- var RingDeviceCategory;
55
- (function (RingDeviceCategory) {
56
- RingDeviceCategory[RingDeviceCategory["Outlets"] = 1] = "Outlets";
57
- RingDeviceCategory[RingDeviceCategory["Lights"] = 2] = "Lights";
58
- RingDeviceCategory[RingDeviceCategory["Sensors"] = 5] = "Sensors";
59
- RingDeviceCategory[RingDeviceCategory["Appliances"] = 7] = "Appliances";
60
- RingDeviceCategory[RingDeviceCategory["Locks"] = 10] = "Locks";
61
- RingDeviceCategory[RingDeviceCategory["Thermostats"] = 11] = "Thermostats";
62
- RingDeviceCategory[RingDeviceCategory["Cameras"] = 12] = "Cameras";
63
- RingDeviceCategory[RingDeviceCategory["Alarms"] = 15] = "Alarms";
64
- RingDeviceCategory[RingDeviceCategory["Fans"] = 17] = "Fans";
65
- RingDeviceCategory[RingDeviceCategory["Security"] = 22] = "Security";
66
- RingDeviceCategory[RingDeviceCategory["Unknown"] = 29] = "Unknown";
67
- RingDeviceCategory[RingDeviceCategory["SensorsMotion"] = 30] = "SensorsMotion";
68
- RingDeviceCategory[RingDeviceCategory["Controller"] = 31] = "Controller";
69
- RingDeviceCategory[RingDeviceCategory["RangeExtenders"] = 32] = "RangeExtenders";
70
- RingDeviceCategory[RingDeviceCategory["Keypads"] = 33] = "Keypads";
71
- RingDeviceCategory[RingDeviceCategory["Sirens"] = 34] = "Sirens";
72
- RingDeviceCategory[RingDeviceCategory["PanicButtons"] = 35] = "PanicButtons";
73
- RingDeviceCategory[RingDeviceCategory["WaterValves"] = 37] = "WaterValves";
74
- })(RingDeviceCategory || (exports.RingDeviceCategory = RingDeviceCategory = {}));
75
- // eslint-disable-next-line no-shadow
76
- var RingCameraKind;
77
- (function (RingCameraKind) {
78
- RingCameraKind["doorbot"] = "doorbot";
79
- RingCameraKind["doorbell"] = "doorbell";
80
- RingCameraKind["doorbell_v3"] = "doorbell_v3";
81
- RingCameraKind["doorbell_v4"] = "doorbell_v4";
82
- RingCameraKind["doorbell_v5"] = "doorbell_v5";
83
- RingCameraKind["doorbell_oyster"] = "doorbell_oyster";
84
- RingCameraKind["doorbell_portal"] = "doorbell_portal";
85
- RingCameraKind["doorbell_scallop"] = "doorbell_scallop";
86
- RingCameraKind["doorbell_scallop_lite"] = "doorbell_scallop_lite";
87
- RingCameraKind["doorbell_graham_cracker"] = "doorbell_graham_cracker";
88
- RingCameraKind["lpd_v1"] = "lpd_v1";
89
- RingCameraKind["lpd_v2"] = "lpd_v2";
90
- RingCameraKind["lpd_v4"] = "lpd_v4";
91
- RingCameraKind["jbox_v1"] = "jbox_v1";
92
- RingCameraKind["stickup_cam"] = "stickup_cam";
93
- RingCameraKind["stickup_cam_v3"] = "stickup_cam_v3";
94
- RingCameraKind["stickup_cam_elite"] = "stickup_cam_elite";
95
- RingCameraKind["stickup_cam_longfin"] = "stickup_cam_longfin";
96
- RingCameraKind["stickup_cam_lunar"] = "stickup_cam_lunar";
97
- RingCameraKind["spotlightw_v2"] = "spotlightw_v2";
98
- RingCameraKind["hp_cam_v1"] = "hp_cam_v1";
99
- RingCameraKind["hp_cam_v2"] = "hp_cam_v2";
100
- RingCameraKind["stickup_cam_v4"] = "stickup_cam_v4";
101
- RingCameraKind["floodlight_v1"] = "floodlight_v1";
102
- RingCameraKind["floodlight_v2"] = "floodlight_v2";
103
- RingCameraKind["floodlight_pro"] = "floodlight_pro";
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
- exports.allAlarmStates = [
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
- exports.deviceTypesWithVolume = [
150
+ export const deviceTypesWithVolume = [
158
151
  RingDeviceType.BaseStation,
159
152
  RingDeviceType.Keypad,
160
153
  ];
161
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
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
- // eslint-disable-next-line no-shadow
169
- var DoorbellType;
170
- (function (DoorbellType) {
171
- DoorbellType[DoorbellType["Mechanical"] = 0] = "Mechanical";
172
- DoorbellType[DoorbellType["Digital"] = 1] = "Digital";
173
- DoorbellType[DoorbellType["None"] = 2] = "None";
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
- NotificationDetectionType["Human"] = "human";
180
- NotificationDetectionType["Loitering"] = "loitering";
181
- NotificationDetectionType["Motion"] = "motion";
182
- NotificationDetectionType["OtherMotion"] = "other_motion";
183
- NotificationDetectionType["NotAvailable"] = "null";
184
- NotificationDetectionType["StreamBroken"] = "stream_broken";
185
- })(NotificationDetectionType || (exports.NotificationDetectionType = NotificationDetectionType = {}));
186
- // eslint-disable-next-line no-shadow
187
- var PushNotificationAction;
188
- (function (PushNotificationAction) {
189
- PushNotificationAction["Ding"] = "com.ring.pn.live-event.ding";
190
- PushNotificationAction["Motion"] = "com.ring.pn.live-event.motion";
191
- PushNotificationAction["IntercomDing"] = "com.ring.pn.live-event.intercom";
192
- PushNotificationAction["IntercomUnlock"] = "com.ring.push.INTERCOM_UNLOCK_FROM_APP";
193
- PushNotificationAction["AlarmModeNone"] = "com.ring.push.HANDLE_NEW_SECURITY_PANEL_MODE_NONE_NOTICE";
194
- PushNotificationAction["AlarmModeSome"] = "com.ring.push.HANDLE_NEW_SECURITY_PANEL_MODE_SOME_NOTICE";
195
- PushNotificationAction["AlarmSoundSiren"] = "com.ring.push.HANDLE_NEW_USER_SOUND_SIREN";
196
- PushNotificationAction["AlarmSilenceSiren"] = "com.ring.push.HANDLE_NEW_NON_ALARM_SIREN_SILENCED";
197
- })(PushNotificationAction || (exports.PushNotificationAction = PushNotificationAction = {}));
198
- // eslint-disable-next-line no-shadow
199
- var DispatchSignalType;
200
- (function (DispatchSignalType) {
201
- DispatchSignalType["Burglar"] = "user-verified-burglar-xa";
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 { ConnectionState, MediaStreamTrack, RTCIceCandidate, RtcpPacket, RtpPacket } from 'werift';
2
- import { Observable, ReplaySubject, Subject } from 'rxjs';
3
- import { Subscribed } from '../subscribed';
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
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.WeriftPeerConnection = void 0;
4
- /* eslint-disable brace-style */
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 subscribed_1.Subscribed {
15
+ export class WeriftPeerConnection extends Subscribed {
20
16
  pc;
21
- onAudioRtp = new rxjs_1.Subject();
22
- onAudioRtcp = new rxjs_1.Subject();
23
- onVideoRtp = new rxjs_1.Subject();
24
- onVideoRtcp = new rxjs_1.Subject();
25
- onIceCandidate = new rxjs_1.Subject();
26
- onConnectionState = new rxjs_1.ReplaySubject(1);
27
- returnAudioTrack = new werift_1.MediaStreamTrack({ kind: 'audio' });
28
- onRequestKeyFrame = new rxjs_1.Subject();
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 werift_1.RTCPeerConnection({
27
+ const pc = (this.pc = new RTCPeerConnection({
32
28
  codecs: {
33
29
  audio: [
34
- new werift_1.RTCRtpCodecParameters({
30
+ new RTCRtpCodecParameters({
35
31
  mimeType: 'audio/opus',
36
32
  clockRate: 48000,
37
33
  channels: 2,
38
34
  }),
39
- new werift_1.RTCRtpCodecParameters({
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 werift_1.RTCRtpCodecParameters({
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 werift_1.RTCRtpCodecParameters({
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
- (0, util_1.logDebug)('received first audio packet');
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
- (0, util_1.logDebug)('received first video packet');
93
- this.addSubscriptions((0, rxjs_1.merge)(this.onRequestKeyFrame, (0, rxjs_1.interval)(4000)).subscribe(() => {
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) => (0, util_1.logError)(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
- (0, util_1.logInfo)(`iceConnectionStateChange: ${pc.iceConnectionState}`);
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
- (0, util_1.logInfo)(`connectionStateChange: ${pc.connectionState}`);
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(util_1.logError);
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
- "use strict";
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 enum CloseReasonCode {
50
- NormalClose = 0,
51
- AuthenticationFailed = 5,
52
- Timeout = 6
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
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
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
- CloseReasonCode[CloseReasonCode["AuthenticationFailed"] = 5] = "AuthenticationFailed";
6
+ AuthenticationFailed: 5,
11
7
  // reason: { code: 6, text: 'Timeout waiting for ping' }
12
- CloseReasonCode[CloseReasonCode["Timeout"] = 6] = "Timeout";
13
- })(CloseReasonCode || (CloseReasonCode = {}));
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
  /**