I have an HTTPProvider that needs to load a file from the conf directory. When I debug from Eclipse the current working directory is not the Wowza install directory. Is there a call I can make to determine the location of the Wowza install?
Also I will be using the mediacaster routines to start and stop a stream as shown in the example HTTPProvider. However, I have streams that start up on demand using mediacaster's "rtp-live" and would like to be able to dynamically make them inaccessible just like stopping the mediacaster "rtp" streams. Any advice on the best way to do this? The purpose of my HTTPProvider is to make a custom web page of all streams and control their access.
As per your second question, it sounds like you might want to take a look at our ban stream server listener from within our
Module Collection. This should allow you to make these streams inaccessible. Just setup the listener as follows in your Server.xml:
The Ban Streams server listener currently only shuts down player streams that are running at the time they are banned. It doesn't check to see if they are banned when a player reconnects because it also shuts down the published stream from the encoder. Unfortunately, this doesn't work for mediaCaster streams that are started dynamically.
The following class will check to see if the stream name is banned when the player connects and will prevent it from starting a mediaCaster if it is.
class StreamAliasProvider implements IMediaStreamNameAliasProvider
public String resolvePlayAlias(IApplicationInstance appInstance, String name)
if (BlackListUtils.isStreamBlackListed(appInstance.getApplication().getName(), appInstance.getName(), name))
public String resolveStreamAlias(IApplicationInstance appInstance, String name)
return MediaCasterUtils.handleStreamAliasFile(appInstance, name);
Add it as a sub class to the ServerListenerBanStreams class and invoke it from the ApplicationInstanceNotify.onApplicationInstanceCreate method.
public void onApplicationInstanceCreate(IApplicationInstance appInstance)
logger.info(MODULE_NAME + ".onApplicationInstanceCreate[" + appInstance.getName() + "] Stream Listener is initiated");
It works by returning null from the resolvePlayAlias method if the stream is banned. When null is returned from this method, a 404 response is sent back to the player. The resolveStreamAlias method calls the internal stream files handler so these will still work.
Note: You can only have one StreamNameAliasProvider for an appInstance. If there are multiple ones in different modules then the last one loaded will override the rest.
The onApplicationInstanceCreate method gets called after any onAppStart module methods so will override those. If you already have a alias provider in a module then it would be best to do the ban check there. It is a static method so can be called from anywhere.