Detect if the stream being published to Wowza is an SRT stream or not.

The latest version of Wowza adeptly supports SRT ingest. Here is an article from Wowza that explains how to publish an SRT stream from Wirecast and get it into Wowza through Mediacaster. It is a fairly simple step by step to getting started with SRT. But now we are left with the dilemma of how to detect this on the server-side within a module. In other words how to know in a module if the publishing stream is an SRT stream or not. Here is a code snippet from the onPublish method of an IMediaStreamActionNotify implementation that demonstrates how to check if the stream is an SRT stream.

public void onPublish(IMediaStream stream, String arg1, boolean arg2, boolean arg3) {
    getLogger().info(".onPublish => stream " + arg1);
    RTPStream rtpStream = stream.getRTPStream();
    if (rtpStream != null)
            getLogger().info("SRT stream detected => stream name : " + arg1);

Read a text file from Wowza’s conf directory

Reading configuration files from the conf directory within a module is a very common occurring in wowza. the following code snippet shows how to read a text file as string from the conf directory. If the file does not exist the code throws an IOException. this example makes use of the environment variable WMSCONFIG_HOME,

 * Read a text file as string from the wowza conf directory give the filename
 * @param filename file name of the file to read
 * @return
 * @throws IOException
private String readFileFromConfigDirectory(String filename) throws IOException
    String conf_home = System.getenv("WMSCONFIG_HOME");
    File conf_dir = new File(conf_home + File.separator + "conf");
    if(conf_dir.exists()) {
        // read the file contents here
        File file_to_read= new File(conf_dir.getAbsolutePath() + File.separator + filename);
        if(file_to_read.exists()) {
            String content = new String(Files.readAllBytes(Paths.get(file_to_read.getAbsolutePath())));
            return content;
        else {
            throw new IOException("oops! file "+filename+" not found!!");
    else {
        throw new IOException("oops! conf directory was not found!!");

The Red5.getConnectionLocal method : Accessing the current connection in Red5 Pro



The diagram shown above is an abstract representation of how a connection flows through Red5 core. On connection attempt, Red5 verifies the basic protocol specific handshake as per the connection type (RTMP/RTSP/WebRTC).

Once the handshake is verified Red5 pro translates the connection to a registered Red5 pro connection and sets a reference to it using the static method – Red5.setConnectionLocal(IConnection) in the context of the current thread.


Capturing client parameters in a Red5pro application

Capturing parameters passed from client to Red5pro server application is a very simple and useful step if you wish to capture data from the client on connection for authentication, validation etc:.

When working with Red5pro, you have different types of clients that can connect to Red5pro – Flash(RTMP), Android/IOS(RTSP), and HTML5(RTC) clients. Each client transmits parameters in a different way. Hence for proper handling, it is recommended to check the client connection type and then devise your parameter collection logic.

In this article, we shall see how to build a simple logic that checks for client type and extract connection parameters accordingly. The recommended parameters capturing point is the appConnect method of your application adapter class. This is the method which gets invoked when a compatible client tried to connect to Red5pro.