@xtr-dev/rondevu-client 0.18.6 → 0.18.7
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/dist/rondevu.js +8 -21
- package/package.json +1 -1
package/dist/rondevu.js
CHANGED
|
@@ -465,33 +465,20 @@ export class Rondevu extends EventEmitter {
|
|
|
465
465
|
this.isPolling = true;
|
|
466
466
|
try {
|
|
467
467
|
const result = await this.api.poll(this.lastPollTimestamp);
|
|
468
|
-
// Update timestamp FIRST to prevent re-fetching same answers if processing fails
|
|
469
|
-
if (result.answers.length > 0) {
|
|
470
|
-
const maxAnswerTimestamp = Math.max(...result.answers.map(a => a.answeredAt));
|
|
471
|
-
this.lastPollTimestamp = Math.max(this.lastPollTimestamp, maxAnswerTimestamp);
|
|
472
|
-
}
|
|
473
468
|
// Process answers
|
|
474
469
|
for (const answer of result.answers) {
|
|
475
470
|
const activeOffer = this.activeOffers.get(answer.offerId);
|
|
476
471
|
if (activeOffer && !activeOffer.answered) {
|
|
477
472
|
this.debug(`Received answer for offer ${answer.offerId}`);
|
|
478
|
-
|
|
473
|
+
await activeOffer.pc.setRemoteDescription({
|
|
474
|
+
type: 'answer',
|
|
475
|
+
sdp: answer.sdp
|
|
476
|
+
});
|
|
479
477
|
activeOffer.answered = true;
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
});
|
|
485
|
-
this.emit('offer:answered', answer.offerId, answer.answererId);
|
|
486
|
-
// Create replacement offer
|
|
487
|
-
this.fillOffers();
|
|
488
|
-
}
|
|
489
|
-
catch (err) {
|
|
490
|
-
// If setRemoteDescription fails, reset the answered flag
|
|
491
|
-
activeOffer.answered = false;
|
|
492
|
-
this.debug(`Failed to set remote description for offer ${answer.offerId}:`, err);
|
|
493
|
-
// Don't throw - continue processing other answers
|
|
494
|
-
}
|
|
478
|
+
this.lastPollTimestamp = answer.answeredAt;
|
|
479
|
+
this.emit('offer:answered', answer.offerId, answer.answererId);
|
|
480
|
+
// Create replacement offer
|
|
481
|
+
this.fillOffers();
|
|
495
482
|
}
|
|
496
483
|
}
|
|
497
484
|
// Process ICE candidates
|
package/package.json
CHANGED