Chrome 34 Beta: Responsive Images and Unprefixed Web Audio

Thursday, February 27, 2014

Today’s Chrome Beta channel release introduces a new HTML attribute for responsive images and the unprefixed version of the JavaScript Web Audio API. Unless otherwise noted, changes apply to desktop versions of Chrome and Chrome for Android.

The srcset attribute

Today the web is used on laptops, TVs, phones, tablets and other devices with heterogeneous screen sizes and device pixel ratios. Serving the same image resources to all devices can lead to slower page load times, wasted bandwidth and improperly formatted content.

srcset will help resolve this problem by letting Web developers provide multiple resources in varying resolutions for a single image. The browser can then pick the resource that matches the device's capabilities. Here’s an example of the code:

<img alt="A rad wolf." src="pic1x.jpg" srcset="pic1x.jpg 1x, pic2x.jpg 2x, pic4x.jpg 4x">

Note that the src attribute is not needed for browsers that support srcset, but it’s good for backwards compatibility. Kudos to external Blink developer Yoav Weiss for implementing and driving consensus for this feature. Stay tuned for the <picture> element, which will also help web developers with responsive design.

Unprefixed Web Audio

The Web Audio API is a high-level JavaScript API for processing and synthesizing audio in web applications. We shipped the prefixed version of the API a few years ago. Starting with this release, the unprefixed API entry points audioContext and offlineAudioContext will be available in addition to their prefixed counterparts. Legacy methods such as createGainNode and createDelayNode are deprecated.

This brings Chrome’s implementation of Web Audio in alignment with the W3C draft specification and offers compatibility with the Web Audio support in Firefox. Please switch to the unprefixed versions soon, as the prefixed versions are now officially deprecated and will be removed in a future release.

UPDATE April, 9th: Unprefixed Web Audio will ship in Chrome 35, not Chrome 34.

Other web platform changes in this release
If you’ve ever been curious about the usage of HTML and JavaScript features, check out the updated chromestatus.com/metrics, which now shows the percentage of page loads that use certain web platform features.

As always, visit chromestatus.com/features for a complete overview of Chrome’s developer features, and circle +Google Chrome Developers for more frequent updates!

Posted by Raymond Toy, Software Engineer and Audiofile [sic]

Post a Comment