Sunday, 23 December 2012

HTML5 video playbackRate and Ogg chaining support landed in Firefox

Paul Adenot has recently landed patches in Firefox to enable the playbackRate attribute on HTML5 <audio> and <video> elements.

This is a cool feature that I've been looking forward to for a while; it means users can speed up playback of videos (and audio) so that you can for example watch presentations sped up and only slow down for the interesting bits. Currently Firefox's <video> controls don't have support for playbackRate, but it is accessible from JavaScript, and hopefully we'll get support added to our built-in controls soon.

Paul has also finally landed support for Ogg chaining. This has been strongly desired for quite some time by community members, and the final patch also had contributions from "oneman" (David Richards), who also was a strong advocate for this feature.

We decided to reduce the scope of our chaining implementation in order to make it easier and quicker to implement. We targeted the features most desired by internet radio providers, and so we only support chaining in Ogg Vorbis and Opus audio files and we disable seeking in chained files.

Thanks Paul and David for working on these features!

Thursday, 20 December 2012

Experimental H.264,AAC, and MP3 support in Firefox Nightly builds on Windows 7 and later

As the Internet has already discovered, recently I landed patches to add a Windows Media Foundation playback backend for Firefox. This is preff'd off by default.

This allows playback of H.264 video and AAC audio in MP4 and M4A files, and MP3 audio files in HTML5 <audio> and <video> elements in Firefox on Windows 7 and later.

To test MP4/MP3 playback, download the latest Firefox Nightly Build, and toggle the pref "media.windows-media-foundation.enabled" to "true" in about:config.

There are a few bugs that I'm aware of, which is why this landed preff'd off by default, but if you spot any bugs, please file a bug in Firefox's "Core :: Video/Audio" component.

Thursday, 30 August 2012

Enabling external monitor on Lenovo W530 with Nvidia Discrete Graphics and Ubuntu Linux 12.04

I've recently acquired a Lenovo W530 laptop. It's nice. Running Ubuntu 12.04 and with 32GB of RAM and an SSD it builds Firefox with cold/empty caches in 14 minutes flat, which is pretty good!

It was a trial figuring out how to get the Nvidia graphics card and a second monitor working however. The current Ubuntu stable nvidia-current package doesn't include support for the Quadro K1000M chipset, and the official Nvidia drivers available from Nvidia.com didn't work for me, and left my libGL.so's missing when I uninstalled them.

I eventually figured out the steps to get a compatible Nvidia driver installed and displaying a second monitor:

1. Install the "X Updates" team's PPA, and install the latest Nvidia drivers, which supports the Quadro K1000M. In the terminal enter:
sudo add-apt-repository ppa:ubuntu-x-swat/x-updates
sudo apt-get update
sudo apt-get install nvidia-current
2. Reboot. At the Lenovo BIOS screen press "Enter" to interrupt normal startup, F1 to enter BIOS setup utility. Change Config > Display > Graphics Device to Discrete Graphics. This means the hardware will attempt to use only the Nvidia graphics card, not the Intel integrated graphics. Press F10 to save and boot the computer.

3. Once you've booted up and logged in, to setup multiple monitors you'll need to run nvidia-settings from the terminal as root:
sudo nvidia-settings
Setup your displays in the "X Server Display Configuration" tab (you may need to "Detect Displays" first, and you probably want "TwinView" configuration). Once you've configured your displays, make sure you "Save to X Configuration File". When I saved my config file the path save was blank. If this happens to you, enter: /etc/X11/xorg.conf

3. (Updated 13 October 2012) Once you've booted up and logged in, you can use Ubuntu's "Displays" application to easily configure your secondary displays. Note that if you use nvidia-settings to write an xorg.conf (as I previously suggested) X won't detect when you unplug a monitor, and so when you unplug a monitor X may open windows on the monitor which is no longer connected, i.e. where you can't see them, which can be very inconvenient!

4. To get your hardware brightness keys working (i..e Fn+F8/F9), edit the /etc/X11/xorg.conf file as root:
sudo gedit /etc/X11/xorg.conf 
...and add the following line to the "Device" section for the "Quadro K1000M":
    Option         "RegistryDwords" "EnableBrightnessControl=1"
Log out/log back in and then your brightness keys should work!

4. (Updated 13 October 2012) To get your display brightness keys working (i..e Fn+F8/F9) you need to tell the Nvidia graphics driver to enable the brightness controls.

These days X automatically configures itself, so you can't just edit the xorg.conf file, you instead need to add a section to a file in /usr/share/X11/xorg.conf.d/ and X will include that section in the configuration that it automatically generates.

So to get the screen brightness keys working with your Nvidia graphics card, create a file in the xorg.conf.d directory, e.g:
sudo gedit /usr/share/X11/xorg.conf.d/10-nvidia-brightness.conf

Paste the following into the file:
Section "Device"
    Identifier     "Device0"
    Driver         "nvidia"
    VendorName     "NVIDIA Corporation"
    BoardName      "Quadro K1000M"
    Option         "RegistryDwords" "EnableBrightnessControl=1"
