How can I use custom labels for audio or subtitle tracks?

In some scenarios, you want more control over the labels for subtitle and audio tracks as they are displayed in the player UI. The default behavior of the Bitmovin Player SDKs is, that the labels are inferred from the DASH or HLS manifest in which the tracks are defined. To be able to override this default behavior, we created the LabelingConfiguration.

The following code snippet shows, how the LabelingConfiguration can be used to override the default labels for subtitle tracks in the Android SDK:

protected void initializePlayer()
{
    // Create a new source configuration
    SourceConfiguration sourceConfiguration = new SourceConfiguration();
    // Create a SourceItem
    SourceItem sourceItem = new SourceItem("http://bitdash-a.akamaihd.net/content/sintel/sintel.mpd");
    // Add the SubtitleLabeler to the SourceItem
    sourceItem.getLabelingConfiguration().setSubtitleLabeler(this.subtitleLabeler);
    // Add a new source item to the source configuration
    sourceConfiguration.addSourceItem(sourceItem);
    // load the source using the created source configuration
    this.bitmovinPlayer.load(sourceConfiguration);
}
private SubtitleLabeler subtitleLabeler = new SubtitleLabeler()
{
    @Override
    public String getSubtitleLabel(SubtitleTrack subtitleTrack)
    {
        // Return a new label for the SubtitleTrack
        return getLabelForLanguage(subtitleTrack.getLanguage());
    }
};
private String getLabelForLanguage(String language)
{
    // Some implementation to determine the label
     ...
}