Currently, I am implementing video.js
with both DASH
and HLS
depending on the platform that accesses the website. The issue I am encountering is that the audio track labels in the manifest files are not being properly displayed. To address this problem, I planned to adjust them using the code snippet below:
const audioTrackList = this.player.audioTracks();
for (let i = 0; i < audioTrackList.length; i++) {
const element = audioTrackList[i];
switch (this.get3LetterLangCode(element.language)) {
case 'hun':
element.label = this._translate.instant('Hungarian');
break;
case 'slk':
element.label = this._translate.instant('Slovakian');
break;
case 'ron':
element.label = this._translate.instant('Romanian');
break;
case 'bul':
element.label = this._translate.instant('Bulgarian');
break;
case 'cze':
element.label = this._translate.instant('Czech');
break;
case 'eng':
element.label = this._translate.instant('English');
break;
default:
break;
}
}
While this solution works correctly when using DASH
, a problem arises when utilizing HLS
as I encounter the error message:
Attempted to assign to readonly property
How can I make changes to the audio track label when working with HLS?