How to change the tracks labels?

Overview

This guide will demonstrate how to configure the player's track labels.

The Kaltura Player exposes the configuration and APIs that are used for controlling the tracks and tracks labels.

Every track label can be changed using the player customLabels which is configured on the player root-level configuration object.

Kaltura Player config Playkit config

 customLabels: {    //qualities: translateVideoQuality,    qualities: function (videoTrack) {      if (videoTrack.height > 500) {        return 'High';      }      return 'Low';    },    captions:  translateLangCode,    audio: translateLangCode  }

Video Tracks Labels: translation function

Video Track has the following parameters which can be used for implementing the label logic

VideoTrack structure:

{    "active": false,    "label": "360p",    "language": "",    "index": 1,    "available": true,    "bandwidth": 719794,    "width": 640,    "height": 360 }
const translateVideoQuality = (track) => {      if (track.height > 500) {        return 'High';      }      return 'Low'; };

AudioText Tracks Labels: translation function

Audio/Text Tracks have the following parameters which can be used for implementing the labels logic

AudioTrack structure:

  {    "id": 0,    "active": false,    "label": "English",    "language": "en",    "index": 0,    "available": true  } 

TextTrack structure:

 {    "id": 1,    "active": true,    "label": "Esp",    "language": "es",    "index": 1,    "available": true,    "kind": "subtitles",    "default": false  }
const translateLangCode = (track) => {      if (track.language === "es" || track.language === "spa") {        return 'Spanish';      }      else if (track.language === "en" || track.language === "eng") {        return 'English';      }      return track.label; };

Tracks UI control

The tracks can be changed using the settings icon for video tracks and the globes icon for audio and text tracks

example

example

Example:

Tracks Labels configuration

Tracks Documentation

Tracks Documentation

Was this article helpful?
Thank you for your feedback!
User Icon

Thank you! Your comment has been submitted.

In This Article
Related Articles
Back to top

Never miss a thing!

Subscribe to our customer newsletter and our release notes updates, so you always get the best out of Kaltura.
Newsletter