diff options
author | metamuffin <metamuffin@disroot.org> | 2022-09-16 14:33:20 +0200 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2022-09-16 14:33:20 +0200 |
commit | ff2329cac03703a10ce8b3793d707131403318b4 (patch) | |
tree | 18fd12ea0ccaf19ba351eb8fc199a512314f7d59 | |
parent | fa47c353d7ebc653e5a90eee68535fb6e55f2c30 (diff) | |
download | keks-meet-ff2329cac03703a10ce8b3793d707131403318b4.tar keks-meet-ff2329cac03703a10ce8b3793d707131403318b4.tar.bz2 keks-meet-ff2329cac03703a10ce8b3793d707131403318b4.tar.zst |
remove redundant RTCSessionDescriptionInit type
-rw-r--r-- | client-web/source/user/remote.ts | 18 | ||||
-rw-r--r-- | common/packets.d.ts | 7 |
2 files changed, 11 insertions, 14 deletions
diff --git a/client-web/source/user/remote.ts b/client-web/source/user/remote.ts index bee3042..acd52ac 100644 --- a/client-web/source/user/remote.ts +++ b/client-web/source/user/remote.ts @@ -110,28 +110,26 @@ export class RemoteUser extends User { this.negotiation_busy = true const offer_description = await this.peer.createOffer() await this.peer.setLocalDescription(offer_description) - const offer = { type: offer_description.type, sdp: offer_description.sdp } - log("webrtc", `sent offer: ${this.display_name}`, { offer }) - this.room.signaling.send_relay({ offer }, this.id) + log("webrtc", `sent offer: ${this.display_name}`, { offer: offer_description.sdp }) + this.room.signaling.send_relay({ offer: offer_description.sdp }, this.id) } - async on_offer(offer: RTCSessionDescriptionInit) { + async on_offer(offer: string) { this.negotiation_busy = true log("webrtc", `got offer: ${this.display_name}`, { offer }) - const offer_description = new RTCSessionDescription(offer) + const offer_description = new RTCSessionDescription({ sdp: offer, type: "offer" }) await this.peer.setRemoteDescription(offer_description) this.answer() } async answer() { const answer_description = await this.peer.createAnswer() await this.peer.setLocalDescription(answer_description) - const answer = { type: answer_description.type, sdp: answer_description.sdp } - log("webrtc", `sent answer: ${this.display_name}`, { answer }) - this.room.signaling.send_relay({ answer }, this.id) + log("webrtc", `sent answer: ${this.display_name}`, { answer: answer_description.sdp }) + this.room.signaling.send_relay({ answer: answer_description.sdp }, this.id) this.negotiation_busy = false } - async on_answer(answer: RTCSessionDescriptionInit) { + async on_answer(answer: string) { log("webrtc", `got answer: ${this.display_name}`, { answer }) - const answer_description = new RTCSessionDescription(answer) + const answer_description = new RTCSessionDescription({ sdp: answer, type: "answer" }) await this.peer.setRemoteDescription(answer_description) this.negotiation_busy = false } diff --git a/common/packets.d.ts b/common/packets.d.ts index c5e9637..02108a3 100644 --- a/common/packets.d.ts +++ b/common/packets.d.ts @@ -1,7 +1,6 @@ // copy pasted from dom.lib.d.ts because it can not be referenced in the server. -type F_RTCSdpType = "answer" | "offer" | "pranswer" | "rollback"; -interface F_RTCSessionDescriptionInit { sdp?: string; type: F_RTCSdpType; } +type Sdp = string interface F_RTCIceCandidateInit { candidate?: string; sdpMLineIndex?: number | null; sdpMid?: string | null; usernameFragment?: string | null; } export interface /* enum */ ClientboundPacket { @@ -28,8 +27,8 @@ export interface /* enum */ RelayMessage { provide?: ProvideInfo request?: { id: number } - offer?: F_RTCSessionDescriptionInit, - answer?: F_RTCSessionDescriptionInit, + offer?: Sdp, + answer?: Sdp, ice_candidate?: F_RTCIceCandidateInit, } export interface ChatMessage { text?: string, image?: string } |