Mozilla

WebRTC enabled, H.264/MP3 support in Win 7 on by default, Metro UI for Windows 8 + more – Firefox Development Highlights

Time again for looking at the latest progress with Firefox. These posts are part of our Bleeding Edge and Firefox Development Highlights series – take note that most examples only work in Firefox Nightly (and could be subject to change).

WebRTC enabled by default

Previously, you needed to go to about:config in Firefox and set the media.peerconnection.enabled option to true, but now it’s enabled by default. This is a huge step forward, to be able to run WebRTC directly in a web browser without it needing any special settings or configuration.

For more details behind this decision, please read Pref on WebRTC by default.

Want to get started with WebRTC? Then we recommend our article Cross-browser camera capture with getUserMedia/WebRTC.

Metro UI

The new Firefox User Interface for Windows 8 has landed (if you had Firefox Nightly as your default browser, reset that permission to see the new UI).

There are more screenshots available too.

H.264 & MP3 support enabled by default in Windows 7

We talked about H.264 & MP3 support before, and now that support is activated by default.

We are still working on supporting Mac OS X and Linux.

WebAudio API progress

We are working on implementing the WebAudio API, and the first parts of support has just started appearing.

It’s available in about:config in the media.webaudio.enabled preference – set it to true to enable it and be able to access things such as AudioContext.decodeAudioData.

Crypto API: window.crypto.getRandomValues

If you provide an integer-based TypedArray (i.e. Int8Array, Uint8Array, Int16Array, Uint16Array, Int32Array, or Uint32Array), window.crypto.getRandomValues is going fill the array with cryptographically random numbers:

/* assuming that window.crypto.getRandomValues is available */
 
var array = new Uint32Array(10);
window.crypto.getRandomValues(array);
 
console.log("Your lucky numbers:");
for (var i = 0; i < array.length; i++) {
    console.log(array[i]);
}

canvas: ctx.isPointInStroke

This has been uplifted to Firefox 19 Beta.

From the WHATWG mailing list:

