Skip to main content
Skip table of contents

Configuration

You can optionally provide a variety of configuration settings to fine-tune the behaviour of the player engine. Previously the SDK required your choice of settings to be applied and re-applied after a new source stream has been set. The SDK can now retain configuration settings over a zap, removing the need for complexity in your code.  However, this is still possible if a new configuration is required for the new stream.

Setting configuration parameters

Use of the configure() API is only relevant for DASH streams; it does not affect Safari.

The OtvToolkit provides a general purpose configure() API, which allows a large range of adjustments to be made. This can be used in two different ways, where:

  • A parameter and its value are passed as an argument pair.

    JS
    playerInstance
       .otvtoolkit()
       .configure(<string parameter>, <value>);
  • A JavaScript Object carrying the structure of one or many parameters and their values.

    JS
    playerInstance
       .otvtoolkit()
       .configure(<object parameter>);

For example, the following calls to the API would be equivalent:

JS
playerInstance
   .otvtoolkit()
   .configure("abr.restrictions.minBandwidth", 200);

playerInstance
	.otvtoolkit()
	.configure({
				abr:{
					restrictions:{
						minBandwidth: 200
					}
				}
			});

For more details on the underlying Shaka Player API that the configure() API models, see https://shaka-player-demo.appspot.com/docs/api/shaka.Player.html#configure

Other configuration capabilities

Bitrate/Resolution capping

See Resolution and bitrate capping where other configuration APIs for specific purposes are described.

Although requested by you, these are classed as being set by the OtvToolkit and can be overridden by using the configure() API. Take care when mixing the APIs.

Segment download resiliency

See DASH segment download resiliency for other examples of possible configuration options.

Preferred Audio Language

See Multi-audio.

Preferred Subtitle Language

See Subtitles.

Reading back the configuration

The OtvToolkit provides a corresponding getConfiguration() API, which allows all of the currently applied configuration settings to be retrieved.

JS
playerInstance
   .otvtoolkit()
   .getConfiguration();

If you only were interested in a sub-section of the various parameters, you can always suffix this with the relevant sub-section(s) hierarchy, for example:

JS
let currentConfig = playerInstance
   .otvtoolkit()
   .getConfiguration().abr.restrictions;

console.log(currentConfig);

{minWidth: 0, maxWidth: Infinity, minHeight: 0, maxHeight: 720, minPixels: 0, …}
JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.