mirror of
https://github.com/xtr-dev/rondevu-client.git
synced 2025-12-10 10:53:24 +00:00
Refactor: Send/receive ICE candidates as complete objects
- Update to send full RTCIceCandidateInit objects instead of partial data - Simplify API by using JSON serialization - Include usernameFragment field - More maintainable and future-proof 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -24,10 +24,18 @@ export interface Offer {
|
||||
answeredAt?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* RTCIceCandidateInit interface for environments without native WebRTC types
|
||||
*/
|
||||
export interface RTCIceCandidateInit {
|
||||
candidate?: string;
|
||||
sdpMid?: string | null;
|
||||
sdpMLineIndex?: number | null;
|
||||
usernameFragment?: string | null;
|
||||
}
|
||||
|
||||
export interface IceCandidate {
|
||||
candidate: string;
|
||||
sdpMid: string | null;
|
||||
sdpMLineIndex: number | null;
|
||||
candidate: RTCIceCandidateInit; // Full candidate object
|
||||
peerId: string;
|
||||
role: 'offerer' | 'answerer';
|
||||
createdAt: number;
|
||||
@@ -282,11 +290,7 @@ export class RondevuOffers {
|
||||
*/
|
||||
async addIceCandidates(
|
||||
offerId: string,
|
||||
candidates: Array<{
|
||||
candidate: string;
|
||||
sdpMid?: string | null;
|
||||
sdpMLineIndex?: number | null;
|
||||
}>
|
||||
candidates: RTCIceCandidateInit[]
|
||||
): Promise<void> {
|
||||
const response = await this.fetchFn(`${this.baseUrl}/offers/${encodeURIComponent(offerId)}/ice-candidates`, {
|
||||
method: 'POST',
|
||||
|
||||
Reference in New Issue
Block a user