The Stack Archive

WebKit gets lenient on silent videos in web pages – because of animated GIF growth

Tue 26 Jul 2016

The technology behind Apple’s mobile experience will now allow automatic playback of videos on the web – if they have no sound. It’s a move prompted by the growing popularity of the now-ancient animated GIF format, which has never had sound capabilities, but whose terrible bandwidth and performance penalties have been long-forgiven because of its relative simplicity and its distinction from the controversy over autoplay video streams.

The development team for the primary web-rendering engine used by Apple’s mobile operating system have been relaxing constrictions on autoplay video for some time, despite growing public ire at the importunity and bandwidth implications – particularly in the mobile sector, where the high costs of data and widespread capping are seen to have made autoplay video a liability.

From iOS8 onward Safari began to honour the preload=”metadata” attribute, which allowed video and audio content to buffer prior to user interaction. Before this, a user gesture was required in order to engage the video content in any way.

In iOS10, video is being allowed directly past this restriction, with the caveat that the content in the <video autoplay> tag must contain no audio track.

And developers/marketers, they’re way ahead of you: if an audio track becomes appended to the video later, it will stop playing.

Additionally hiding the video element, for instance in a transparent DIV or by other popular means of pre-buffering/rendering, will not work, as the video element will only become active when CSS settings make it visible to the user, and the video is apparent in the Document Object Model (DOM) of the web page.

However, video elements will not need to be currently visible in the viewport (i.e. the user hasn’t scrolled down that far yet) in order to become active.

Straight video elements in themselves may still get autoplayed without a user gesture if the video either contains no audio track or the audio is set to ‘muted’ – a change which affects user experience, but not bandwidth consumption.

Additionally, on the iPhone, video tracks with a <video playsinline> setting will no longer be forced into full screen mode during playback, opening up possibilities to employ video content within a canvas.

On iOS 10 video embedding can use animated GIFs as a fall-back when video stream formats are not supported.

In a post at the WebKit site, a portal for the open source rendering engine behind Apple’s Safari browser, Apple software engineer Jer Noble explains:

‘It turns out that people these days really like GIFs. But the GIF format turns out to be a very expensive way to encode animated images when compared to a modern video codec like H.264. We’ve found that GIFs can be up to twelve times as expensive in bandwidth and twice as expensive in energy use. It’s so expensive that many of the largest GIF providers have been moving away from GIFs and toward the <video> element. Since most of these GIFs started out their lives as video clips, were converted into animated GIFs, and were again converted back to video clips, you might say that the circle is complete.’

Only five or six years ago the animated GIF format still retained its Web 1.0 stigma, with its later resurgence fuelled by the rise of Tumblr, yet surviving the social network’s decline in popularity.

Tags:

Apple developers iOS news
Send us a correction about this article Send us a news tip

Do NOT follow this link or you will be banned from the site!