我试图为wowza 3.6.2构建模块。我的模块需要获取IApplicationIdstance的实例,我找到的所有示例都是在onAppStart方法中实现的,但是在访问wowza应用程序时不会调用它。
我有以下几点:
public class TestModule extends ModuleBase {
public void onAppStart(IApplicationInstance appInstance) {
String fullname = appInstance.getApplication().getName() + "/"
+ appInstance.getName();
getLogger().info("onAppStart: " + fullname);
}
public void onAppStop(IApplicationInstance appInstance) {
String fullname = appInstance.getApplication().getName() + "/"
+ appInstance.getName();
getLogger().info("onAppStop: " + fullname);
}
....
}应用程序配置:
<Module>
<Name>TestModule</Name>
<Description>MyTestModule</Description>
<Class>mnesterenko.TestModule</Class>
</Module> 我还有applications/myapp和conf/myapp/Application.xml。
我在浏览器中打开http://wowza_ip:1935/myapp,但是没有调用onAppStart,我遗漏了什么?
发布于 2013-08-09 13:18:07
原因是您的HTTP链接是由wowza HTTPProviders捕获的。Wowza模块用于访问wowza的“流”特性(一般情况下)。因此,如果您要做RTMP连接到特定的应用实例,那么它将工作。此外,您还可以使用应用程序“通过HTTP",但这将要求您请求特定的HTTP,如http://example.com/path/to/file.ext/playlist.m3u8
因此,wowza将流媒体服务器和web服务器结合在一起。
如果您想要捕获这样的请求,请阅读更多关于HTTPProviders的信息。https://www.wowza.com/docs/http-providers
发布于 2018-04-05 08:56:23
在这里,您可以扩展wowza的HTTProvider2Base类,而不是onHTTPRequest。让您的jar并放入wowza -安装directoy/lib/,并将其添加到wowza流引擎的server.xml中。
下面是相同的一个小代码:
public class httpProvider extends HTTProvider2Base {
public void onBind(IVHost vhost, HostPort hostPort) {
super.onBind(vhost, hostPort);
// Called when the HTTP Provider is added to the VHost it is configured for.
}
public void onUnbind(IVHost vhost, HostPort hostPort) {
// Called when the VHost is shutting down for the hostPort configured
}
public void onHTTPRequest(IVHost vhost, IHTTPRequest req, IHTTPResponse resp) {
// If you omit this no authentication is checked regardless of the configuration
if (!doHTTPAuthentication(vhost, req, resp))
return;
String retStr = "Hello Wowza";
try {
OutputStream out = resp.getOutputStream();
byte[] outBytes = retStr.getBytes();
out.write(outBytes);
WMSLoggerFactory.getLogger(MyhttpProvider.class).info("HTTPHelloWowza " + resp);
} catch (Exception e) {
WMSLoggerFactory.getLogger(MyhttpProvider.class).error("HTTPHelloWowza ", e);
}
}
@Override
public void addDateHeader(IHTTPResponse resp) {
// TODO Auto-generated method stub
super.addDateHeader(resp);
}
}https://stackoverflow.com/questions/18105431
复制相似问题