Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WebRTC one-way video call

we are fiddling around with WebRTC in our company. And i stumbled upon a weird thing, which i'm not sure is by design in WebRTC or an implementaiton error on our side.

We currently have a simple WebApp which displays a Contact-List of online contacts. One can now simply call any user on the contact list.

The Caller and the Callee are free to choose to share WebCam and/or Audio. Which is then respected by GetUserMedia() (MediaConstraints).

The weird thing now: The clients (Chrome 65) only negotiate a Video-Call if the Caller starts with Video enabled. If the caller is not offering his webcam, we don't get the callee webcam streamed back (if he allowed it).

But when the Caller initiates the Call with his webcam enabled and the Callee than decides not to show his, everything works as expected. (Only Caller has live stream).

If both parties agree on showing video, we get bideractional video streaming.

Anybody got some internal knowledge if this is meant to be this way? Isn't it possible to call someone without showing your own webcam, but later on seeing the callees webcam?

Thanks in advance, Sven

like image 650
Sven Eppler Avatar asked Apr 24 '18 12:04

Sven Eppler


People also ask

What is a WebRTC video-call?

A connection is established through a discovery and negotiation process called signaling. This tutorial will guide you through building a two-way video-call. WebRTC is a fully peer-to-peer technology for the real-time exchange of audio, video, and data, with one central caveat.

How does WebRTC work in P2P communication?

We will use WebRTC API to capture the microphone and camera of one peer and send it over the internet to another peer in our P2P communication. How does it work? Let’s take a look at the API we will be using. RTCPeerConnection — it’s used as a starting point of any connection. It provides an interface for connecting a local peer to a remote one.

What's new at @webrtcweb?

@WebRTCWeb . Github . Latest issues . What's New? All peers are directly connected with broadcaster. They're not connected with each other. Broadcaster can see/talk with all of them; they can only talk/listen only the broadcaster.

What is a WebRTC Signaling Server?

The signaling server Establishing a WebRTC connection between two devices requires the use of a signaling server to resolve how to connect them over the internet. A signaling server's job is to serve as an intermediary to let two peers find and establish a connection while minimizing exposure of potentially private information as much as possible.


2 Answers

try pc.createOffer({offerToReceiveVideo: true}) instead of calling it without those constraints.

like image 69
Philipp Hancke Avatar answered Oct 07 '22 16:10

Philipp Hancke


Philipp's answer works great. However, by now the proposed option is marked legacy and should not be used anymore. The new way of doing this is to add a video transceiver to the connection before creating the offer:

connection.addTransceiver('video');
// this step seems to be optional:
connection.getTransceivers().forEach(t => t.direction = 'recvonly');

connection.createOffer();

Credit to https://niccoloterreri.com/webrtc-with-transceivers. For the optional step, see https://developer.mozilla.org/en-US/docs/Web/API/RTCRtpTransceiver/direction.

like image 25
Christian Fritz Avatar answered Oct 07 '22 16:10

Christian Fritz