Mozilla

Firefox Development Highlights – H.264 & MP3 support on Windows, scoped stylesheets + more

Time for the first look this year into the latest developments with Firefox. This is part of our Bleeding Edge and Firefox Development Highlights series, and most examples only work in Firefox Nightly (and could be subject to change).

H.264 & MP3 support on Windows

Firefox for Android and Firefox OS already support H.264 and MP3. We are also working on bringing these formats to Firefox Desktop. On Windows 7 and above, you can already test it by turning on the preference media.windows-media-foundation.enabled in about:config. Decoding is done on the OS side (no decoder included in Firefox source code, not like WebM or Ogg Theora). For Linux and Mac, work is in progress.

The new Downloads panel has been enabled

We have now enabled the new Downloads panel:

Scoped style attribute

It’s now possible to define scoped style elements. Usually, when we write a stylesheet, we use <style>...</style>, and CSS code is applied to the whole document. If the <style> tag is nested inside a node (let’s say a <div>), and the <style> tag includes the scoped attribute (<style scoped>), then the CSS code will apply only to a subtree of the document, starting with the parent node of the <style> element. The root of the subtree can also be referred via the :scope pseudo-class.

Demo

Scoped style demo support on JS Bin.

Our friends over at HTML5Rocks have also written about it in A New Experimental Feature: scoped stylesheets.

@supports and CSS.supports

In Firefox 17, we shipped the @supports CSS at-rule. This lets you define specific CSS code only if some features are supported. For example:

@supports not (display: flex) {
  /* If flex box model is not supported, we use a different layout */
  #main {
      width: 90%;
  }
}

In Firefox 20, it’s now possible to do the same thing, but within JavaScript:

if (CSS.supports("display", "flex")) {
  // do something relying on flexbox
}

34 comments

