This article is more than 1 year old

Beyond video to interactive, personalised content: BBC is experimenting with rebuilding its iPlayer in WebAssembly

Something Wasm this way comes

QCON The BBC is researching a rebuild of its iPlayer catch-up service client in WebAssembly.

Speaking at the QCon Plus developer conference under way online this week, BBC R&D software engineer Tim Pearce said: "We've used WebAssembly to... build an experimental version of iPlayer which can playback future experiences, and I'll also introduce our plans to use WebAssembly outside the browser throughout our technology stack for delivering universal access to audiences."

Pearce said that "universal access" is a part of the BBC's duty as a public service broadcaster and means ensuring that "every audience member can access every experience, regardless of what device they have at home... they might have an old smartphone or smart TV."

Despite these extensive plans, Pearce said that it is "very early stage research in applying WebAssembly to assault the challenges that we face. However, we believe WebAssembly will be an integral part of the BBC broadcast chain in the future."

Part of the challenge is that the BBC intends to move beyond mere video to a thing it calls object-based media, which "allows the content of programmes to change according to the requirements of each individual audience member." It is called object-based because it attaches semantic tags to elements within the content. Features might include replacing a speaking presenter with a signing one, automatic editing to make programmes shorter or longer, personalising content such as focusing on a favourite football team, as well as some features that may disturb privacy advocates such as weather forecasting that "knows where I'm planning to go in the next week."

"We have created a variety of content experiences which demonstrate the advantages of object-based media, including augmented and virtual reality, branching narrative stories and multi-device immersive audio and video. Many of these future experiences can be viewed on the BBC Taster website, but not yet via iPlayer," said Pearce.

Currently, Pearce said, iPlayer has "multiple codebases for different platforms, iOS, Android, responsive web, smart TVs, and many more legacy codebases... the client application is written in completely different platform-specific technologies and programming languages."

A diagram showing how content compiled to wasm could be hosted by a universal iPlayer

A diagram showing how content compiled to Wasm could be hosted by a universal iPlayer (pic: BBC)

A "single service player" (SSP) would be capable of both traditional video and more game-like experiences. "We've implemented an object based media storage engine which can playback... interactive experiences previously only available as a web application," said Pearce. "And we've started experimenting with remote streaming, running high-end graphical experiences in the cloud, sending user inputs across the network, and streaming the resulting scene as video." This approach would potentially avoid the need for users to have high-end GPUs.

WebAssembly allowed the BBC to take its SSP written in C and compile for the web, via the Emscripten toolchain, which lets developers add WebAssembly as a target using the LLVM compiler project. The SSP renders on the web in "multiple ways," Pearce said, using browser capabilities such as media source extensions, the JavaScript Fetch API, WebSockets, WebGL, and Canvas2D. The project also uses SDL (Simple DirectMedia Layer) for access to multimedia APIs, which is supported by Emscripten.

"The Emscripten toolchain generates JavaScript glue code to bootstrap our WebAssembly module and give us access to these web API's," he explained. "One of the advantages in using WebAssembly is that the SSP looks identical across all browsers and is identical to the native application, because all of the user interface components, layout and business logic is in the WebAssembly module." This avoids differences in things like CSS implementations between browsers.

The BBC researchers then decided to investigate using WebAssembly outside the browser. "We thought, could we package our launcher, application and individual content experiences as WebAssembly modules that could not just work on the web but in native applications?" said Pearce. The solution they found is to "embed a WebAssembly runtime in a new C++ application." Specifically, he said, "we are using the Wasmtime runtime from the Bytecode Alliance." This is written in Rust and more details are here.

Why WebAssembly rather than one of the myriad other ways to do cross-platform code? One aspect of this is that the BBC has chosen to do its own UI, bypassing the need for a cross-platform GUI framework. "We want to be able to target WebAssembly as a universal binary. The key benefit is the sandboxing that it provides," said Pearce. He sees this as a route to a standard for content which can be hosted in iPlayer. "There are standards for broadcasts like the framerate and what codec it's in, and things like that, and we're seeing WebAssembly as a way of achieving that for interactive content," he said. "The initial design of WebAssembly does mean that it lends itself very nicely to being that kind of plug-in model."

Pearce noted that the BBC already has a Global Experience Language (GEL) which is intended to provide a design standard for content authors. He also referenced a post from earlier this year which gives further details on iPlayer in WebAssembly. ®

More about

More about

More about

TIP US OFF

Send us news


Other stories you might like