5 exercises — 5 exercises practising MediaStream, codec negotiation, simulcast, screen capture, and WebRTC media vocabulary.
0 / 10 completed
1 / 10
A developer explains: "We get the user's camera and microphone using getUserMedia()." What does this function return and what are constraints?
getUserMedia() is the gateway to device media in WebRTC — it returns a MediaStream and lets you specify quality and device preferences via constraints.
Example call: const stream = await navigator.mediaDevices.getUserMedia({ video: { width: { ideal: 1280 }, height: { ideal: 720 }, facingMode: 'user' }, audio: { echoCancellation: true, noiseSuppression: true } }). The constraints are hints, not hard requirements — the browser selects the closest available option. The returned MediaStream contains separate tracks: one video MediaStreamTrack and one audio MediaStreamTrack. Each track can be added to an RTCPeerConnection individually (pc.addTrack(track, stream)) for transmission.
Key vocabulary: • getUserMedia() — browser API requesting camera/microphone access; returns MediaStream • MediaStreamTrack — a single audio or video track within a MediaStream; can be enabled/disabled independently • constraints — video/audio quality and device preferences passed to getUserMedia; treated as hints by the browser
2 / 10
During a code review, a senior engineer says: "We should prefer VP9 over VP8 for video codec negotiation." How does codec preference work in WebRTC and why might VP9 be preferred?
setCodecPreferences() puts the application in control of codec selection — critical for optimising quality and bandwidth for your use case.
VP9 advantages: better compression (30-50% lower bitrate vs. VP8 for equivalent quality), hardware acceleration on modern devices, native support in Chromium-based browsers, Firefox, and Safari (since 2021). VP8 advantages: wider compatibility (older browsers), lower CPU usage on very old hardware. For video conferencing where bandwidth efficiency matters, VP9 is typically preferred. For one-to-one calls on mobile where battery life matters, VP8 may be better due to lower CPU usage. H.264 has the best hardware encoder support (hardware chips in most phones) but has licensing considerations. AV1 is emerging as the next step (better than VP9) but has limited hardware acceleration today.
Key vocabulary: • setCodecPreferences() — RTCRtpTransceiver method setting codec priority order for SDP negotiation • VP9 — Google's open-source codec; better compression than VP8; preferred for bandwidth-constrained video • codec negotiation — offer lists supported codecs in priority order; answer selects the highest-priority mutually supported codec
3 / 10
A developer says: "We've enabled simulcast for our video conferencing app." What is simulcast and what problem does it solve?
Simulcast shifts the per-receiver encoding burden from the sender to the SFU — enabling scalable video quality adaptation without overloading the sending browser.
Without simulcast in a group call: if peer A has 10 receivers with different bandwidth, the sender would need to encode 10 different streams at 10 different quality levels. Browsers can't handle this CPU load. With simulcast: the sender encodes 3 layers once (e.g., 1080p at 2Mbps, 720p at 800kbps, 360p at 200kbps). The SFU receives all 3 layers for every participant and selects the best layer per receiver: a user on a good broadband connection gets 1080p; a mobile user on cellular gets 360p; users on moderately good connections get 720p. The SFU adapts in real time as bandwidth changes. Simulcast is enabled via RTCRtpSender encodings with multiple entries, each specifying rid, maxBitrate, and scaleResolutionDownBy.
Key vocabulary: • simulcast — encoding and sending multiple quality layers simultaneously; SFU selects the right layer per receiver • RID (Restriction Identifier) — label for each simulcast layer (e.g., 'h', 'm', 'l' for high/medium/low) • SFU layer selection — SFU switches between simulcast layers based on receiver bandwidth; seamless for the viewer
4 / 10
A developer wants to add screen sharing to an existing video call. They use getDisplayMedia(). How does this differ from getUserMedia()?
getDisplayMedia() captures display content with mandatory user picker interaction — the application cannot silently capture the screen without explicit user consent for each session.
Key differences from getUserMedia(): (1) the user must actively choose what to share via the browser's screen picker (entire screen, specific app window, or browser tab) — the application cannot bypass this; (2) no camera-style constraints — you can't specify which screen to capture programmatically; (3) the video track fires the ended event when the user clicks "Stop sharing" in the browser's persistent sharing indicator — the application must listen for this to update UI; (4) recommended settings for screen share: frameRate 5-15fps (screens change less than cameras), high resolution (1920x1080 for readability), cursor capture enabled. Screen share tracks can be added to an existing call using addTrack() and replacing (or adding to) the camera track.
Key vocabulary: • getDisplayMedia() — captures screen/window/tab; requires browser picker interaction; different from getUserMedia() • display surface — what is being captured: monitor (entire screen), window (app window), or browser (tab) • cursor capture — optional setting to include the mouse cursor in the screen capture stream
5 / 10
A developer reports: "The remote user says the video is freezing even though the connection shows as connected." You check the Opus audio codec configuration. What is Opus and why is audio more resilient than video in poor network conditions?
Opus's built-in FEC and comfort noise make audio remarkably resilient — voice remains intelligible even with 20% packet loss, while video freezes noticeably at 3-5% loss.
Opus FEC mechanism: when encoding a packet, Opus includes a low-bitrate copy of the previous packet in the current packet's header. If a packet is lost, the receiver can partially recover the audio from the FEC data in the next packet. This "in-band FEC" trades a small bandwidth increase (5-10%) for significant loss resilience. Video has no equivalent cheap recovery mechanism — a lost keyframe requires a full refresh (PLI/FIR request), causing visible freezing. Video uses NACK (Negative Acknowledgement) to request retransmission, but retransmission adds latency. This is why in a degraded network, a WebRTC call maintains voice quality while video freezes — by design.
Key vocabulary: • Opus — mandatory WebRTC audio codec; supports 8-510kbps, 8-48kHz; includes built-in FEC • in-band FEC — forward error correction data embedded in the Opus packet header; recovers from single-packet loss • PLI (Picture Loss Indication) — receiver signal requesting the sender to send a new video keyframe after packet loss causes decoding failure
6 / 10
Sarah (Lead Developer): 'Our team is migrating to SRT streams for lower latency. Can you explain the key differences between SRT and RTSP in the context of WebRTC?'
SRT (Secure Reliable Transport) is designed specifically for real-time applications like WebRTC. Unlike RTSP, which is a standard protocol primarily used in broadcasting, SRT employs features such as unidirectional data flow and reliable transport to minimize latency – the crucial factor when dealing with low-latency media streams. RTSP lacks these optimizations, making it less suitable for WebRTC's stringent requirements.
7 / 10
Mark (DevOps Engineer): 'I'm seeing a high CPU usage on the media server. I suspect it's related to the codec negotiation process.' What does 'codec negotiation' refer to in WebRTC and why might it be resource-intensive?
Codec negotiation in WebRTC is a critical process where the client and server dynamically determine the most suitable audio and video codecs for a specific session. This involves evaluating factors such as network bandwidth, device capabilities (e.g., supported codecs), and quality requirements. This evaluation can be computationally intensive because it requires testing multiple codec combinations to find the optimal balance between quality and performance.
8 / 10
David (QA): 'The video stream is consistently choppy during calls with users on mobile networks. We've been using the H.264 codec.' What potential issue might be contributing to this problem, and how does it relate to WebRTC?
H.264, while widely supported, can be problematic on mobile networks due to its fixed block size. Variable bitrate (VBR) connections – common on mobile – benefit from more adaptive compression. H.264's block-based approach doesn't efficiently adapt to the fluctuating bandwidth of a VBR connection, leading to frame drops and choppy video. WebRTC relies heavily on efficient codecs for optimal performance.
9 / 10
Emily (Backend Engineer): 'We're implementing a new feature that allows users to stream their screen. The API returns the display media data.' What does 'display media' refer to in this context and how does it relate to WebRTC?
'Display media' in WebRTC refers to the raw data stream captured from a user's display – encompassing both video output (what's on the screen) and potentially input signals like mouse movements or keyboard presses. This contrasts with 'getUserMedia,' which focuses solely on capturing audio and video from cameras and microphones. The API returns this data for WebRTC to process and transmit.
10 / 10
Ben (Senior Developer): 'We're troubleshooting a call where the user reports audio distortion. We've confirmed Opus is being used as the codec.' What does 'Opus' do and why is it often preferred for WebRTC audio?
Opus (Open Polyphonic Audio Stream) is a royalty-free, open-source codec designed specifically for real-time communication applications like WebRTC. It excels at adapting to varying network conditions and provides excellent audio quality with low latency – crucial for minimizing perceived delay in voice calls. Its dynamic adaptation makes it far more resilient than older codecs when dealing with fluctuating bandwidth.
What does this WebRTC & Real-Time Language exercise cover?
This exercise, "Media Streams and Codecs — Vocabulary", tests your understanding of webrtc & real-time language vocabulary and phrasing through 10 multiple-choice questions drawn from real workplace scenarios.
Is this exercise free to use?
Yes. Every exercise on CoderSlingo, including this one, is completely free — no account, sign-up, or payment required.
How many questions does this exercise have?
This exercise has 10 questions. Each one presents a realistic sentence or scenario with multiple-choice options and an explanation once you answer.
What happens after I answer a question?
You'll see immediate feedback showing whether your answer was correct, along with a short explanation of why — then a button to move to the next question.
Can I retry the exercise if I get questions wrong?
Yes. Once you reach the results screen, click "Try again" to reset your answers and go through the exercise from the start as many times as you like.
Do I need to create an account to take this exercise?
No account is needed. Your answers are scored in your browser during the session — nothing is saved to a server, so you can jump straight in.
Is my progress saved if I leave the page?
No — progress within an exercise resets if you navigate away or reload. Each exercise is short enough to complete in a few minutes in one sitting.
Who is this WebRTC & Real-Time Language exercise for?
It's designed for IT professionals and learners who want to sound natural discussing webrtc & real-time language topics in English — useful for meetings, documentation, interviews, and day-to-day communication with English-speaking teams.
How is this different from reading a glossary or blog article?
Exercises like this one are active recall drills — you have to choose the correct term or phrasing yourself, which builds retention faster than passively reading a definition.
Where can I find more WebRTC & Real-Time Language exercises?
Browse the full WebRTC & Real-Time Language exercises hub for more practice, or explore other exercise categories covering vocabulary, grammar, interviews, and workplace communication.