Thanks Charlie,
Your `appInstance.getStreams().getStream(streamName);` clue, along
with this post by rrlanham:
http://www.wowzamedia.com/forums/showthread.php?t=7652
...got me to the following code, which, although surely improper
(I've never touched java before), renders a json response that
instantly returns whether the app is actually receiving a stream
from the encoder or not (in case anyone else needs the same
and does not fear noob code).
I created a Wowza Class called "ITDLiveStatus" in eclipse, and then
somehow, and thankfully to all who have posted before, cobbled
the following together from various examples:
Code:
package com.itd.wms.httpdlistener;
import java.io.*;
import com.wowza.wms.http.*;
import com.wowza.wms.vhost.IVHost;
import com.wowza.wms.stream.*;
import com.wowza.wms.http.IHTTPRequest;
import com.wowza.wms.http.IHTTPResponse;
import com.wowza.wms.logging.*;
public class ITDLiveStatus extends HTTProvider2Base
{
public void onHTTPRequest(IVHost vhost, IHTTPRequest req, IHTTPResponse resp)
{
StringBuffer ret = new StringBuffer();
String statusResult = new String("False");
IMediaStream stream = vhost.getApplication("live").getAppInstance("_definst_").getStreams().getStream("kylive.sdp");
if(stream != null)
{
statusResult = "True";
}
// build a JSON response...
ret.append("{\"streaming\"" + " : " + "\"" + statusResult +"\"}");
try
{
resp.setHeader("Content-Type", "application/json");
OutputStream out = resp.getOutputStream();
byte[] outBytes = ret.toString().getBytes();
out.write(outBytes);
}
catch (Exception e)
{
WMSLoggerFactory.getLogger(HTTPServerVersion.class).error("HTTPServerInfoXML.onHTTPRequest: "+e.toString());
e.printStackTrace();
}
}
}
...and then (in my test instance), I added a hostPort
entry into my VHost.xml file:
Code:
<!-- add the following HostPort definition to ./conf/VHost.xml -->
<!-- connectioninfo HostPort -->
<HostPort>
<ProcessorCount>1</ProcessorCount>
<IpAddress>192.168.0.100</IpAddress>
<Port>8880</Port>
<SocketConfiguration>
<ReuseAddress>true</ReuseAddress>
<ReceiveBufferSize>16000</ReceiveBufferSize>
<SendBufferSize>16000</SendBufferSize>
<KeepAlive>true</KeepAlive>
<AcceptorBackLog>100</AcceptorBackLog>
</SocketConfiguration>
<HTTPStreamerAdapterIDs></HTTPStreamerAdapterIDs>
<HTTPProviders>
<HTTPProvider>
<BaseClass>com.itd.wms.httpdlistener.ITDLiveStatus</BaseClass>
<RequestFilters>*</RequestFilters>
<AuthenticationMethod>none</AuthenticationMethod>
</HTTPProvider>
</HTTPProviders>
</HostPort>
Thanks a million Charlie and rrlanham!
-kb