Skip to content

Commit

Permalink
debug
Browse files Browse the repository at this point in the history
  • Loading branch information
shinyoshiaki committed Feb 19, 2024
1 parent 5222185 commit 7129c44
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 11 deletions.
9 changes: 1 addition & 8 deletions examples/ice/turn/trickle_answer.html
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,7 @@
console.log("offer", offer.sdp);

const peer = (rtc = new RTCPeerConnection({
iceServers: [
{
urls: "turn:relay.backups.cz:3478",
credential: "webrtc",
username: "webrtc",
},
],
iceTransportPolicy: "relay",
iceServers: [{ urls: "stun:stun.l.google.com:19302" }],
}));
peer.onicecandidate = ({ candidate }) => {
if (candidate) {
Expand Down
8 changes: 5 additions & 3 deletions examples/ice/turn/trickle_offer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ server.on("connection", async (socket) => {
const pc = new RTCPeerConnection({
iceServers: [
{
urls: "turn:relay.backups.cz:3478",
credential: "webrtc",
username: "webrtc",
urls: "",
credential: "",
username: "",
},
],
iceTransportPolicy: "relay",
Expand All @@ -34,13 +34,15 @@ server.on("connection", async (socket) => {
await pc.setLocalDescription(offer);
const sdp = JSON.stringify(pc.localDescription);
socket.send(sdp);
console.log("offer", sdp);

socket.on("message", async (data: any) => {
const msg = JSON.parse(data);
if (RTCIceCandidate.isThis(msg)) {
await pc.addIceCandidate(msg);
} else if (RTCSessionDescription.isThis(msg)) {
await pc.setRemoteDescription(msg);
console.log("answer", msg);
}
});
});

0 comments on commit 7129c44

Please sign in to comment.