Overriding a Player Configuration

Last updated on Dec 17, 2020

The player supports two ways to override the Bitmovin configuration:

  • Player Initialization
  • Custom Player Logic

While neither method fully overrides player configurations such as what to play or YOUBORA settings, they do offer a way to add or change most of the other player options. For more information on changing these settings, refer to: Bitmovin Web SDK API.

Using Player Initialization to Override Configurations

The following illustrates how to configure player creation by adding any Bitmovin supported player configuration options to the player config (for example, Turn off all logs).

Turn Off All Logs
PremiumPlayer("hvcPlayerHolder",{ 		
    pid:"MPX_PID" 	
    config:{
        logs:{
            level:"off"
        }
    }
})


Using Custom Player Logic to Override Configurations

You can also override configurations using the HVCPlayer.onConfig hook on the Player Generator page.

Similar to how HvcPlayer.onLoad calls a function to pass back the newly created player, the onHVCPlayer.onConfig calls a function before creating the player. The first parameter of this function is the proposed player configuration object, you can modify and return the object to overwrite various player configurations (for example, Turn off all logs via onConfig).

Turn Off All Logs via onConfig
//NOTE: this runs before the player is created.
//
HvcPlayer.onConfig(function(config) {
  config.logs = {level:"off"};
//
// A Bitmovin config should be returned.
//
  return config;
})

Additional Resources