The entry point to the player configuration is the PlayerConfig interface, which is passed into the constructor of the player. There are several ways to do this:

  1. When the full player is loaded from the CDN via <source> tag:
const player = new bitmovin.player.Player(container, config);
  1. Whe the player is loaded from the CDN via https://requirejs.org/|RequireJS:
requirejs(['<cdn_url>'], (bitmovinplayer) => {
const player = new bitmovinplayer.Player(container, config);
});
  1. When the player is imported from NPM:
import { Player } from 'bitmovin-player';
const player = new Player(container, config);

Example configuration:

{
key: 'INSERTPROVIDEDKEYHERE',
playback: {
autoplay: false,
muted: false
},
style: {
width: '90%',
aspectratio: '16/9',
},
events: {
[PlayerEvent.SourceLoaded]: myFunc,
[PlayerEvent.Play]: () => {
// do some awesome stuff
},
[PlayerEvent.Error]: myErrorHandlingFunc
},
tweaks: {
startup_threshold?: 5;
},
advertising: {
adBreaks: [{
tag: {
url: 'http://your.ad.provider/manifest.xml',
type: 'vast',
},
}],
}
}

Example source:

player.load({
dash: 'https://path/to/mpd/file.mpd',
hls: 'https://path/to/hls/playlist/file.m3u8',
smooth: 'https://path/to/manifest/file/Manifest',
progressive: [{
url: 'http://path/to/mp4',
type: 'video/mp4'
}, {
url: 'http://path/to/webm',
type: 'video/webm'
}],
poster: 'images/poster.jpg',
drm: {
widevine: {
LA_URL: 'https://mywidevine.licenseserver.com/'
},
playready: {
LA_URL: 'https://myplayready.licenseserver.com/'
},
access: {
LA_URL: 'https://myaccess.licenseserver.com/',
authToken: 'INSERT-YOUR-BASE64-ENCODED-AUTH-TOKEN'
},
primetime: {
LA_URL: 'https://myprimetime.licenseserver.com/'
},
fairplay: {
LA_URL: 'https://fairplay.licenseserver.com/',
certificateURL: 'https://fairplay.licenseserver.com/certificate-url'
}
}
});
interface PlayerConfig {
    adaptation?: AdaptationPlatformConfig;
    advertising?: AdvertisingConfig;
    analytics?: false | AnalyticsConfig;
    buffer?: BufferConfig;
    cast?: CastConfig;
    events?: EventConfig;
    key: string;
    licensing?: LicensingConfig;
    live?: LiveConfig;
    location?: LocationConfig;
    logs?: LogsConfig;
    network?: NetworkConfig;
    playback?: PlaybackConfig;
    remotecontrol?: GoogleCastRemoteControlConfig | WebSocketRemoteControlConfig;
    storage?: StorageConfig;
    style?: StyleConfig;
    tweaks?: TweaksConfig;
    ui?: any;
}

Properties

Configures the adaptation logic.

advertising?: AdvertisingConfig

Allows you to define which ads you want to display and when you want to display them. In order to play ads on your website, you need to specify an ad config.

analytics?: false | AnalyticsConfig

Bundled Bitmovin Analytics Configuration used to specify metadata and other related info. Can also be used to completely disable Analytics by setting this to false in case the Analytics module is loaded, but Analytics is not desired.

buffer?: BufferConfig

Configures various buffer settings.

cast?: CastConfig

Google Cast configuration.

Deprecated

Use remotecontrol with GoogleCastRemoteControlConfig instead.

events?: EventConfig

A list of callback functions for events. Events can also be dynamically added and removed through on and off.

Example:

events: {
[PlayerEvent.SourceLoaded]: data => {
console.log('version: ' + player.getVersion() + ', SourceLoaded Event data: ', data);
},
[PlayerEvent.Play]: data => {
// do awesome stuff
},
[PlayerEvent.Error]: data => {
console.error('An error occurred:', data);
}
}
key: string

Mandatory. A personal key can be found in the bitmovin portal and should be specified here. Do not forget to enter all your domains (subdomains are included) in your account.

licensing?: LicensingConfig

Licensing configuration.

live?: LiveConfig

Provide parameters specific to live streams.

For better flexibility it is also possible to define a LiveConfig at source level.

location?: LocationConfig

This can be used to specify custom paths to bitmovinplayer-core.min.js, and bitmovinplayer-core.min.css instead of having all files in the same folder.

logs?: LogsConfig

Can be use to fine tune logging of the player.

network?: NetworkConfig

Network configuration.

playback?: PlaybackConfig

Playback config settings.

Remote control configuration (e.g. Chromecast)

Since

7.1

storage?: StorageConfig

Allows configuration of the player's access to the Web Storage API.

Since

v8.91.0

style?: StyleConfig

UX/UI config settings.

tweaks?: TweaksConfig

Tweaks. Use these values only if you know what you are doing.

ui?: any

UI configuration that is passed to the Bitmovin Player UI if the UI module is loaded. Can also be used to disable the UI in case the UI module is loaded but the UI is not desired.