EndSection
Log out and log back in, or reboot, or simply kill X with CTRL+ALT+BACKSPACE, or ALT+PrtSc+K, and your brightness keys should now work!

Caveat: I've only had a second monitor working on my VGA output, I'm looking forward to my mini-DVI adapter arriving so I can have a cripser DVI output. Hopefully that will Just Work....

Update 13 October 2012: a second monitor Just Worked with my mini-DVI adapter. I was able to get two external displays running off a docking station. Possibly the docking station could drive more, I haven't felt the need, three displays is enough for me!

And unfortunately my laptop refuses to boot with Discrete Graphics enabled, the Nvidia driver installed, and with virtualization enhancements enabled in the BIOS. Apparently it is possible with the help of the BumbleBee project however.

Update 13 October 2012: I was able to boot with virtualization enhancements enabled in BIOS if I specified the nox2apic kernel command parameter. I haven't done enough research to figure out whether disabling x2apic is a good idea or not.

Thursday, 26 July 2012

Kindle Touch 3G Review

I purchased a Kindle Touch 3G, and I'm very happy with it.

Pros:
  1. The touch screen is good, but not great. The instructions that came with the Kindle say to turn a page by touching the screen on the right hand side, but I found this unreliable. Often a touch doesn't register, and I'd need to touch several times in order to get a page turn. Swiping also turns the page, and I found this much more reliable. Once I started swiping to turn the page instead of touching, I found the Kindle much more enjoyable to use.
  2. The E-Ink screen is very nice to read text on. It feels nice on the eyes, has good resolution, and being able to resize the text using a pinch action is very handy.
  3. You don't need two hands to read like you do with a traditional book. You can easily, for example, sit and eat breakfast while turning the page occasionally by simply touching the screen.
  4. Books are cheap compared to their physical instantiations, particularly since I live in New Zealand and books are expensive here in general.
  5. You don't need to carry a large number of books around.
  6. I don't mind having the "Special Offers", I don't find them intrusive, and it makes the Kindle cheaper.
  7. I battery life is good, even when using the lighted cover, which draws power from the Kindle's battery. Usually I only need to charge my Kindle about once a month.
  8. 3G is worth it, for me at least. I do a lot of traveling, so having 3G is really handy if I want to buy books while in a hotel. It means I don't need to try to get the WiFi to work. I have found it patchy though. For example I took my Kindle on my recent trip to Canada, and 3G connectivity didn't work in Vancouver Airport, but it did work in my hotel room in Toronto.
  9. Amazon's "Get a book in under 60 seconds" is true; books download fast, even over 3G.
Cons:
  1. Entering text on the touch screen isn't a great experience, and for shopping should really be considered a last resort when you don't have a computer with Internet available. Entering a passcode to unlock the Kindle is annoying too, you need to wait for the keypress to display before continuing, which makes using it laggy. Text input would be better on a Kindle with keyboard (I imagine, I don't own a Kindle with keyboard), but I think that since having a keyboard increases the Kindle's size significantly, I'm glad I purchased the Touch over the keyboarded Kindle. The Kindle Touch is smaller than the Kindle with keyboard, but has exactly the same size screen, and I don't use text input on my Kindle that often. I don't know what text input is like (or if it's even possible) on the entry level Kindle, but I imagine if you only want to buy books on your computer, then you could get by with the standard entry level Kindle.
  2. Technical books don't layout very well, particularly the tables in them, and it seems some of the formatting information can be lost in the process of converting a book to Kindle format.
  3. The range of available books is good, but not all books are available. The most popular books are usually available, but often some older or less common books aren't available. I expect this will improve over time.
  4. It's heavier than most real books. I need two hands to hold it comfortably when reading.
  5. I'm spending more money on books now...
  6. Amazon recommends books that I might like to read. I've found a few books that I've enjoyed this way, but it makes me feel like I'm a consumer.
  7. Region/Zone/country restrictions on content suck. Really.
  8. I'm not interested in audio books, but they keep showing up in the search results. In particular they don't seem to be as region-restricted as text books. I understand that publishers make much more money with audible books, but I'm just not interested in buying them at this stage, and I wish they didn't show up.
I also bought a Kindle Touch Lighted Leather Cover. I'm satisfied with this too, though it was expensive. It does add a bit of bulk to the Kindle however, and it makes it slightly less comfortable to hold. However it feels sturdy, does a good job of protecting my Kindle, and looks stylish.  The light is quite good, and is more than adequate for reading with. The light draws power from the Kindle's battery, and it's a breeze to install your Kindle into the cover. I can't figure out how to get my Kindle out of the cover though!

I'm glad I bought the cover, it makes reading at night and on planes much better, it protects my Kindle, and it doesn't make holding the Kindle too uncomfortable.

In terms of deciding between buying the Kindle Touch, standard Kindle and Kindle with keyboard, it depends... I'm glad that I have the touch screen as a backup keyboard rather than having a physical keyboard which increases the size of my device. However I think you're not worried about the ease of purchasing content directly from your Kindle (i.e. you plan to mostly buy books using your computer via the Amazon.com website) then a standard Kindle would probably be adequate for you.

