Skip to content

Add a settings object to the Player API

Vinay Rosenberg requested to merge github/fork/bbc/playerConfig into development

Created by: robertbryer

The large number of getter/setter functions on the player for simple config options is quite annoying - this commit aims to replace this by creating a settings object for use with the player, the aim being to be able to configure as much as possible with one function call, with only one standard type of object. To do so means the lifecycle of these settings can be understood better(stored for the lifetime of the the player or until reset(), instead of the lifetime of the underlying class that uses them). It should also be easier to programmatically generate and move settings, and hopefully make it easier to add new settings in the future.

It adds to MediaPlayer.js getSettings() updateSettings(settingsObj) resetSettings()

updateSettings takes an object, and updates only the properties found on the object and on the default object. Anything that doesn't match this schema is ignored, and a warning is logged to console.

A significant number of get/set functions in MediaPlayer.js are then reimplemented to set the corresponding property on the settings object, so there's no change to the current API. These functions can then be deprecated, and then removed at a later date.

Some of the names of properties have been changed slightly, for example maxAllowedBitrate has been changed to maxBitrate .This might be a good opportunity to clean up any bits of API in this, so if you have any comments on that subject, now would be a great time to do it.

Merge request reports