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.

(more…)

Authenticating publishers in a Red5pro Application

Red5pro offers exciting new ways of engaging your users online with live streams and data online. You can publish live streams and even record them using flash player (desktop), android/ios (mobile) and WebRTC (HTML5 browser).

However, stream security for publishing still lingers as a challenge for the administration. This article discusses how you can secure your publishing streams for the various protocols supported by Red5pro (RTMP, RTSP and WebRTC) programmatically. IF you are new to the world of Red5/Red5Pro, I would suggest taking a peek at the Red5 development series on Github. Here you can find information ranging from what is Red5 to how to create and debug an application.

  (more…)

last comments
Andryan
Andryan

Once built, how do you get Red5 to use this jar?
admin
admin

JAR files are to be deployed in {RED5_HOME}/lib or {RED5_HOME}/webapps/{appname}/WEB-INF/lib

Microsoft azure – Determining VM State

Microsoft azure platform provides a lot of exciting features and is very much as par with competition from AWS and google. However, there remain a few questions around the documentation and examples offered by the platform for developers – or maybe just for JAVA developers in particular who use the Azure java SDK.

 

In particular, I found some difficulty dealing with async VM launches and determining VM states accurately. The SDK team has been very helpful in providing examples and getting in touch for answering questions regarding the SDK. I am sharing here some code snippet which may be helpful to other developers treading the same path.

 

The method given below shows how you can read and categorize a VM’s state to a concrete tangible machine state.

(more…)