March 13, 2017

Fiddle-of-the-week: await WebRTC in Firefox 52

Contributed by Jan-Ivar Bruaroey,

This isn’t a post about a new WebRTC feature. Rather, we’ll explore the new async/await JavaScript syntax in the just-released Firefox 52 and Chrome! Two new keywords let us write asynchronous code the same way we’d write synchronous code. WebRTC APIs, as you’re probably aware, are quite asynchronous. Luckily they support promises – a requirement to use this new syntax – and it just works! I’ve always found callbacks and even monadic promise-chains hard to follow, but now we can write short, yet meaningful code that gets stuff done. (more…)

March 2, 2017

Firefox’s audio backend

Contributed by,

Let us talk about Firefox’s backend audio system. Every sound you hear while you are watching a video or using a WebRTC service comes from the backend audio library. The role of the library is to communicate with audio devices and to provide audio input and/or output. This library is called ‘cubeb’ and it is part of the Firefox source code.


February 27, 2017

Fiddle-of-the-week: Downscale video in RTCPeerConnection

Contributed by Jan-Ivar Bruaroey,

More of last year’s new laptop cameras have few or no low-resolution modes. These reveal a big difference in how Chrome and Firefox implement the getUserMedia camera API. Whereas Chrome re-scales video to whatever constraints you put in, Firefox does not, instead guaranteeing the closest native resolution. Both are technically within spec. That said, the elaborate constraints language offered by getUserMedia, with minmax ranges and ideal values, was clearly designed for resolution discovery; it is overkill for setting a target resolution override.

But sending large resolution video over a peer connection is expensive. Here’s how you downscale it in Firefox (more…)

February 25, 2017

Fiddle-of-the-week: Spec-compliant getStats

Contributed by Jan-Ivar Bruaroey,

Firefox has supported getStats to the spec for a couple of years now, and Chrome Canary finally has a spec-compliant version, so it’s a good time to check in how to write code that (soon!) will work across browsers.

Unfortunately, the specification has changed several times over the years, even breaking Firefox. Here’s how to tell whether your getStats code is up to spec as of 2017 (more…)

February 22, 2017

DTMF available in Firefox 52

Contributed by,

Firefox 52 now supports DTMF. Try it out now in webrtc samples! This means you no longer need workarounds to accomplish this.

The spec JavaScript API we’ve implemented is newer and different from what is in Chrome at the moment. Therefore, we recommend using adapter.js until Chrome updates their API. That way, you only deal with one API that works on all browsers.

In the new API, the dtmf sender already exists, so you don’t create it. It hangs off of the RTCRtpSender associated with a track. So instead of writing the following (more…)

November 28, 2016

Testing WebRTC on Android

Contributed by,

Testing WebRTC is challenging. It is inherently timeout based. Tests that work well locally often fail when run in automation. At Mozilla, we run the majority of our Android tests on ARM emulators on AWS instances. In case anyone is wondering, this is very slow. We’ve recently started running our tests on actual phones as well as on emulators. Running faster should lead to fewer performance related intermittent failures.


November 23, 2016

Share browser windows and entire screen only with sites you trust.

Contributed by Jan-Ivar Bruaroey,

Screen-sharing is a powerful new web feature that lets you share what’s on your computer screen with a web site. This can be extremely useful. Imagine co-browsing with a friend, or having a service technician remotely diagnose a problem on your computer. But at the same time, it carries significant security and privacy risks.

Certain windows are riskier to share than others. Firefox will warn you not to share browser windows, or even your entire screen when a browser window is present on it, unless you trust the web site. The reasons for this are technical, but boil down to this: (more…)

November 23, 2016

Enhancing webcams with canvas.captureStream()

Contributed by Sigve Sebastian Farstad, Software Engineer in the Strategic Engineering team in Telenor Digital.

A really enhanced webcam stream!

Recently, HTMLCanvasElement.captureStream() was implemented in browsers. This allows you to expose the contents of a HTML5 canvas as a MediaStream to be consumed by applications. This is the same base MediaStream type that getUserMedia returns, which is what websites use to get access to your webcam.

The first question that comes to mind is, of course: “Is it possible to intercept calls to getUserMedia, get a hold of the webcam MediaStream, enhance it by rendering it into a canvas and doing some post-processing, then transparently returning the canvas’ MediaStream?”

As it turns out, the answer is (more…)

November 17, 2016

ICE connected or not…

Contributed by Nils Ohlmeier, Hacking on real time communications since 2002


In Firefox 49 we released support for ICE Consent Freshness as a first way to detect that an ICE transport is no longer working. What does ICE Consent Refresh do, you ask?

With plain ICE

Lets start with what we had before. Without Consent Refresh the ICE standard requires us to send so called Keepalives to keep the ports in the NAT open. But these Keepalives had a couple of issues. First of all the Keepalives only send traffic. They do not require a response nor do they expect any response. So as the sender, you basically try your best to keep the NAT ports open, but you have no idea if it works or not.

Adding Consent timeouts

To improve that experience, in Firefox 49 we released support for ICE Consent Freshness. With (more…)

November 2, 2016

Welcome to Advancing WebRTC…

Contributed by Maire Reavy, Maire is the engineering manager for Mozilla’s WebRTC team.

Advancing WebRTC is a new blog site run by the Firefox WebRTC team, which includes full-time employees as well as contributors from the open source community and from industry. You can expect to find everything you want to know about what we’re working on and why we’re working on it on this site. We’ll show off our new demos and preview new features. We also welcome “guest” posts from WebRTC web developers who have relevant information about things they’re doing with WebRTC.

Future posts will include information about our Roadmap going into 2017, including how we set priorities and how developers can influence our priorities and roadmap. We’ll also post about changes happening in the specs, and how and when those will be reflected in Firefox, and we plan to have a “fiddle of the week” feature showing off some aspect of WebRTC in a small amount of code.

As engineering manager, I welcome feedback either directly to me or to the team. Our newsgroup is (also available as the dev-media mailing list), and we hang out on IRC in #media. You can ask us a question in real-time on IRC any time you wish.

Our goal is to make WebRTC in Firefox work well for every developer and to make WebRTC the best solution for real-time audio and video communication. You can help us by testing Firefox (especially Nightly and Developer Edition), giving us feedback on how Firefox is working for you, what we can do better, what’s missing, and contributing patches for the fixes and features you need or really want that we haven’t gotten to yet.

Firefox is the browser for the everyone on the web. We want it to be your browser and we’d appreciate your help in making it (and WebRTC) awesome.