Overall, I'm happy with my purchase of the Kindle Touch 3G and the Lighted Leather Cover, and I recommend them.





Friday, 13 July 2012

Replacing Lenovo optical drive with second hard drive: The Lenovo adapter is disappointing

I recently ordered a Lenovo Serial ATA Hard Drive Bay Adapter III for my Lenovo T510 laptop. This can hold a hard drive, and replaces the DVD/CD-ROM drive in your laptop. This enables your laptop to run a second hard drive.

I've used my optical drive two, maybe three times since getting the laptop, so swapping it for another hard drive seems like a good trade for me.

The Lenovo drive bay itself works fine, but I'm still disappointed in Lenovo's product.

When installed, the drive bay looks like this:
Lenovo Serial ATA Hard Drive Bay Adapter installed in a Lenovo T510
The problem here is that there's a gap of approximately 3mm (~0.12 inches) between the top of the drive bay and the ceiling of the optical disk cavity. This means the drive bay can wobble vertically, so much so that I feel the need to tape it in place to stop it flopping around. This looks ridiculous.

Secondly, in order to install your hard drive inside the Lenovo drive bay, you need a hard drive cover. This is the metal cover that encases the hard drives shipping in Lenovo laptops. The covers normally have rubber bumpers/rails to stop the drive moving around. You need to take the bumpers off to install your drive into the hard drive bay.

The hard drive covers looks like this:

Lenovo hard drive cover

And with a hard drive in it, the hard drive cover looks like this:

Lenovo hard drive cover encasing a hard drive.

Note the screws. The drive bay has notches which the screws snap into, holding the drive securely inside the drive bay. Possibly the screws are the only important bit here; you probably don't actually need the drive cover to install the drive into the bay, just the screws since they're what hold the drive in place inside the drive bay.

The frustrating thing is that nothing on the Lenovo web site tells you that you need a drive cover to install a drive into the drive bay. My drive bay arrived and I had to loot my old laptop's drive cover in order to install a new drive into my current laptop.

And I also couldn't find the drive covers listed on Lenovo's web site. Presumably if you buy a laptop hard drive from Lenovo they come with this cover, and presumably Lenovo use this as a way to force you to buy all your laptop hard drives directly from Lenovo.

That's the sort of behaviour I'd expect from Apple, not Lenovo.

Thankfully Ann at IT was able to figure out how to order the drive covers separately. Thanks Ann!

Overall, the product was easy to install (once I had a drive cover) and works fine (apart from the wobble) but I'm still disappointed. Next time, I'll try one of newmodeus' Lenovo drive caddies:

Update 22 March 2015: This blog post now has a Russian translation;
Пост доступен на сайте softdroid.net: Замена оптического дисковода вторым жестким диском на Lenovo.

Thursday, 10 May 2012

Improved key input in fullscreen mode plus pointer lock changes

I've landed bug 716107 which removes the "Press ESC to exit fullscreen" warning upon alphanumeric key input in fullscreen mode.

This will mean fullscreen web apps can use the full range of keys without having the annoying warning message pop up every time the user presses an alphanumeric key, i.e. the WASD keys!

In order to make change safe, we altered the security model a bit: now when entering fullscreen we explicitly ask the user to approve/deny entering fullscreen using a modal prompt, something like this:

Fullscreen approval user interface
Fullscreen approval prompt.
The prompt has a "remember decision for $domain.com" checkbox, so if the user trusts the domain they can avoid having to approve fullscreen every time. If the user opts to "remember" an allow fullscreen decision, we'll still show a "$domain.com entered fullscreen, press ESC to exit" warning when entering fullscreen, but it goes away after a few seconds.

Once the user has approved entering fullscreen, we won't show a warning upon alphanumeric key input.

I also landed bug 746885 which makes pointer lock wait until fullscreen has been approved using the new approval UI before granting the pointer lock request. It may take the user several seconds to approve fullscreen, so authors need to be aware that the "mozpointerlockchange" event may come in several seconds after the "mozfullscreenchange" event. Authors shouldn't assume the pointer is locked until after they've received a "mozpointerlockchange" event!

We also changed our spelling to use "fullscreen" rather than "full-screen", since everybody (including the fullscreen draft spec) was spelling it "fullscreen" anyway.

These changes are in Firefox Nightly builds from 9 May 2012 onwards, and will ship in Firefox 15, which is scheduled for release on 28 August 2012.

These changes should greatly improve the experience for HTML5 games using fullscreen and pointer lock!

Monday, 7 May 2012

When you encounter a bug, always file a bug

If you find a bug in Firefox, or any other software for that matter, please please please file a bug! It's completely possible that the developers simply aren't aware of the bug.

The developers may not be aware of the bug because they don't run on the same hardware, operating system, or environment as you, or they may not use the browser the same way as you do.

Even if we already have the bug on file and we mark your bug as a duplicate, at the very least this is allows us to get a coarse feel for how often the bug is encountered in the wild.

If the developers aren't aware of a bug, there's no way they can fix it! Please file bugs!