Web RTC - Quick JavaScript Interview Questions (2015)

Quick JavaScript Interview Questions (2015)

Chapter 13. Web RTC

Q. What is Web RTC?
Web RTC provides the capability to browsers for real time communication without any additional plugin installed. It involves audio, video and other type of data streaming among the browser with their native capability.

Q. What is the API implemented by Web RTC?
Web RTC implements three different API. These interfaces are listed below.

MediaStream : This represents a synchronized media stream using camera and microphone.
RTCPeerConnection : This interface is responsible for stable connection between peer browser during real time communication.

RTCDataChannel : This interface is responsible for other type of data communication between peer browser. For example the remote desktop sharing using browser.

Q . What is MediaStream?

MediaStream basically represents the stream captured by Camera and microphone. Each MediaStream has an input which captures the stream. This MediaStream can be accessed using navigator.getUserMedia() method.

Q . What are the input parameters to getUserMedia() method? ANSWER
The getUserMedia() method takes 3 parameters as input. These parameters are as follows:
Constraint Object similar to a configuration object. Success Callback Method.
Error Callback Method.

Q. What are MediaStreamTracks?

The MediaStream returned by getUserMedia() has 2 useful methods getAudioTracks() and getVideoTracks().Both of these methods returns an array of MediaStramTracks.

Q . What are the protocols used by Web RTC for
Web RTC uses 2 different protocols for communication. These 2 protocols are listed as follows.

DTLS: Datagram Transport Layer Security.
SRTP: Secure Real-time Transport Protocol.

Q . How to view the statistics of an in progress Web RTC session in Chrome browser?
We can view the detail statistics and charts of an ongoing Web RTC session in chrome browser by using chrome://webrtc-internals/ in chrome browser.

Q . What are the different event handlers for a channel? ANSWER
A channel has 4 different event handlers. These event handlers are as follows.

Onopen : Executed when the connection is established. Onerror: Executed if there is an error creating the connection.
Onmessage: When you receive a message, this method will execute
Oclose: Executed if the other peer closes the connection.

Q . What is a signal channel?
WebRTC can’t create connections without some sort of server in the middle. We call this the Signal Channel.

Q . What is an ICE technique?
Interactive Connectivity Establishment (ICE) is a technique used in computer networking involving network address translators (NATs) in Internet applications of Voice over Internet Protocol (VoIP), peer-to-peer communications, video, instant messaging and other interactive media.

Q. What is an ICE Candidate?

While communication peers must exchange information about the network connection. This is known as an ICE candidate.

Q . What are the server side functionalities needed by the Web RTC?
Web RTC requires following functionalities from server side to create a communication between peers.

User discovery and communication.
NAT/firewall traversal.
Relay servers in case peer-to-peer communication fails.

Q. What is STUN protocol? ANSWER

STUN (Session Traversal Utilities for NAT) is a standardized set of methods and a network protocol to allow an end host to discover its public IP address if it is located behind a NAT.