A go2rtc test WebRTC session verifies that your RTSP camera stream can be negotiated, connected, and played in a browser over WebRTC. The test flow covers SDP offer and answer exchange, ICE candidate connectivity, and codec negotiation between the browser and the go2rtc server. If any of those stages fail, go2rtc silently falls back to MSE or HLS, so systematic testing is the only way to confirm you are getting true low-latency WebRTC. This guide walks through the full test cycle and how to interpret every result. For production-grade video calling beyond camera streaming, see the VideoSDK video calling quickstart at their documentation site.
go2rtc has become the default answer for bridging RTSP cameras into browsers, and WebRTC is the mode that makes those streams feel live rather than delayed by seconds. But WebRTC in go2rtc is also the mode most likely to fail quietly: a blocked UDP port, a missing codec, or a half-completed ICE negotiation can drop you into MSE fallback without any visible error. That is why a deliberate go2rtc test WebRTC workflow matters. In this article you will learn how to set up a reliable test environment, run a full WebRTC session against your go2rtc instance, capture SDP and ICE diagnostics, and interpret what you see so failures become fixable instead of mysterious.
What a go2rtc test WebRTC Session Actually Covers

A go2rtc test WebRTC session is defined as an end-to-end verification of the signaling, connectivity, and media negotiation path between a browser client and the go2rtc server. go2rtc works by accepting your RTSP camera source, restreaming it, and exposing it to browsers through multiple output formats, with WebRTC as the lowest-latency option.
The test flow has three distinct stages. First, the browser generates an SDP offer describing which codecs it can send and receive. Second, go2rtc responds with an SDP answer selecting the codecs it will actually use, and both sides exchange ICE candidates to find a working network path. Third, media flows directly over the negotiated connection, typically via UDP with SRTP encryption. If any stage fails, go2rtc's player can fall back to MSE, which stands for Media Source Extensions, a mode that plays over HTTP and works almost everywhere but adds buffering latency.
Why You Should Test WebRTC Instead of Assuming It Works
The single most important reason to test is that go2rtc hides failures. When WebRTC negotiation stalls, the built-in player quietly retries with MSE, and to a casual viewer the stream still looks fine. The latency difference, however, is dramatic. A healthy WebRTC path typically delivers video within a fraction of a second of the camera sensor capturing it, while MSE playback often lags by several seconds because the browser must buffer segments before rendering them.
That difference matters for doorbell cameras, security monitoring, and any interaction where you need to see events as they happen. It also matters for two-way audio, which only works over WebRTC in go2rtc; MSE playback is one-directional. If you never test, you may run a camera dashboard for months believing you have real-time video when you actually have a delayed proxy of it.
Testing also protects you against regressions. A browser update can drop support for a codec, a router firmware change can alter UDP handling, and a go2rtc upgrade can change default negotiation behavior. A repeatable test procedure lets you confirm after every change that WebRTC still works end to end.
Setting Up a Reliable Test Environment
Before running any test, isolate the variables. Start by running the browser and the go2rtc server on the same local network as the camera, with no VPN, proxy, or ad-blocking extension in the path. Use a clean browser profile so extensions cannot interfere with WebRTC, and prefer Chromium-based browsers or Firefox for testing because their diagnostic tools for WebRTC are the most mature.
Confirm that your go2rtc instance is reachable over HTTPS or that you are accessing it from a host context the browser treats as secure. WebRTC APIs in modern browsers require a secure context, which means either HTTPS, or localhost. If you load the go2rtc player page over plain HTTP from a remote machine, the browser may refuse to create the peer connection at all, and you will waste time chasing network problems that do not exist.
Next, verify your camera source is healthy at the RTSP layer before testing the browser layer. If the source stream itself is unstable, every downstream test becomes ambiguous. Watch the go2rtc logs while the source connects and confirm there are no reconnect loops or codec warnings. A stable source is the foundation of a meaningful WebRTC test.
Finally, decide what success looks like before you start. A good baseline is: video appears within one second, the connection state reaches connected and stays there, the player reports WebRTC as the active mode rather than MSE, and audio, if your camera has it, is audible and synchronized.
Running the go2rtc test WebRTC Session
Open the go2rtc web interface in your test browser and select the stream you want to verify. The player will attempt WebRTC first. Give it a few seconds to negotiate, then confirm which mode is actually active. The player interface exposes the current playback mode, and this is your first checkpoint: if it says WebRTC, negotiation succeeded at least partially; if it says MSE or HLS, something in the WebRTC path failed and the player fell back.
While the stream plays, open the browser's WebRTC diagnostics. In Chromium-based browsers, an internal diagnostics page lists every active peer connection along with its state, selected candidate pair, and negotiated codecs. In Firefox, the connection details are visible through the developer tools networking view when you filter for WebRTC signaling traffic. These tools show you the truth of the session rather than the player's summary of it.
Check three things in the diagnostics. First, the connection state should read connected, not failed or closed. Second, the selected candidate pair tells you which network path won: a host-to-host pair means direct local communication, a server-reflexive pair means NAT traversal through STUN is in play, and a relayed pair means traffic is being tunneled through TURN, which adds latency. Third, the codec list confirms what audio and video formats were actually negotiated, which may differ from what you expected.
Let the session run for several minutes. Many WebRTC failures are intermittent: a candidate pair that works initially and then drops, or a source that stalls after the first keyframe. A test that only runs for ten seconds cannot catch these. Watch for freezes, black frames, or a player that silently switches to MSE mid-session, which indicates the WebRTC path degraded after initial connection.
Interpreting the SDP Offer and Answer
The session description protocol exchange is where codec problems reveal themselves. The browser's offer lists every codec it is willing to use, and go2rtc's answer picks from that list. If the camera's video codec does not appear in the answer, WebRTC cannot carry that stream and fallback is inevitable.
The most common mismatch involves H.265, also called HEVC. Many IP cameras default to H.265 encoding because it is more bandwidth-efficient, but browser support for H.265 over WebRTC is inconsistent. If your camera sends H.265 and the browser cannot negotiate it, either switch the camera to H.264 in its own settings, or configure go2rtc to transcode the stream, keeping in mind that transcoding consumes CPU and adds a small delay.
Audio has its own pitfalls. Some cameras emit G.711 over RTSP, which go2rtc can often pass through, but others emit codecs that WebRTC cannot carry at all, such as G.726. If video works but audio never appears, inspect the negotiated audio codec in the diagnostics. A missing audio codec in the answer is the explanation, and the fix is on the camera side or through transcoding.
When reading the answer, also confirm the direction of the media. For one-way camera viewing, the video should be marked as send-only from go2rtc's perspective and receive-only from the browser's. For two-way audio, both directions must be negotiated, and this is worth verifying explicitly because a misconfigured direction is invisible in the player but breaks talk-back functionality.
Diagnosing ICE and Connectivity Failures
If the SDP exchange succeeds but the connection never establishes, the problem is almost always ICE, the interactive connectivity establishment framework that finds a usable network path between the browser and go2rtc.
Start with the candidate types. Host candidates work when both endpoints are on the same machine or same network without NAT in between. Server-reflexive candidates require a STUN server to discover the public address as seen from outside the NAT. Relay candidates require a TURN server to tunnel traffic when direct paths are blocked. If your test shows zero server-reflexive candidates, either no STUN server is configured, or outbound UDP to the STUN server is blocked.
The most frequent real-world failure is blocked UDP. Some networks, especially corporate or guest networks, block outbound UDP entirely. WebRTC can theoretically fall back to TCP, but go2rtc's WebRTC implementation generally prefers UDP, and a hard UDP block often results in a stalled negotiation followed by MSE fallback. Test from a network where UDP is permitted before concluding anything about your configuration.
When testing remote access, remember that go2rtc needs to advertise an address the browser can actually reach. If go2rtc is behind a reverse proxy or port forward and advertises only its internal address, the browser gathers candidates that point at an unreachable private IP. The fix is to configure the external address in go2rtc so the advertised candidates match how the browser reaches the server. This is one of the most common go2rtc test WebRTC failures reported by users accessing cameras away from home.
A relayed candidate pair deserves attention even when it works. If your local test unexpectedly routes through TURN, it means direct paths are being blocked by firewall rules or NAT behavior, and you are paying a latency and bandwidth cost for every frame. Investigate why direct connectivity failed rather than accepting the relay as a solution.
Recognizing and Interpreting MSE Fallback
MSE fallback is not an error; it is a design decision. go2rtc would rather show you a delayed stream than no stream at all. But for testing purposes, fallback is the signal that the WebRTC path failed, and your job is to find which stage broke.
The diagnostic sequence is straightforward. If the player falls back immediately, before any connection attempt, suspect a secure-context problem or a browser that lacks the needed codec. If it falls back after a visible delay, suspect ICE failure: the browser tried candidates, none connected, and the player gave up. If it starts in WebRTC and later switches to MSE, suspect an unstable source stream or a network path that degrades under load.
One subtle case deserves mention: a stream that plays in WebRTC but with heavy visual artifacts or constant keyframe flicker. This usually means packet loss on the UDP path. The connection technically works, so no fallback occurs, but the experience is poor. Compare the same stream over MSE: if artifacts disappear, the network path between browser and go2rtc is lossy, and you should investigate Wi-Fi signal strength, network congestion, or MTU mismatches rather than go2rtc settings.
Testing Two-Way Audio
Two-way audio is the feature most sensitive to configuration errors because it requires the browser to send audio back to go2rtc, which then forwards it to the camera. Test it separately from video.
First, confirm the browser has microphone permission for the go2rtc page; without it, the return audio track is never created. Second, check that the negotiated audio direction is bidirectional, as described earlier. Third, verify the camera actually accepts audio input over RTSP, because many cameras advertise two-way audio in their marketing but only accept it through proprietary apps.
A practical test method is to place a speaker near the camera, play a distinct sound from the browser's talk-back control, and have someone near the camera confirm they hear it, then speak toward the camera and confirm the browser receives the reply. Latency in both directions should be under roughly half a second; anything above that makes conversation impossible and usually points to transcoding delays or a congested path.
A Repeatable Test Checklist
To make your go2rtc test WebRTC procedure repeatable, follow the same order every time. Confirm the source stream is stable in the go2rtc logs. Load the player page in a clean browser profile over a secure context. Start playback and identify the active mode. Open the browser's WebRTC diagnostics and record the connection state, selected candidate pair, and negotiated codecs. Let the session run for at least five minutes while watching for freezes or mid-session fallback. If two-way audio matters, test it explicitly with a helper near the camera. Record what you observed so future regressions have a baseline to compare against.
Common Fixes Summarized
When a test fails, work through the fixes in order of likelihood. Switch the camera from H.265 to H.264 if codec negotiation fails. Ensure the player page is loaded over HTTPS or localhost if WebRTC never even attempts to connect. Verify outbound UDP is permitted if ICE gathers candidates but none connect. Configure the advertised external address if remote access fails while local access works. Check microphone permissions and negotiated audio direction if talk-back is silent. And compare behavior over MSE to distinguish network problems from configuration problems when video plays but looks corrupted.
Conclusion
A disciplined go2rtc test WebRTC session turns an opaque fallback into a diagnosable failure. By verifying the source, confirming the secure context, checking the active playback mode, reading the SDP answer for codec selection, inspecting the ICE candidate pair for the real network path, and stress-testing the session over time, you can prove that your cameras are delivering genuine low-latency WebRTC rather than a buffered substitute. Run the same checklist after every go2rtc upgrade, browser update, or network change, and your streams will stay as live as the day you first configured them.
Testing Error Handling
Simulate various error conditions (e.g., network interruptions, codec mismatches) and verify that your application handles them gracefully, providing informative error messages to the user.
Advanced Go2RTC WebRTC Testing Techniques
Beyond basic functional testing, advanced techniques can help identify performance bottlenecks and stability issues.
Performance Testing
Measure key performance metrics such as latency, bandwidth usage, and CPU utilization under various load conditions. Tools like
iperf3 can be used to simulate network conditions. You can use Go's built-in profiling tools to analyze go2rtc's resource consumption.Stress Testing
Subject your WebRTC application and go2rtc to extreme load conditions (e.g., a large number of concurrent users) to identify potential scalability limitations and stability issues. Tools like
k6 or locust are helpful for this.Automated Testing Frameworks
Use automated testing frameworks like Selenium or Puppeteer to create automated test suites that can be run repeatedly to ensure consistent functionality and performance. These frameworks can simulate user interactions and verify WebRTC behavior.
Integration with CI/CD
Integrate your WebRTC tests into your CI/CD pipeline to automatically run tests whenever code changes are made, ensuring that new features or bug fixes do not introduce regressions.
Troubleshooting Common Go2RTC WebRTC Testing Issues
This section provides guidance on resolving common problems encountered during WebRTC testing with go2rtc.
Connection Errors
- ICE Gathering Failures: Check network connectivity, firewall settings, and STUN/TURN server configuration.
- DTLS Handshake Errors: Ensure that the client and server have compatible TLS versions and cipher suites.
- Signaling Issues: Verify that signaling messages are being exchanged correctly and that the SDP offers and answers are valid.
Media Streaming Problems
- Codec Mismatches: Ensure that the client and server support compatible audio and video codecs. Check go2rtc's transcoding settings.
- Network Congestion: Reduce the bitrate or resolution of the media stream to mitigate network congestion.
- Firewall Restrictions: Make sure that the firewall is not blocking UDP traffic on the ports used for media streaming.
Signaling Failures
- WebSocket Disconnections: Check the WebSocket server logs for errors. Ensure that the WebSocket connection is stable.
- SDP Parsing Errors: Validate the SDP offers and answers for syntax errors. Use a tool like
sdp-transformto inspect the SDP data. - Signaling Message Corruption: Verify that signaling messages are not being corrupted during transmission.
Best Practices for Go2RTC WebRTC Testing
Adhering to best practices ensures that your testing efforts are effective and efficient.
Test Planning
Define clear test objectives, scope, and criteria before starting testing. Identify the key features and functionalities that need to be tested.
Test Case Design
Create detailed test cases that cover a wide range of scenarios, including positive and negative tests. Use a test case management tool to organize and track your test cases.
Test Data Management
Use realistic test data to simulate real-world conditions. Create a test data repository to store and manage your test data.
Reporting and Analysis
Document all test results and analyze the data to identify trends and patterns. Use a bug tracking system to track and resolve defects.
Conclusion: Ensuring Robust WebRTC Applications with Go2RTC Testing
Thorough testing is essential for building robust and reliable WebRTC applications. By leveraging go2rtc and following the best practices outlined in this guide, you can ensure that your WebRTC applications meet the highest standards of quality and performance. Go2RTC is a great option to have in mind while creating WebRTC tests.
Free $20 Balance for AI Voice Agents & Video Calls
FAQ
