webRTC Flashcards
Pros
No need to download plug-ins
Peer to peer connection reduces load on server and reduces chance of man in the middle attack
Encryption improves privacy
Which browsers does not support webRTC?
Safari
Internet Explorere
IOS browsers
Cons
Doesn’t work on every browser
Scaling can be hard
Getting your own media
const startStream = ()=>{ //getUserMedia API setup navigator.getUserMedia = navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia;
//Constraints const constraints = { audio:false, video: { mandatory:{ minWidth:640, maxWidth:640, minHeight:360, maxHeight:480, } } };
//GetUser navigator.mediaDevices.getUserMedia(constraints).then((stream)=>{ $videoArea.srcObject = stream $videoArea.className = 'grayscale_filter'; $videoArea.play() }).catch((error)=>{ console.log("Error with getting user media: " + error) });
} startStream() $videoSelect.onchange = startstream()
3 Ways to establish a connection via signalling?
Public IP’s
STUN server
TURN server
What is signaling?
Signallng is the process of sharing ICE candidates, and SDP or session description protocol offers and answers between 2 or more participants in a webRTC session
Before a peer to peer connection can be established, a signal server is required to establish the connection before a call
Signalling is the process of coordinating communication through an exchange of messages.
SDP (session description protocol) is used to send offers and answers as well as ICE candidates
ICE Framework
Interactive connectivity Establishment Framework
The ICE framework finds the best path to connect peers. It tries all possibilities in parallel and chooses the most efficient option that works.
first ICE tries to a direct connection using the host address abtained from a diveice’s operating system
if that fails, A stun server is used to get an external (public) network address
if that fails, a TURN server is used to relay traffic.
For this to happen the applicaiton must pass ICE server URL’s to RTCPeerConnection
Controlling peer
The peer that is controlling the session. Decided by ICE
STO
Signaling Transport Options
HTTP
WebSockets
MQTT
Carrier Pigeons
What is webRTC?
Framework that enables realtime communication in the browser.
3 major api’s
getUserMedia()
RTCPeerConnection()
Data channel
.
Typical architecture topologies
peer to peer
Mesh
Mixer(MCU) -uses a media server
Routing(SFU) - uses a server