“We have recently implemented isPointInStroke(x,y) in Firefox (https://bugzilla.mozilla.org/show_bug.cgi?id=803124). This is a parallel to isPointInPath(x,y) and returns true if the point is inside the area contained by the stroking of a path.”

JavaScript: Math.imul

Math.imul allows for fast 32-bit integer multiplication with C-like semantics. This feature is useful for projects like Emscripten.

Polyfill:

function imul(a, b) {
    var ah  = (a >>> 16) & 0xffff;
    var al = a & 0xffff;
    var bh  = (b >>> 16) & 0xffff;
    var bl = b & 0xffff;
    // the shift by 0 fixes the sign on the high part
    return (al * bl) + (((ah * bl + al * bh) << 16) >>> 0);
}

21 comments

Comments are now closed.

  1. Sam Tobin-Hochstadt wrote on February 20th, 2013 at 06:01:

    The polyfill for Math.imul is corrupted by entity references instead of > signs.

    1. Robert Nyman [Editor] wrote on February 20th, 2013 at 07:09:

      Thanks! Fixed now.

      1. Nate wrote on February 27th, 2013 at 02:29:

        You have the same problem with the < sign in the for loop of the random number example.

        1. Robert Nyman [Editor] wrote on February 27th, 2013 at 07:37:

          Thanks!

  2. Great wrote on February 20th, 2013 at 18:12:

    Great! I like what Mozilla & friends achieved in this past years and WebRTC is a milestone for sure in many aspects.

    The thing i don’t like that much is support for H.264 & MP3 because this means that open formats could win for things like WebRTC but majority of video/audio content on the web will still be available (only) in H.264 & MP3 and that is a shame.

    But thanks for all your hard work and best wishes for the future!

    1. Robert Nyman [Editor] wrote on February 21st, 2013 at 01:28:

      It’s a valid point. We did what we good with particularly video – as outlined in Video, Mobile, and the Open Web – but currently it’s the way it is.

  3. Adam Ullman wrote on February 20th, 2013 at 18:25:

    I assume this means that WebRTC has just been enabled by default in the current Nightly build of Firefox (21). What version of Firefox can we expect to have this preference turned on by default once it reaches production? Still version 21?

    1. Robert Nyman [Editor] wrote on February 21st, 2013 at 01:30:

      Yes, that’s what it means. And yes, if all works out etc, it should be on in Firefox 21.

  4. Benz wrote on February 21st, 2013 at 08:51:

    Does that mean windows 7 only or windows 7 and above (so win8 as well)?

    1. Robert Nyman [Editor] wrote on February 21st, 2013 at 13:25:

      To my knowledge, that should mean Windows 8 as well.

      1. bitinn wrote on April 9th, 2013 at 21:40:

        I think this article should be updated as Firefox 20 (stable release) on Windows 8 still has media.windows-media-foundation.enabled set to false, I assume the same for Windows 7.

        1. Robert Nyman [Editor] wrote on April 10th, 2013 at 04:06:

          I understand the sentiment, but it’s clearly stated in the beginning of these blog posts that these are features implemented in Nightly versions for testing and are subject to change.

  5. T-Bone wrote on February 24th, 2013 at 13:12:

    Hello,

    I tried to play a sound with the web audio api but it doesnt work.

    window.addEventListener(‘load’, init, false);
    function init() {
    loadSound(“sound.ogg”);
    }

    var context = new AudioContext();
    var soundBuffer = null;

    function loadSound(url) {
    var request = new XMLHttpRequest();
    request.open(‘GET’, url, true);
    request.responseType = ‘arraybuffer';

    // Decode asynchronously
    request.onload = function() {
    context.decodeAudioData(request.response, function(buffer) {
    soundBuffer = buffer;

    AudioBufferSourceNode = context.createBufferSource();
    AudioBufferSourceNode.buffer = soundBuffer;
    AudioBufferSourceNode.connect(context.destination);
    AudioBufferSourceNode.start(0);

    }, function(e){ console.log(e)});
    }
    request.send();
    }

    It works fine in Chrome ( with webkitAudioContext).

    Why does the sound never starts to play?
    The sound file is loaded.

    1. Robert Nyman [Editor] wrote on February 26th, 2013 at 16:32:

      Thanks for the feedback. Please file a bug since it’s early days, and to give the engineers working on it a chance to take a look.

  6. Dark Shikari wrote on February 26th, 2013 at 14:33:

    Since H.264 and WebRTC are now both enabled by default, why not support H.264 in WebRTC calls?

    1. Robert Nyman [Editor] wrote on February 26th, 2013 at 16:49:

      Codec support for files and streaming are two very different things.

  7. mikecao wrote on March 10th, 2013 at 22:24:

    I have big issue as follows.
    Firefox said it has supported the webrtc on its nightly version, so I want to try it, but the code failed. I can show the local view, but not get remote stream. I use default stun server “pc_config = {“iceServers”: [{“url”: “stun:23.21.150.121:3478″}]};”. And found there is no response from stun server to the bind message. And the peerconnection’s state is always undefined.
    Here are the SDP info.
    send local sdp info to peer:{“type”:”offer”,”sdp”:”v=0rno=Mozilla-SIPUA 12384 0 IN IP4 0.0.0.0rns=SIP Callrnt=0 0rna=ice-ufrag:7e451024rna=ice-pwd:5475363d54056aa6945e62e5b18a4669rna=fingerprint:sha-256 FB:B8:50:2E:DE:94:3F:4A:BB:43:D7:B0:69:8B:1E:86:7B:CC:6A:32:F6:42:FD:79:C7:A1:C7:3D:76:0F:32:AErnm=audio 3205 RTP/SAVPF 109 0 8 101rnc=IN IP4 135.252.33.50rna=rtpmap:109 opus/48000/2rna=ptime:20rna=rtpmap:0 PCMU/8000rna=rtpmap:8 PCMA/8000rna=rtpmap:101 telephone-event/8000rna=fmtp:101 0-15rna=sendrecvrna=candidate:0 1 UDP 2111832319 135.252.33.50 3205 typ hostrna=candidate:0 2 UDP 2111832318 135.252.33.50 3206 typ hostrnm=video 3207 RTP/SAVPF 120rnc=IN IP4 135.252.33.50rna=rtpmap:120 VP8/90000rna=sendrecvrna=candidate:0 1 UDP 2111832319 135.252.33.50 3207 typ hostrna=candidate:0 2 UDP 2111832318 135.252.33.50 3208 typ hostrnm=application 3209 SCTP/DTLS 5000 rnc=IN IP4 135.252.33.50rna=fmtp:5000 protocol=webrtc-datachannel;streams=16rna=sendrecvrna=candidate:0 1 UDP 2111832319 135.252.33.50 3209 typ hostrna=candidate:0 2 UDP 2111832318 135.252.33.50 3210 typ hostrn”}

    incomingSignalingMessage Peer SDP:
    {“type”:”answer”,”sdp”:”v=0rno=Mozilla-SIPUA 20697 0 IN IP4 0.0.0.0rns=SIP Callrnt=0 0rna=ice-ufrag:ea0eceabrna=ice-pwd:e293eaad085cbe8b06e3d68a75b4b430rna=fingerprint:sha-256 BF:69:96:9A:D6:0B:A4:61:61:F9:62:6E:A7:38:76:29:3B:BA:6D:E8:D2:93:07:62:FA:E3:F9:92:CE:E0:50:C3rnm=audio 1616 RTP/SAVPF 109 101rnc=IN IP4 135.252.33.103rna=rtpmap:109 opus/48000/2rna=ptime:20rna=rtpmap:101 telephone-event/8000rna=fmtp:101 0-15rna=sendrecvrna=candidate:0 1 UDP 2111832319 135.252.33.103 1616 typ hostrna=candidate:0 2 UDP 2111832318 135.252.33.103 1617 typ hostrnm=video 1618 RTP/SAVPF 120rnc=IN IP4 135.252.33.103rna=rtpmap:120 VP8/90000rna=sendrecvrna=candidate:0 1 UDP 2111832319 135.252.33.103 1618 typ hostrna=candidate:0 2 UDP 2111832318 135.252.33.103 1619 typ hostrnm=application 1620 SCTP/DTLS 5001 rnc=IN IP4 135.252.33.103rna=sendrecvrna=candidate:0 1 UDP 2111832319 135.252.33.103 1620 typ hostrna=candidate:0 2 UDP 2111832318 135.252.33.103 1621 typ hostrn”}

    Could any expert give me some suggestion?

    1. Robert Nyman [Editor] wrote on March 11th, 2013 at 07:35:

      Please file a bug about it, thanks.

      1. mikecao wrote on March 13th, 2013 at 02:01:

        how to file it? I think it is stun issue. And have you ever make video call using firefox nightly? If so, could you tell me which version you used?

        1. Robert Nyman [Editor] wrote on March 13th, 2013 at 02:48:

          You need to go to the above link, click File a bug (create an account if you don’t have one) and list all the information you have.

          It should work well in the latest Firefox Nightly.

          1. mikecao wrote on March 13th, 2013 at 18:56:

            Thanks for your help.
            I doubt it is STUN issue because onIceCandidate (peerConn.onicecandidate = onIceCandidate) is not called.

Comments are closed for this article.