What does the Polyfill module do?
What is the Polyfill module and do I need it?
The Polyfill module for the Bitmovin Web SDK patches missing JavaScript features in older browsers, embedded WebViews, and legacy Smart TV environments so that Bitmovin Player can run without requiring a separate integration per target. If your support matrix includes IE11, early Edge, 2015-era Smart TVs, or any environment that does not fully implement ES6+, you need this module.
If you are targeting only modern evergreen browsers, the module is safe to include — the installer checks each feature before applying a shim and skips anything the browser already supports natively.
How do I load the Polyfill module?
The Polyfill module is included by default in the monolithic player build. If you are using the modular player to optimise your bundle size, register it explicitly via Player.addModule before you instantiate the player — see ModuleName.Polyfill for reference:
import { Player } from 'bitmovin-player';
import polyfill from 'bitmovin-player/modules/bitmovinplayer-polyfill.js';
Player.addModule(polyfill);What does the Polyfill module actually install?
The module installs shims only for features that are absent in the current environment. The covered categories are:
ECMAScript foundations — Promise with Promise.prototype.finally, WeakMap, Map, ArrayBuffer.prototype.slice, and Number.isNaN.
Array helpers — Array.prototype.find, findIndex, includes, and flatMap.
Object utilities — Object.assign, Object.entries, and Object.values.
String utilities — String.prototype.includes, startsWith, and endsWith.
DOM helpers — NodeList.prototype.forEach, Node/Element.children, and a fallback from window.MediaSource to WebKitMediaSource on early Safari builds.
Each shim is installed conditionally, so loading the module in a modern browser has no effect on the globals your application already relies on.
Is it safe to add the module more than once?
Yes. The installer is idempotent — re-adding the module or revisiting a route in a single-page application will not overwrite shims that are already in place.
What order should I register the Polyfill module relative to other modules?
Register the Polyfill module before engine and feature modules so that downstream modules initialise against a fully patched environment.
If you are also using third-party polyfills that target the same globals, load those before Bitmovin's module. The Polyfill module's feature checks will detect an existing implementation and leave it in place.
References
Updated 8 days ago