Tutorial: Polyfills

Polyfills

A polyfill is a bit of code that fills in missing APIs or normalizes variations in APIs. A polyfill allows other pieces of code to expect a single API from the underlying browser.

The Shaka Player uses polyfills to modify, rename, or replace various pieces of browser functionality. Before instantiating the Player, these polyfills should be installed into the JavaScript environment.

Each polyfill has its own class and a static install() method. We suggest that you install all polyfills, since the install method will intelligently detect a browser's capabilities and only patch APIs which need patching. The recommended method is shaka.polyfill.installAll.

Once browsers commonly implement the necessary functionality consistently, some polyfills can be removed to reduce the size of the JavaScript code.

For detailed information on our polyfills, please see: shaka.polyfill