Extend Wowza Streaming Engine using Gradle and Docker Compose

The Wowza Streaming Engine Plugin Builder offers a modern, containerized development environment for creating and testing custom Java modules that extend the functionality of the Wowza Streaming Engine media server software.

This project includes a streamlined Gradle-based build system and a Docker Compose setup that runs Wowza Streaming Engine in a local container. The approach allows developers to build, package, and deploy custom Wowza Streaming Engine extensions quickly and consistently across platforms.

You can get the wse-plugin-builder source code on GitHub.

Usage


An example module, MyFirstPlugin, is included in the wse-plugin-builder repository for testing and demonstration purposes. The example plugin includes:

  • Server listener com.wowza.wms.plugin.myFirstPlugin.MyFirstServerListener: Starts automatically when the Wowza Streaming Engine server launches.
  • Application Module com.wowza.wms.plugin.myFirstPlugin.MyFirstModule: Initializes when an application starts and the first stream connects to it.

Both components simply log a startup message to the console:

 **********************************************
 * Welcome to my first Server Listener v1.0.0 *
 **********************************************


 ********************************************************
 * Welcome to my first Application Module Plugin v1.0.0 *
 ********************************************************


You can modify these sample modules by adding any custom logic inside the example methods we provide. For more, see Custom Java module examples and Use event listeners with the Wowza Streaming Engine Java API.

Before you start


Before you begin, make sure you have:

  • A Wowza Streaming Engine license key.
  • Install and run Docker Desktop, which includes the Docker Engine and the Docker Compose plugin.

1. Install and configure the module


To get started with the Wowza Streaming Engine Plugin Builder, you’ll need to install the module and configure it with your Wowza Streaming Engine license key. 

  1. Clone the repository:
 git clone git@github.com:WowzaMediaSystems/wse-plugin-builder.git
  1. Change to that directory:
 cd wse-plugin-builder
  1. Update the WSE_LICENSE_KEY variable in the docker-compose.yaml file with your Wowza Streaming Engine license key:
 export WSE_LICENSE_KEY=[your-license-key]
Note: If you set the license key using the described method, it doesn't persist between terminal sessions and each time you run the Docker container or reboot your server. For a more consistent experience, you can directly add the license key to the docker-compose.yaml file or use a .env file to store sensitive data.

2. Build the Docker image


The steps in this section build a new Docker image named wse-builder:local using the Dockerfile in this repository. The image provides a build environment for compiling custom Wowza Streaming Engine modules.

  1. Make sure Docker Desktop and Docker Engine are running.
  2. Initialize the project and build the Docker container. Run the following from the root of your project:
 ./build_builder.sh

3. Compile the module into a .jar file


Next, compile the module so it can be used as a plugin with Wowza Streaming Engine.

  1. Run the following from the root of your project:
 ./build.sh ./code/wse-plugin-my-first-plugin
  1. The process generates the following plugin .jar file, which can be deployed and run with Wowza Streaming Engine:

code/wse-plugin-my-first-plugin/build/libs/wse-plugin-my-first-plugin-1.0.0.jar

4. Test your module


To test the newly created module, use the steps in this section. To learn more about our Docker Compose workflows, see Set up Wowza Streaming Engine using a Docker Compose deployment.

  1. Run the following from the root of your project:
 docker compose up

This command starts the Wowza Streaming Engine trial Docker image and maps the lib.addon directory to the newly created .jar file. 

  1. Check your terminal and the combined Docker service logs for the following output:
 wse-1      | INFO server comment - Server.startShutdownHook: Start server shutdown hook
 wse-1      | INFO server comment - **********************************************
 wse-1      | INFO server comment - * Welcome to my first Server Listener v1.0.0 *
 wse-1      | INFO server comment - **********************************************
 wse-1      | INFO server comment - StatsManager:startManager() Enabled=true
 wse-1      | INFO server comment - Wowza Streaming Engine is started!

Next steps


You can customize the module yourself, for example, by adding your own log message in the MyFirstServerListener.java file:

public void onServerInit(IServer server)
  {
    logger = WMSLoggerFactory.getLogger(null);
    logger.info("**********************************************");
    logger.info("* Welcome to my first Server Listener v"+MODULE_VERSION+" *");
    logger.info("* Hello <myname>, this is my first change. *");
    logger.info("**********************************************");
  }

After you customize the Java file, make sure to run to recompile the module:

 ./build.sh ./code/wse-plugin-my-first-plugin

For more information about the event listeners in this module, see Use event listeners with the Wowza Streaming Engine Java API.

More resources