Player configuration

This guide will focus on streamlining setting up and optimizing the configuration of the Web SDK by using the PlayerConfigBuilder. By using this builder, you can simplify the process of generating the right configuration based on platform best practices and a convenient fluent API.

Getting started

The example is pretty basic and a default config with your player key by using the PlayerConfigBuilder.

import { Player, util } from 'bitmovin-player';

const config = new util.PlayerConfigBuilder("MY-PLAYER-KEY")
  .optimizeForPlatform()
  .build();

const player = new Player(document.getElementById('container-id'), config);
const config = new bitmovin.player.util.PlayerConfigBuilder("MY-PLAYER-KEY")
  .optimizeForPlatform()
  .build();

var player = new bitmovin.player.Player(document.getElementById("container-id"), config);

After the configuration has been built you can change and manipulate the config to your liking. The following config will for example configure the player to start muted autoplay.

const config = new util.PlayerConfigBuilder("MY-PLAYER-KEY")
  .build();

config.playback = {
  muted: true,
  autoplay: true
}  

const player = new Player(document.getElementById('container-id'), config);

After this basic example lets explore some more functions the PlayerConfigBuilder offers.

Platform optimization

The PlayerConfigBuilder offers a method to optimize your configuration for a specific platform. It will apply some known best practices for certain platforms such as Tizen or WebOs. These optimisations include changes to parameters like buffer level or specific tweaks based on Bitmovin’s extensive experience with these devices. After the config is generated you can also change it again and tailor the configuration to your needs.

import { Player, util } from 'bitmovin-player';

const config = new util.PlayerConfigBuilder("MY-PLAYER-KEY")
  .optimizeForPlatform({ appId: "my.tv-app.id" })
  .build();

const player = new Player(document.getElementById('container-id'), config);
const config = new bitmovin.player.util.PlayerConfigBuilder("MY-PLAYER-KEY")
  .optimizeForPlatform({ appId: "my.tv-app.id" })
  .build();

var player = new bitmovin.player.Player(document.getElementById("container-id"), config);