I’m trying to serve utf-8 encoded VTT files. Unfortunately HTTPProviderCaptionFile mangles utf-8 VTT files. I don’t think the server supports internationalisation correctly as required for captions.
When trying to write utf-8 text to the output stream it also mangles it. But utf-8 text shows correctly in live sideloaded webvtt. Ive set the startup flags to uft-8 encoding also. How to configure the output stream of the provider to output utf-8 encoding ?
Ive tried Files copy to output to the stream directly but doesnt read as utf-8
public void onHTTPRequest(IVHost vhost, IHTTPRequest req, IHTTPResponse resp) {
String uriPath = super.getPath(req, false);
String[] paths = uriPath.split("/"+IApplicationInstance.DEFAULT_APPINSTANCE_NAME+"/");
String appName = paths[0];
//String filePath = "${com.wowza.wms.context.VHostConfigHome}/" + paths[1];
IApplication app = vhost.getApplication(appName);
IApplicationInstance appInstance = app.getAppInstance(IApplicationInstance.DEFAULT_APPINSTANCE_NAME);
String filePath = appInstance.getStreamStorageDir() + "/" + paths[1];
OutputStream out = resp.getOutputStream();
try {
File toBeCopied = new File(filePath);
//Path path = toBeCopied.toPath();
//Files.copy(toBeCopied, out);
BufferedReader inf = null;
if (toBeCopied.exists())
{
//inf = new BufferedReader(new FileReader(textFileObj, ));
inf = new BufferedReader(
new InputStreamReader(new FileInputStream(toBeCopied ), "UTF-8"));
String line;
while ((line = inf.readLine()) != null)
{
//out.write(line.getBytes("UTF-8"));
out.write(line.getBytes());
WMSLoggerFactory.getLogger(null).info(line);
}
}
} catch (Exception e) {
try {
byte[] outBytes1 = e.getMessage().getBytes();
out.write(outBytes1);
} catch (Exception e1) {
}
}
}
In the wowza log it prints correctly
これは、画面のより多くを占めるはずの、はるかに長い 2 番目のクローズド キャプションです。
In the output it displays like
åˆã‚ã¦ã® Wowza Media Server クãƒãƒ¼ã‚ºãƒ‰ã‚ャプション。ã“ã‚Œã¯ã€ç”»é¢ã®ã‚ˆã‚Šå¤šãã‚’å ã‚ã‚‹ã¯ãšã®ã€ã¯ã‚‹ã‹ã«é•·ã„ 2 番目ã®ã‚¯ãƒãƒ¼ã‚ºãƒ‰ ã‚ャプションã§ã™ã€‚3番目ã®ã‚¯ãƒãƒ¼ã‚ºãƒ‰ã‚ャプションã¯ã“ã¡ã‚‰
In the startup flag I have
<VMOption>-Djava.net.preferIPv4Stack=true -Dfile.encoding=UTF-8</VMOption>
The captionfile module will output the vtt files incorrectly. They display the correct characters when loading the files locally.
00:00:13.000 --> 00:00:14.000
éŽåŽ»2週間ã§æ·±åˆ»ãª