I am trying to play a m3u8 file when an HTTP provider is called. I tried putting it directly and putting it in a stream file but both ways are not working. How do I do this?
This is my code:
public class HttpTest extends HTTProvider2Base {
public void onHTTPRequest(IVHost vhost, IHTTPRequest req, IHTTPResponse resp) {
if (!doHTTPAuthentication(vhost, req, resp))
return;
IApplicationInstance appInstance = vhost.getApplicationInstance("mkktest", "_definst_");
Stream stream = Stream.createInstance(appInstance, "myStream");
stream.addToPlaylist(0, "bipbop.stream", 0, 100);
// stream.addToPlaylist(1, "m3u8:https://devstreaming-cdn.apple.com/videos/streaming/examples/bipbop_4x3/bipbop_4x3_variant.m3u8", 0, 100);
stream.play(0);
String helloStr = stream.toString();
String retStr = "<html><head><title>" + helloStr + "</title></head><body>" + helloStr + "</body></html>";
try {
OutputStream out = resp.getOutputStream();
byte[] outBytes = retStr.getBytes();
out.write(outBytes);
} catch (Exception e) {
WMSLoggerFactory.getLogger(null).error("HttpTest: " + e.toString());
}
}
}
My bipbop.stream file is:
https://devstreaming-cdn.apple.com/videos/streaming/examples/bipbop_4x3/bipbop_4x3_variant.m3u8
With putting the stream file, I get the error:
Container failed: java.lang.Exception: QTUtils.parseQTMediaContainer: File is missing 'moov' atom.
With putting the m3u8 directly, I get the error:
INFO server comment - Stream.switch[mkktest/_definst_/myStream]: index: 0 name:m3u8:https://devstreaming-cdn.apple.com/videos/streaming/examples/bipbop_16x9/bipbop_16x9_variant.m3u8 start:0 length:100 interItemGap(a/v/c/u):0/0/0/0
ERROR server comment - MediaReaderFactory.getInstance: Missing definition for m3u8
ERROR server comment - PublishingProviderMediaReader.play : java.lang.NullPointerException|at com.wowza.wms.stream.publish.PublishingProviderMediaReader.play(PublishingProviderMediaReader.java:474)|at com.wowza.wms.stream.publish.Stream.run(Stream.java:226)|at java.base/java.lang.Thread.run(Unknown Source)|
How do I solve this?