Configuration for Web Player
Player configuration parameters are provided whenever a player instance is created.
Configuration Structure
The configuration uses the following structure:
{
targetId: string,
logLevel: string,
disableUserCache: boolean,
playback: PKPlaybackConfigObject,
sources: PKSourcesConfigObject,
playlist: KPPlaylistObject,
plugins: PKPluginsConfigObject,
session: PKSessionConfigObject,
provider: ProviderOptionsObject,
ui: UIOptionsObject,
cast: CastConfigObject
}
config.targetId
Type: string
Default: -
Description: Defines the ID of the DOM element to which the player will be added.
config.logLevel
Type: string
Default: "ERROR"
Description: Defines the player log level.
Possible values: "DEBUG", "INFO", "TIME", "WARN", "ERROR", "OFF"
config.disableUserCache
Type: boolean
Default: false
Description: Indicates whether to stop using the saved user preferences.
You can learn more about user preferences in the player here.
config.playback
Type: PKPlaybackConfigObject
Description: Defines the playback configuration.
config.sources
Type: PKSourcesConfigObject
Description: Defines the sources configuration.
config.playlist
Type: KPPlaylistObject
Description: Defines the playlist configuration.
config.plugins
Type: PKPluginsConfigObject
Description: Defines the plugins configuration.
config.session
Type: PKSessionConfigObject
Description: Defines the session configuration.
config.provider
Type: ProviderOptionsObject
Description: Defines the provider configuration.
config.ui
Type: UIOptionsObject
Description: Defines the user interface (UI) configuration.
config.cast
Type: CastConfigObject
Description: Defines the cast configuration.
Configuration Priority
In the player setup flow, the configuration described above (partially or in full) can be provided by a number of different sources. Each source has a priority, which determines whether the source has a greater or lesser impact on how the player is configured.
Available sources include:
- Application - This is the application that embeds the player and can be used to configures the player in-line upon instantiation.
- Server - This is a partner configuration that is saved on the server. The partner can use this configuration when configuring the player by supplying the
uiConfId
value. - Local Storage (Browser) - This is the user preferences configuration, which is saved in the local storage of the browser.
- Default Player Configuration - The default player configuration is defined internally by the player.
When the player builds its runtime configuration, it will need to know how to built the configuration correctly according to the priority of each configuration, which is as follows (#1 is highest; #4 is lowest):
- Local Storage
- Application
- Server
- Default Player Configuration
Example
In this example, we’ll use the following configuration from each source to see how that source affects the configuration:
Local Storage
{
muted: true,
audioLanguage: 'spa'
}
Application
{
muted: false,
volume: 0.7
}
Server
{
audioLanguage: 'eng',
autoplay: true
}
Default Player Configuration
{
audioLanguage: '',
textLanguage: '',
muted: false,
volume: 1,
autoplay: false
}
The resulting runtime configuration will, therefore, be as follows:
{
audioLanguage: 'spa',
textLanguage: '',
muted: true,
volume: 0.7,
autoplay: true
}