Comments are now closed.

  1. Skoua wrote on January 23rd, 2013 at 09:06:

    Nice!
    So you guys decided to support H264 by relying on the OS?

    1. Robert Nyman wrote on January 23rd, 2013 at 13:23:

      Yep!

      1. pd wrote on February 13th, 2013 at 09:50:

        and for us XP users?

        1. Robert Nyman [Editor] wrote on February 14th, 2013 at 05:39:

          It’s being discussed in the bug. Hopefully there will be XP support as well.

          1. pd wrote on February 20th, 2013 at 04:30:

            Thanks for the link.

      2. AK wrote on April 8th, 2013 at 19:47:

        And for Mac users.

  2. Fawad Hassan wrote on January 23rd, 2013 at 10:48:

    Is @supports standard feature or browser specific?

    1. Robert Nyman wrote on January 23rd, 2013 at 13:38:

      Standard, and I believe it matches the supports(method) in the specification.

  3. Dan Forman wrote on January 23rd, 2013 at 14:16:

    Hey, please enable native codec support on XP and Vista!

    1. Robert Nyman wrote on January 23rd, 2013 at 14:51:

      And with that, you mean built-in support in Firefox? There are a number of licensing and other issues with that, hence going with the decision for now to go with what’s available in the operating system.

      1. Dan Forman wrote on January 23rd, 2013 at 15:26:

        No, I mean just enable playback using native codecs installed on the system, just as with Windows 7. If users (or some app) installs them, just use them, no reason not to..

        1. Robert Nyman wrote on January 23rd, 2013 at 15:49:

          Ah, ok. Well, I believe that is what will happen for other OS versions (then of course, there might be some issues related to that, but still).

  4. Arno wrote on January 25th, 2013 at 08:54:

    What container formats will this enable? MPEG-TS i.e., live streaming too?

    1. Robert Nyman [Editor] wrote on January 25th, 2013 at 14:26:

      As I understand it, streaming should be supported, but I’m not sure about container formats. There’s a lot of info if you are interested in the implementation bug for it.

      1. Arno wrote on February 1st, 2013 at 05:50:

        No MPEG-TS, which means no “commercial” live streaming basically :o(

        Timestamp: 01/02/2013 13:46:26
        Warning: HTTP “Content-Type” of “video/mp2t” is not supported. Load of media resource http://127.0.0.1:8192/e5a12c7ad2d8fab33c699d1e198d66f79fa610c3.-1 failed.

        I’ll report on the bug page.

        1. Robert Nyman [Editor] wrote on February 1st, 2013 at 06:40:

          Right, too bad. And thanks, please do!

  5. John A. Bilicki III wrote on February 1st, 2013 at 05:29:

    If Internet Explorer and Safari refuse to support standard free and open codecs why the hell is Mozilla working to implement license burdened codecs in Firefox?

    #massive_fail

    1. Robert Nyman [Editor] wrote on February 1st, 2013 at 06:43:

      To begin with, we don’t implement the codec support, we utilize what’s available in the OS. When it comes to the reasoning, please read Video, Mobile, and the Open Web.

      Firefox is basically the only major web browser NOT supporting H.264, and unfortunately we don’t have enough leverage to make all the other web browsers and major video service providers change.

      1. John A. Bilicki III wrote on February 1st, 2013 at 06:53:

        According to my statistics for December 2012 78.57% of my visitors have browsers that support free and open codecs…
        http://www.jabcreations.com/blog/december-2012-browser-market-share

        …and unlike any other statistics I’ve ever seen mine are based on DOM detection, not user agents.

        A standard can never be charged, licensed or in any way be used to gain money otherwise it’s not a standard, period.

        1. Robert Nyman [Editor] wrote on February 1st, 2013 at 07:03:

          That’s great for you. But that doesn’t necessarily mean that that a) applies to all web sites out there, and b) that the most popular video services will support open formats.

          I don’t see this as a standard, more of a de-facto video format as of right now.

  6. AK wrote on February 10th, 2013 at 00:01:

    When is it coming to OSX?

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

      I can’t say more about the timing for that at the moment.

  7. Matt wrote on February 20th, 2013 at 14:20:

    Does anyone know if the h.264 support applies to webRTC conferences too?

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

      No, WebRTC is based on the VP8 codec.

  8. MG wrote on March 9th, 2013 at 23:30:

    I’ve seen all the google about H.264 discussion on firefox that firefox has it bla bla bla, … … …

    more than 100 pages of thios crap and non of how to install it on it

    HOW DA FAK DO I GET IT ON MY FIREFOX

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

      It’s described in the second paragraph in this article. Only supported in Firefox Nightly on Windows at the moment for desktop web browsers, and Firefox on Android.

  9. MG wrote on March 11th, 2013 at 11:30:

    oh crap I need to download new firefox than

    and again to reconfigure all the stuff like tabs and stuff

    ok thanks

  10. Bhaavan Merchant wrote on March 21st, 2013 at 00:56:

    And Linux support? I do have the underlying codecs already, I just need firefox to use them, and make it a plugin free world.

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

      As is mentioned in the post, Linux support is a work in progress.

  11. kringel wrote on March 23rd, 2013 at 22:37:

    Dear Mozilla,

    please add something like media.linux-libavcodec-extra.enabled

    Many browsers like Midori, Qupzilla, Chromium take advantes of the libav*(-extra) packages if they are installed. It would be up to the user to have these packages installed from the contrib/non-free/universe package repositories.

    If Firefox can take advantage of codecs on a Windows system, why not on Linux? I hope it’s only “not yet”, because missing H264 support drives me to use Chromium/Chrome. I also hope for a brighter future with VP9.

    Packages: libavcodec-extra-5*, libavdevice-extra-5*, libavfilter-extra-*, libavformat-extra-5*, libavutil-extra-5*, libpostproc-extra-5*, libswscale-extra-*

  12. kringel wrote on March 23rd, 2013 at 22:45:

    Oh, great to see Linux support is also on its way. Thanks! Really looking forward to this. And I hope for the simple use of the libavcodec-* packages, no Gstreamer.

  13. nullability wrote on April 3rd, 2013 at 12:12:

    Tried this out in Firefox 20.0 (release) and it’s pretty slick. When will it be enabled by default?

    1. Robert Nyman [Editor] wrote on April 4th, 2013 at 03:34:

      Not sure, it’s being evaluated.

  14. AK wrote on April 8th, 2013 at 19:47:

    H.264 on Mac.

    20 came and went away.

    Shit! Shit! Shit!

    Was I better off with Chrome? Well, Ghostery and ABP are there too.

Comments are closed for this article.