# Auto recording module

**URL:** <https://community.wowza.com/t/auto-recording-module/46364>\
**Category:** Wowza Developer Dojo\
**Tags:** wowza-streaming-server-java-api\
**Created:** [December 14, 2015, 3:13pm UTC](https://community.wowza.com/t/auto-recording-module/46364 "2015-12-14T15:13:06Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Johan\_Moncada](https://avatars.discourse-cdn.com/v4/letter/j/258eb7/32.png) [@Johan\_Moncada](https://community.wowza.com/u/Johan_Moncada)\
**Post date:** [December 14, 2015, 3:13pm UTC](https://community.wowza.com/t/auto-recording-module/46364/1 "2015-12-14T15:13:06Z")

</div>

Hi there,

I have a Java class with this code:

```auto
public class AutoRecordModule extends ModuleBase implements IModuleOnApp {
	private IApplicationInstance appInstance = null;
	private IVHost vhost = null;
	
	@Override
	public void onAppStart(IApplicationInstance appInstance)
	{
		getLogger().info("ModuleAutoRecordCustom onAppStart["+appInstance.getContextStr()+"]: ");
     	this.appInstance = appInstance;
     	this.vhost = appInstance.getVHost();
     	
		// set recording params as desired
		StreamRecorderParameters recordParams = new StreamRecorderParameters(appInstance);
	    // don't segment, using the default content path, do not append (i.e. overwrite if file exists)
		recordParams.segmentationType = IStreamRecorderConstants.SEGMENT_NONE;
		recordParams.versioningOption = IStreamRecorderConstants.APPEND_FILE;
		recordParams.fileFormat = IStreamRecorderConstants.FORMAT_MP4;
		recordParams.startOnKeyFrame = true;
		recordParams.recordData = true;
		getLogger().info("--- startRecording");
		// tell LiveStreamRecordManager to record all streams for this Instance using these params
		vhost.getLiveStreamRecordManager().startRecording(appInstance, recordParams);
	}
	@Override
	public void onAppStop(IApplicationInstance appInstance) {
		// TODO Auto-generated method stub
		
	}
}

```

This code record all videos publiched on my app.

But I have a really wrong thing, if a video stream is unpublish it and immediately a new streams with different name is publish, the recorder module append on the old file, I mean this new video is appending on the last video file recorded and not on a new file.

Here I copy a couple of lines of my console log

INFO server comment - MyStreamRecorderListener.onSegmentEnd[live/_definst_]: segment closed:testrecord2

INFO server comment - MyStreamRecorderListener.onStopRecorder[live/_definst_]: Recording stopped:testrecord2 /usr/local/WowzaStreamingEngine/content/testrecord1.mp4

Can you help me with this please?

Thanks!

---

<div class="post-metadata">

**Author:** ![Matt\_Young](https://sea2.discourse-cdn.com/flex002/user_avatar/community.wowza.com/matt_young/32/389_2.png) [@Matt\_Young](https://community.wowza.com/u/Matt_Young)\
**Post date:** [January 6, 2016, 9:06am UTC](https://community.wowza.com/t/auto-recording-module/46364/2 "2016-01-06T09:06:43Z")

</div>

Hello

You might consider leveraging the functionality provided by the file version delegate:

```auto
recordParams.fileVersionDelegate = new MyFileVersionDelegate();
...
class MyFileVersionDelegate implements IStreamRecorderFileVersionDelegate
{
	.....
}                      

```

And further control using the IStreamRecorderActionNotify interface to specify stream specific parameters. You can take a look at the [advanced recording module](https://www.wowza.com/downloads/forums/livestreamrecord/LiveStreamRecordAutoRecord_4.0.zip) for a complete example.

Thanks,

Matt
