Added frontend folder structure in Ombase's branch

This commit is contained in:
K
2025-02-22 13:00:33 +05:30
parent 33b5c9ccc8
commit 75f31b5b93
60 changed files with 9080 additions and 0 deletions
+41
View File
@@ -0,0 +1,41 @@
class PeerService {
constructor() {
if (!this.peer) {
this.peer = new RTCPeerConnection({
iceServers: [
{
urls: [
"stun:stun.l.google.com:19302",
"stun:global.stun.twilio.com:3478",
],
},
],
});
}
}
async getAnswer(offer) {
if (this.peer) {
await this.peer.setRemoteDescription(offer);
const ans = await this.peer.createAnswer();
await this.peer.setLocalDescription(new RTCSessionDescription(ans));
return ans;
}
}
async setLocalDescription(ans) {
if (this.peer) {
await this.peer.setRemoteDescription(new RTCSessionDescription(ans));
}
}
async getOffer() {
if (this.peer) {
const offer = await this.peer.createOffer();
await this.peer.setLocalDescription(new RTCSessionDescription(offer));
return offer;
}
}
}
export default new PeerService();