How to set the TrackBase parameter with LanguageCode when uploading track with Microsoft.Azure.Management.Media
v6.0.0?
Adding track works, but languageCode remains empty
await client.Tracks.BeginCreateOrUpdateAsync(
config.ResourceGroup,
config.AccountName,
foundAsset.Name,
"M0508826_FI.vtt",
new TextTrack("M0508826_FI.vtt", "suomi", "fi")
);
{
"name": "M0508826_FI.vtt",
"id": "/subscriptions/.../providers/Microsoft.Media/mediaservices/.../assets/.../tracks/M0508826_FI.vtt",
"type": "Microsoft.Media/mediaservices/assets/tracks",
"properties": {
"track": {
"@odata.type": "#Microsoft.Media.TextTrack",
"fileName": "M0508826_FI.vtt",
"displayName": "suomi",
"languageCode": "",
"playerVisibility": "Visible"
},
"provisioningState": "Succeeded"
}
}
Tried to set languageCode also to "fi-FI", but result is same. It works fine if the track is added via REST API.
REST HTTP POST body being
{
"properties": {
"track": {
"@odata.type": "#Microsoft.Media.TextTrack",
"displayName": "suomi",
"fileName": "M0508826_FI.vtt",
"languageCode": "fi",
"playerVisibility": "Visible"
}
}
}
Answering myself, as I found the answer hidden in the comments of the TS sample file at https://github.com/Azure-Samples/media-services-v3-node-tutorials/blob/f614109b34bc5ef8e7a4be074b8e30c99f3fc7c4/Assets/add-WebVTT-tracks.ts#L138.
You need to include the language in the WEBVTT file as follows:
// AMS supports uploading both .vtt files and .ttml files in the IMSC1 text profile (basically no images in base64!)
// The desired language should be set in the head of the vtt file in the following format:
//
// WEBVTT
// Language: en-us