[object Object] Icon

Encoding
Learn how to create, start, manage and modify Encodings

[object Object] Icon

Player
Learn how to create, start, manage and modify Players

[object Object] Icon

Analytics
Learn how to create, start, manage and modify Analyticss

User shortcuts for search
Focus by pressing f
Hide results by pressing Esc
Navigate via   keys

Thu Sep 13 2018

Using custom labels for audio or subtitle tracks

OverviewLink Icon

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.

ExampleLink Icon

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

1protected void initializePlayer()
2{
3 // Create a new source configuration
4 SourceConfiguration sourceConfiguration = new SourceConfiguration();
5
6 // Create a SourceItem
7 SourceItem sourceItem = new SourceItem("http://bitdash-a.akamaihd.net/content/sintel/sintel.mpd");
8
9 // Add the SubtitleLabeler to the SourceItem
10 sourceItem.getLabelingConfiguration().setSubtitleLabeler(this.subtitleLabeler);
11
12 // Add a new source item to the source configuration
13 sourceConfiguration.addSourceItem(sourceItem);
14
15 // load the source using the created source configuration
16 this.bitmovinPlayer.load(sourceConfiguration);
17}
18
19private SubtitleLabeler subtitleLabeler = new SubtitleLabeler()
20{
21 @Override
22 public String getSubtitleLabel(SubtitleTrack subtitleTrack)
23 {
24 // Return a new label for the SubtitleTrack
25 return getLabelForLanguage(subtitleTrack.getLanguage());
26 }
27};
28
29private String getLabelForLanguage(String language)
30{
31 // Some implementation to determine the label
32 ...
33}

Give us feedback