ring-client-api 10.0.0-beta.8 → 11.0.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.
@@ -1,13 +1,4 @@
1
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
2
  Object.defineProperty(exports, "__esModule", { value: true });
12
3
  exports.RingCamera = exports.getSearchQueryString = exports.getBatteryLevel = void 0;
13
4
  const ring_types_1 = require("./ring-types");
@@ -92,7 +83,7 @@ class RingCamera extends subscribed_1.Subscribed {
92
83
  this.hasSiren = this.initialData.siren_status !== undefined;
93
84
  this.onBatteryLevel = this.onData.pipe((0, operators_1.map)(getBatteryLevel), (0, operators_1.distinctUntilChanged)());
94
85
  this.onInHomeDoorbellStatus = this.onData.pipe((0, operators_1.map)(({ settings: { chime_settings } }) => {
95
- return Boolean(chime_settings === null || chime_settings === void 0 ? void 0 : chime_settings.enable);
86
+ return Boolean(chime_settings?.enable);
96
87
  }), (0, operators_1.distinctUntilChanged)());
97
88
  if (!initialData.subscribed) {
98
89
  this.subscribeToDingEvents().catch((e) => {
@@ -159,53 +150,45 @@ class RingCamera extends subscribed_1.Subscribed {
159
150
  deviceUrl(path = '') {
160
151
  return (0, rest_client_1.deviceApi)(`devices/${this.id}/${path}`);
161
152
  }
162
- setLight(on) {
163
- return __awaiter(this, void 0, void 0, function* () {
164
- if (!this.hasLight) {
165
- return false;
166
- }
167
- const state = on ? 'on' : 'off';
168
- yield this.restClient.request({
169
- method: 'PUT',
170
- url: this.doorbotUrl('floodlight_light_' + state),
171
- });
172
- this.updateData(Object.assign(Object.assign({}, this.data), { led_status: state }));
173
- return true;
153
+ async setLight(on) {
154
+ if (!this.hasLight) {
155
+ return false;
156
+ }
157
+ const state = on ? 'on' : 'off';
158
+ await this.restClient.request({
159
+ method: 'PUT',
160
+ url: this.doorbotUrl('floodlight_light_' + state),
174
161
  });
162
+ this.updateData({ ...this.data, led_status: state });
163
+ return true;
175
164
  }
176
- setSiren(on) {
177
- return __awaiter(this, void 0, void 0, function* () {
178
- if (!this.hasSiren) {
179
- return false;
180
- }
181
- yield this.restClient.request({
182
- method: 'PUT',
183
- url: this.doorbotUrl('siren_' + (on ? 'on' : 'off')),
184
- });
185
- this.updateData(Object.assign(Object.assign({}, this.data), { siren_status: { seconds_remaining: 1 } }));
186
- return true;
165
+ async setSiren(on) {
166
+ if (!this.hasSiren) {
167
+ return false;
168
+ }
169
+ await this.restClient.request({
170
+ method: 'PUT',
171
+ url: this.doorbotUrl('siren_' + (on ? 'on' : 'off')),
187
172
  });
188
- }
189
- setSettings(settings) {
190
- return __awaiter(this, void 0, void 0, function* () {
191
- yield this.restClient.request({
192
- method: 'PUT',
193
- url: this.doorbotUrl(),
194
- json: { doorbot: { settings } },
195
- });
196
- this.requestUpdate();
173
+ this.updateData({ ...this.data, siren_status: { seconds_remaining: 1 } });
174
+ return true;
175
+ }
176
+ async setSettings(settings) {
177
+ await this.restClient.request({
178
+ method: 'PUT',
179
+ url: this.doorbotUrl(),
180
+ json: { doorbot: { settings } },
197
181
  });
182
+ this.requestUpdate();
198
183
  }
199
- setDeviceSettings(settings) {
200
- return __awaiter(this, void 0, void 0, function* () {
201
- const response = yield this.restClient.request({
202
- method: 'PATCH',
203
- url: this.deviceUrl('settings'),
204
- json: settings,
205
- });
206
- this.requestUpdate();
207
- return response;
184
+ async setDeviceSettings(settings) {
185
+ const response = await this.restClient.request({
186
+ method: 'PATCH',
187
+ url: this.deviceUrl('settings'),
188
+ json: settings,
208
189
  });
190
+ this.requestUpdate();
191
+ return response;
209
192
  }
210
193
  getDeviceSettings() {
211
194
  return this.restClient.request({
@@ -214,51 +197,42 @@ class RingCamera extends subscribed_1.Subscribed {
214
197
  });
215
198
  }
216
199
  // Enable or disable the in-home doorbell (if digital or mechanical)
217
- setInHomeDoorbell(enable) {
218
- return __awaiter(this, void 0, void 0, function* () {
219
- if (!this.hasInHomeDoorbell) {
220
- return false;
221
- }
222
- yield this.setSettings({ chime_settings: { enable } });
223
- return true;
224
- });
200
+ async setInHomeDoorbell(enable) {
201
+ if (!this.hasInHomeDoorbell) {
202
+ return false;
203
+ }
204
+ await this.setSettings({ chime_settings: { enable } });
205
+ return true;
225
206
  }
226
- getHealth() {
227
- return __awaiter(this, void 0, void 0, function* () {
228
- const response = yield this.restClient.request({
229
- url: this.doorbotUrl('health'),
230
- });
231
- return response.device_health;
207
+ async getHealth() {
208
+ const response = await this.restClient.request({
209
+ url: this.doorbotUrl('health'),
232
210
  });
211
+ return response.device_health;
233
212
  }
234
- createStreamingConnection(options) {
235
- return __awaiter(this, void 0, void 0, function* () {
236
- if (this.isRingEdgeEnabled) {
237
- const auth = yield this.restClient.getCurrentAuth();
238
- return new ring_edge_connection_1.RingEdgeConnection(auth.access_token, this, options);
213
+ async createStreamingConnection(options) {
214
+ if (this.isRingEdgeEnabled) {
215
+ const auth = await this.restClient.getCurrentAuth();
216
+ return new ring_edge_connection_1.RingEdgeConnection(auth.access_token, this, options);
217
+ }
218
+ const liveCall = await this.restClient
219
+ .request({
220
+ method: 'POST',
221
+ url: this.doorbotUrl('live_call'),
222
+ })
223
+ .catch((e) => {
224
+ if (e.response?.statusCode === 403) {
225
+ const errorMessage = `Camera ${this.name} returned 403 when starting a live stream. This usually indicates that live streaming is blocked by Modes settings. Check your Ring app and verify that you are able to stream from this camera with the current Modes settings.`;
226
+ (0, util_1.logError)(errorMessage);
227
+ throw new Error(errorMessage);
239
228
  }
240
- const liveCall = yield this.restClient
241
- .request({
242
- method: 'POST',
243
- url: this.doorbotUrl('live_call'),
244
- })
245
- .catch((e) => {
246
- var _a;
247
- if (((_a = e.response) === null || _a === void 0 ? void 0 : _a.statusCode) === 403) {
248
- const errorMessage = `Camera ${this.name} returned 403 when starting a live stream. This usually indicates that live streaming is blocked by Modes settings. Check your Ring app and verify that you are able to stream from this camera with the current Modes settings.`;
249
- (0, util_1.logError)(errorMessage);
250
- throw new Error(errorMessage);
251
- }
252
- throw e;
253
- });
254
- return new webrtc_connection_1.WebrtcConnection(liveCall.data.session_id, this, options);
229
+ throw e;
255
230
  });
231
+ return new webrtc_connection_1.WebrtcConnection(liveCall.data.session_id, this, options);
256
232
  }
257
- startLiveCall(options = {}) {
258
- return __awaiter(this, void 0, void 0, function* () {
259
- const connection = yield this.createStreamingConnection(options);
260
- return new streaming_session_1.StreamingSession(this, connection);
261
- });
233
+ async startLiveCall(options = {}) {
234
+ const connection = await this.createStreamingConnection(options);
235
+ return new streaming_session_1.StreamingSession(this, connection);
262
236
  }
263
237
  removeDingById(idToRemove) {
264
238
  const allActiveDings = this.activeNotifications, otherDings = allActiveDings.filter(({ ding }) => ding.id !== idToRemove);
@@ -294,13 +268,11 @@ class RingCamera extends subscribed_1.Subscribed {
294
268
  url: `https://api.ring.com/recordings/public/footages/${this.id}?start_at_ms=${startAtMs}&end_at_ms=${endAtMs}&kinds=online_periodical&kinds=offline_periodical`,
295
269
  });
296
270
  }
297
- getRecordingUrl(dingIdStr, { transcoded = false } = {}) {
298
- return __awaiter(this, void 0, void 0, function* () {
299
- const path = transcoded ? 'recording' : 'share/play', response = yield this.restClient.request({
300
- url: (0, rest_client_1.clientApi)(`dings/${dingIdStr}/${path}?disable_redirect=true`),
301
- });
302
- return response.url;
271
+ async getRecordingUrl(dingIdStr, { transcoded = false } = {}) {
272
+ const path = transcoded ? 'recording' : 'share/play', response = await this.restClient.request({
273
+ url: (0, rest_client_1.clientApi)(`dings/${dingIdStr}/${path}?disable_redirect=true`),
303
274
  });
275
+ return response.url;
304
276
  }
305
277
  isTimestampInLifeTime(timestampAge) {
306
278
  return timestampAge < this.snapshotLifeTime;
@@ -341,57 +313,53 @@ class RingCamera extends subscribed_1.Subscribed {
341
313
  return false;
342
314
  }
343
315
  }
344
- getSnapshot({ uuid } = {}) {
345
- return __awaiter(this, void 0, void 0, function* () {
346
- if (this.lastSnapshotPromise && this.shouldUseExistingSnapshotPromise()) {
347
- return this.lastSnapshotPromise;
348
- }
349
- this.checkIfSnapshotsAreBlocked();
350
- this.lastSnapshotPromise = Promise.race([
351
- this.getNextSnapshot(uuid
352
- ? { uuid }
353
- : {
354
- afterMs: this.lastSnapshotTimestamp,
355
- force: true,
356
- }),
357
- (0, util_1.delay)(maxSnapshotRefreshSeconds * 1000).then(() => {
358
- const extraMessageForBatteryCam = this.operatingOnBattery
359
- ? '. This is normal behavior since this camera is unable to capture snapshots while streaming'
360
- : '';
361
- throw new Error(`Snapshot for ${this.name} (${this.deviceType} - ${this.model}) failed to refresh after ${maxSnapshotRefreshSeconds} seconds${extraMessageForBatteryCam}`);
362
- }),
363
- ]);
364
- try {
365
- yield this.lastSnapshotPromise;
366
- }
367
- catch (e) {
368
- // snapshot request failed, don't use it again
369
- this.lastSnapshotPromise = undefined;
370
- throw e;
371
- }
372
- this.fetchingSnapshot = false;
316
+ async getSnapshot({ uuid } = {}) {
317
+ if (this.lastSnapshotPromise && this.shouldUseExistingSnapshotPromise()) {
373
318
  return this.lastSnapshotPromise;
374
- });
319
+ }
320
+ this.checkIfSnapshotsAreBlocked();
321
+ this.lastSnapshotPromise = Promise.race([
322
+ this.getNextSnapshot(uuid
323
+ ? { uuid }
324
+ : {
325
+ afterMs: this.lastSnapshotTimestamp,
326
+ force: true,
327
+ }),
328
+ (0, util_1.delay)(maxSnapshotRefreshSeconds * 1000).then(() => {
329
+ const extraMessageForBatteryCam = this.operatingOnBattery
330
+ ? '. This is normal behavior since this camera is unable to capture snapshots while streaming'
331
+ : '';
332
+ throw new Error(`Snapshot for ${this.name} (${this.deviceType} - ${this.model}) failed to refresh after ${maxSnapshotRefreshSeconds} seconds${extraMessageForBatteryCam}`);
333
+ }),
334
+ ]);
335
+ try {
336
+ await this.lastSnapshotPromise;
337
+ }
338
+ catch (e) {
339
+ // snapshot request failed, don't use it again
340
+ this.lastSnapshotPromise = undefined;
341
+ throw e;
342
+ }
343
+ this.fetchingSnapshot = false;
344
+ return this.lastSnapshotPromise;
375
345
  }
376
- getNextSnapshot({ afterMs, maxWaitMs, force, uuid, }) {
377
- return __awaiter(this, void 0, void 0, function* () {
378
- const response = yield this.restClient.request({
379
- url: `https://app-snaps.ring.com/snapshots/next/${this.id}`,
380
- responseType: 'buffer',
381
- searchParams: {
382
- 'after-ms': afterMs,
383
- 'max-wait-ms': maxWaitMs,
384
- extras: force ? 'force' : undefined,
385
- uuid,
386
- },
387
- headers: {
388
- accept: 'image/jpeg',
389
- },
390
- }), { responseTimestamp, timeMillis } = response, timestampAge = Math.abs(responseTimestamp - timeMillis);
391
- this.lastSnapshotTimestamp = timeMillis;
392
- this.lastSnapshotTimestampLocal = Date.now() - timestampAge;
393
- return response;
394
- });
346
+ async getNextSnapshot({ afterMs, maxWaitMs, force, uuid, }) {
347
+ const response = await this.restClient.request({
348
+ url: `https://app-snaps.ring.com/snapshots/next/${this.id}`,
349
+ responseType: 'buffer',
350
+ searchParams: {
351
+ 'after-ms': afterMs,
352
+ 'max-wait-ms': maxWaitMs,
353
+ extras: force ? 'force' : undefined,
354
+ uuid,
355
+ },
356
+ headers: {
357
+ accept: 'image/jpeg',
358
+ },
359
+ }), { responseTimestamp, timeMillis } = response, timestampAge = Math.abs(responseTimestamp - timeMillis);
360
+ this.lastSnapshotTimestamp = timeMillis;
361
+ this.lastSnapshotTimestampLocal = Date.now() - timestampAge;
362
+ return response;
395
363
  }
396
364
  getSnapshotByUuid(uuid) {
397
365
  return this.restClient.request({
@@ -402,20 +370,16 @@ class RingCamera extends subscribed_1.Subscribed {
402
370
  },
403
371
  });
404
372
  }
405
- recordToFile(outputPath, duration = 30) {
406
- return __awaiter(this, void 0, void 0, function* () {
407
- const liveCall = yield this.streamVideo({
408
- output: ['-t', duration.toString(), outputPath],
409
- });
410
- yield (0, rxjs_1.firstValueFrom)(liveCall.onCallEnded);
373
+ async recordToFile(outputPath, duration = 30) {
374
+ const liveCall = await this.streamVideo({
375
+ output: ['-t', duration.toString(), outputPath],
411
376
  });
377
+ await (0, rxjs_1.firstValueFrom)(liveCall.onCallEnded);
412
378
  }
413
- streamVideo(ffmpegOptions) {
414
- return __awaiter(this, void 0, void 0, function* () {
415
- const liveCall = yield this.startLiveCall();
416
- yield liveCall.startTranscoding(ffmpegOptions);
417
- return liveCall;
418
- });
379
+ async streamVideo(ffmpegOptions) {
380
+ const liveCall = await this.startLiveCall();
381
+ await liveCall.startTranscoding(ffmpegOptions);
382
+ return liveCall;
419
383
  }
420
384
  /**
421
385
  * Returns a SimpleWebRtcSession, which can be initiated with an sdp offer.
@@ -1,13 +1,4 @@
1
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
2
  Object.defineProperty(exports, "__esModule", { value: true });
12
3
  exports.RingChime = void 0;
13
4
  const ring_types_1 = require("./ring-types");
@@ -52,16 +43,14 @@ class RingChime {
52
43
  url: (0, rest_client_1.clientApi)('ringtones'),
53
44
  });
54
45
  }
55
- getRingtoneByDescription(description, kind) {
56
- return __awaiter(this, void 0, void 0, function* () {
57
- const ringtones = yield this.getRingtones(), requestedRingtone = ringtones.audios.find((audio) => audio.available &&
58
- audio.description === description &&
59
- audio.kind === kind);
60
- if (!requestedRingtone) {
61
- throw new Error('Requested ringtone not found');
62
- }
63
- return requestedRingtone;
64
- });
46
+ async getRingtoneByDescription(description, kind) {
47
+ const ringtones = await this.getRingtones(), requestedRingtone = ringtones.audios.find((audio) => audio.available &&
48
+ audio.description === description &&
49
+ audio.kind === kind);
50
+ if (!requestedRingtone) {
51
+ throw new Error('Requested ringtone not found');
52
+ }
53
+ return requestedRingtone;
65
54
  }
66
55
  chimeUrl(path = '') {
67
56
  return (0, rest_client_1.clientApi)(`chimes/${this.id}/${path}`);
@@ -73,37 +62,31 @@ class RingChime {
73
62
  json: { kind },
74
63
  });
75
64
  }
76
- snooze(time) {
77
- return __awaiter(this, void 0, void 0, function* () {
78
- // time is in minutes, max 24 * 60 (1440)
79
- yield this.restClient.request({
80
- url: this.chimeUrl('do_not_disturb'),
81
- method: 'POST',
82
- json: { time },
83
- });
84
- this.requestUpdate();
65
+ async snooze(time) {
66
+ // time is in minutes, max 24 * 60 (1440)
67
+ await this.restClient.request({
68
+ url: this.chimeUrl('do_not_disturb'),
69
+ method: 'POST',
70
+ json: { time },
85
71
  });
72
+ this.requestUpdate();
86
73
  }
87
- clearSnooze() {
88
- return __awaiter(this, void 0, void 0, function* () {
89
- yield this.restClient.request({
90
- url: this.chimeUrl('do_not_disturb'),
91
- method: 'POST',
92
- });
93
- this.requestUpdate();
74
+ async clearSnooze() {
75
+ await this.restClient.request({
76
+ url: this.chimeUrl('do_not_disturb'),
77
+ method: 'POST',
94
78
  });
79
+ this.requestUpdate();
95
80
  }
96
- updateChime(update) {
97
- return __awaiter(this, void 0, void 0, function* () {
98
- yield this.restClient.request({
99
- url: this.chimeUrl(),
100
- method: 'PUT',
101
- json: { chime: update },
102
- });
103
- this.requestUpdate();
104
- // inform caller if this change requires a reboot
105
- return Object.keys(update.settings || {}).some((key) => settingsWhichRequireReboot.includes(key));
81
+ async updateChime(update) {
82
+ await this.restClient.request({
83
+ url: this.chimeUrl(),
84
+ method: 'PUT',
85
+ json: { chime: update },
106
86
  });
87
+ this.requestUpdate();
88
+ // inform caller if this change requires a reboot
89
+ return Object.keys(update.settings || {}).some((key) => settingsWhichRequireReboot.includes(key));
107
90
  }
108
91
  setVolume(volume) {
109
92
  if (volume < 0 || volume > 11) {
@@ -115,13 +98,11 @@ class RingChime {
115
98
  },
116
99
  });
117
100
  }
118
- getHealth() {
119
- return __awaiter(this, void 0, void 0, function* () {
120
- const response = yield this.restClient.request({
121
- url: (0, rest_client_1.clientApi)(`chimes/${this.id}/health`),
122
- });
123
- return response.device_health;
101
+ async getHealth() {
102
+ const response = await this.restClient.request({
103
+ url: (0, rest_client_1.clientApi)(`chimes/${this.id}/health`),
124
104
  });
105
+ return response.device_health;
125
106
  }
126
107
  }
127
108
  exports.RingChime = RingChime;
@@ -50,7 +50,10 @@ class RingDevice extends subscribed_1.Subscribed {
50
50
  datatype: 'DeviceInfoSetType',
51
51
  dst: this.assetId,
52
52
  body: [
53
- Object.assign({ zid: this.zid }, body),
53
+ {
54
+ zid: this.zid,
55
+ ...body,
56
+ },
54
57
  ],
55
58
  });
56
59
  }
@@ -1,4 +1,4 @@
1
- import { ConnectionState, MediaStreamTrack, RTCIceCandidate, RtcpPacket, RtpPacket } from '@koush/werift';
1
+ import { ConnectionState, MediaStreamTrack, RTCIceCandidate, RtcpPacket, RtpPacket } from 'werift';
2
2
  import { Observable, ReplaySubject, Subject } from 'rxjs';
3
3
  export interface BasicPeerConnection {
4
4
  createOffer(): Promise<{
@@ -27,11 +27,11 @@ export declare class WeriftPeerConnection implements BasicPeerConnection {
27
27
  onConnectionState: ReplaySubject<"failed" | "closed" | "connected" | "connecting" | "new" | "disconnected">;
28
28
  returnAudioTrack: MediaStreamTrack;
29
29
  constructor();
30
- createOffer(): Promise<import("@koush/werift").RTCSessionDescription>;
30
+ createOffer(): Promise<import("werift").RTCSessionDescription>;
31
31
  createAnswer(offer: {
32
32
  type: 'offer';
33
33
  sdp: string;
34
- }): Promise<import("@koush/werift").RTCSessionDescription>;
34
+ }): Promise<import("werift").RTCSessionDescription>;
35
35
  acceptAnswer(answer: {
36
36
  type: 'answer';
37
37
  sdp: string;
@@ -1,16 +1,7 @@
1
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
2
  Object.defineProperty(exports, "__esModule", { value: true });
12
3
  exports.WeriftPeerConnection = void 0;
13
- const werift_1 = require("@koush/werift");
4
+ const werift_1 = require("werift");
14
5
  const rxjs_1 = require("rxjs");
15
6
  const util_1 = require("../util");
16
7
  const debug = false, ringIceServers = [
@@ -104,25 +95,19 @@ class WeriftPeerConnection {
104
95
  this.onConnectionState.next(pc.connectionState);
105
96
  });
106
97
  }
107
- createOffer() {
108
- return __awaiter(this, void 0, void 0, function* () {
109
- const offer = yield this.pc.createOffer();
110
- yield this.pc.setLocalDescription(offer);
111
- return offer;
112
- });
98
+ async createOffer() {
99
+ const offer = await this.pc.createOffer();
100
+ await this.pc.setLocalDescription(offer);
101
+ return offer;
113
102
  }
114
- createAnswer(offer) {
115
- return __awaiter(this, void 0, void 0, function* () {
116
- yield this.pc.setRemoteDescription(offer);
117
- const answer = yield this.pc.createAnswer();
118
- yield this.pc.setLocalDescription(answer);
119
- return answer;
120
- });
103
+ async createAnswer(offer) {
104
+ await this.pc.setRemoteDescription(offer);
105
+ const answer = await this.pc.createAnswer();
106
+ await this.pc.setLocalDescription(answer);
107
+ return answer;
121
108
  }
122
- acceptAnswer(answer) {
123
- return __awaiter(this, void 0, void 0, function* () {
124
- yield this.pc.setRemoteDescription(answer);
125
- });
109
+ async acceptAnswer(answer) {
110
+ await this.pc.setRemoteDescription(answer);
126
111
  }
127
112
  addIceCandidate(candidate) {
128
113
  return this.pc.addIceCandidate(candidate);