Use sample code in different PCs with different IP Address

135 views
Skip to first unread message

Mojtaba Esfandiari

unread,
Sep 16, 2024, 4:09:19 AMSep 16
to discuss-webrtc

hello,

Please help me how can I use samples on different PCs? I think all codes are only used on one PC.

I see  Broadcastchannel type for webrtc signaling in code, while I have to use two different PCs with different IP addresses.

With best regards

Mojtaba

Muhammad Usman Bashir

unread,
Sep 16, 2024, 8:20:49 PMSep 16
to discuss-webrtc
To use WebRTC between different PCs with different IP addresses, you have to replace the BroadcastChannel with a proper signaling mechanism.
In your WebRTC code, replace BroadcastChannel with WebSocket communication, you'll need to implement the actual WebRTC peer connection setup and signaling using the WebSocket connection established above.

WebRTC Signaling: Before establishing a WebRTC connection, peers must exchange network and media details via a signaling server.

You can take intuition from this demo: Video Conferencing using RTCMultiConnection

Mojtaba

unread,
Sep 22, 2024, 12:10:39 PMSep 22
to discuss...@googlegroups.com
Hi Muhammad, 
I have two EC2 servers in AWS with predefined IP addresses. I need to create a WebRTC peer connection setup between them and exchange media details via signaling.

--
This list falls under the WebRTC Code of Conduct - https://webrtc.org/support/code-of-conduct.
---
You received this message because you are subscribed to the Google Groups "discuss-webrtc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to discuss-webrt...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/discuss-webrtc/b9a747d3-e0f9-4039-8142-9d07cb5e08bbn%40googlegroups.com.


--
--Mojtaba Esfandiari.S

Muhammad Usman Bashir

unread,
Sep 23, 2024, 9:50:22 AMSep 23
to discuss-webrtc
You want to do WebRTC P2P communication between two AWS servers only, Right?

Mojtaba

unread,
Sep 24, 2024, 2:59:18 AMSep 24
to discuss...@googlegroups.com
Yes, It is right.
Actually, i'm going to simulate a simple demo like this site (https://webrtc.github.io/samples/src/content/peerconnection/bandwidth/) on different PCs or EC2 debian servers.
What I am looking for is to adjust bandwidth just like the demo. 





--
--Mojtaba Esfandiari.S

Muhammad Usman Bashir

unread,
Oct 6, 2024, 12:54:05 PMOct 6
to discuss-webrtc
First, you have to establish P2P communication between the servers (EC2 debian machines) by exchanging SDP offers, answers, and ICE candidates via a signaling server. Once the peer connection is established, you can control the bandwidth as per your requirement, similar to the demo you referenced. To adjust bandwidth in WebRTC between two PCs or EC2 servers, you can modify the bitrate using RTCRtpSender.setParameters(). Here's how you can do it:  
```
const sender = pc.getSenders()[0]; // Assuming you're working with the first track
const parameters = sender.getParameters();
parameters.encodings[0].maxBitrate = 1000000; // Set max bitrate to 1 Mbps
sender.setParameters(parameters);
```
Reply all
Reply to author
Forward
0 new messages