Hi everybody. I am new to Wowza and I've been struggling with some issues. I need to tell Wowza the following:
- start a stream
- start recording the stream and only output one segment of X seconds (the resulting file path and name should be given as parameters and not hardcoded)
- stop the stream

What I managed to do so far:

I've build the following HTTPProvider :

package com.mycompany.wms.http;

import java.io.*;
import com.wowza.wms.application.IApplication;
import com.wowza.wms.application.IApplicationInstance;
import com.wowza.wms.http.*;
import com.wowza.wms.logging.*;
import com.wowza.wms.vhost.*;

public class MyHTTPProvider extends HTTProvider2Base {
public void onHTTPRequest(IVHost vhost, IHTTPRequest req, IHTTPResponse resp) {
if (!doHTTPAuthentication(vhost, req, resp))

String resultStr = "";

String appInstance = req.getParameter("appInstance");
String stream = req.getParameter("stream");

IApplication app = vhost.getApplication("capture");
IApplicationInstance appInst = app.getAppInstance(appInstance);

if (appInst.startMediaCasterStream(stream, "rtp")) {
resultStr = "<font color='green'>Stream started succesfully!</font>";
} else {
resultStr = "<font color='red'>Error starting stream!</font>";

String retStr = "<html><head></head><body>" + resultStr + "</body></html>";

try {
OutputStream out = resp.getOutputStream();
byte[] outBytes = retStr.getBytes();
} catch (Exception e) {
WMSLoggerFactory.getLogger(null).error("MyHTTPProvider: " + e.toString());
I call this with a URL like this:
And the stream starts properly.

Then I have the following module:

package com.mycompany.wms.module;

import com.wowza.wms.application.*;
import com.wowza.wms.livestreamrecord.model.LiveStreamRecorderMP4;
import com.wowza.wms.module.*;
import com.wowza.wms.stream.*;
import com.mycompany.wms.listener.MyListener;

public class MyModule extends ModuleBase {
private IApplicationInstance applicationInstance;

public void onAppStart(IApplicationInstance appInstance) {
this.applicationInstance = appInstance;

public void onStreamCreate(IMediaStream stream) {
MyListener myListener = new MyListener(this.applicationInstance, stream);

LiveStreamRecorderMP4 recorder = new LiveStreamRecorderMP4();
recorder.startRecordingSegmentByDuration(stream, "/opt/test/" + "fileName" + ".mp4", null, 60000);
The purpose of the module is to start recording of the live stream, right after the stream is created. The recording starts properly.
Then I have the following listener:

package com.mycompany.wms.listener;

import com.wowza.wms.application.IApplicationInstance;
import com.wowza.wms.livestreamrecord.model.ILiveStreamRecord;
import com.wowza.wms.livestreamrecord.model.ILiveStreamRecordNotify;
import com.wowza.wms.stream.IMediaStream;

public class MyListener implements ILiveStreamRecordNotify {
private IApplicationInstance applicationInstance;
private IMediaStream stream;

public MyListener(IApplicationInstance applicationInstance, IMediaStream stream) {
this.stream = stream;
this.applicationInstance = applicationInstance;

public void onSegmentEnd(ILiveStreamRecord recorder) {

public void onSegmentStart(ILiveStreamRecord recorder) {

The listener role si to "kill" the recording right after the first segment is done. Recording is stopped properly.

No the questions:

1. Look at the hardcoded values of the resulting file path, name and duration (red coloured). I need to pass those values from the HTTPProvider but I have no ideea how to accomplish this. I would get them in the HTTPProvider as parameters in the query string but I don't know how to pass them further to the module.

2. Could it be a simpler approach to what I want to achieve? I feel like I overcomplicated things. Would you suggest a better approach?

Thank you,