I have enabled WebVTT in a live application for multi language captions from onTextData. However injecting japanese chars correctly doesn’t display in the generated webVTT correctly. The label for 3 letter iso code jpn shows up as ??? on the text track. So even it cant generate the label correctly.
What is the correct way ?
VOD japanese VTT is perfectly fine.
I have a medialist that generates subtitle languages like
#EXTM3U
#EXT-X-VERSION:3
#EXT-X-MEDIA:TYPE=SUBTITLES,GROUP-ID="subs",NAME="English",FORCED=NO,AUTOSELECT=YES,URI="subtitlelist_leng_w1412002914_b4096000.m3u8?vttlang=en,es,ja",LANGUAGE="eng"
#EXT-X-MEDIA:TYPE=SUBTITLES,GROUP-ID="subs",NAME="Espa�ol",FORCED=NO,AUTOSELECT=YES,URI="subtitlelist_lspa_w1412002914_b4096000.m3u8?vttlang=en,es,ja",LANGUAGE="spa"
#EXT-X-MEDIA:TYPE=SUBTITLES,GROUP-ID="subs",NAME="???",FORCED=NO,AUTOSELECT=YES,URI="subtitlelist_ljpn_w1412002914_b4096000.m3u8?vttlang=en,es,ja",LANGUAGE="jpn"
#EXT-X-STREAM-INF:BANDWIDTH=4096000,CODECS="avc1.42001e,mp4a.40.2",RESOLUTION=1920x1080,CLOSED-CAPTIONS=NONE,SUBTITLES="subs"
chunklist_w1412002914_b4096000.m3u8?vttlang=en%2Ces%2Cja
And then the vtt looks like
00:02:59.299 --> 00:03:00.298
���� Wowza Media Server クãƒÂーズドã‚Âャプション。
The text being injected is
? ? ? ? Wowza Media Server クローズドキャプション。
like so
AMFDataObj amfData = new AMFDataObj();
ByteBuffer buffer = StandardCharsets.UTF_16.encode(onTextData.text);
String utf8EncodedString = StandardCharsets.UTF_16.decode(buffer).toString();
//Base64.Encoder encoder = Base64.getEncoder();
//String encoded = encoder.encodeToString(utf8EncodedString.getBytes());
getLogger().info(utf8EncodedString + " lang: " + lang);
amfData.put("text", new AMFDataItem(utf8EncodedString));
amfData.put("language", new AMFDataItem(lang));
amfData.put("trackid", new AMFDataItem(trackNumber));
stream.sendDirect("onTextData", amfData);