# recording delayed

**URL:** <https://community.wowza.com/t/recording-delayed/51396>\
**Category:** Wowza Streaming Engine\
**Tags:** recording\
**Created:** [May 31, 2018, 4:56pm UTC](https://community.wowza.com/t/recording-delayed/51396 "2018-05-31T16:56:25Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Marton\_Fulop](https://avatars.discourse-cdn.com/v4/letter/m/b487fb/32.png) [@Marton\_Fulop](https://community.wowza.com/u/Marton_Fulop)\
**Post date:** [May 31, 2018, 4:56pm UTC](https://community.wowza.com/t/recording-delayed/51396/1 "2018-05-31T16:56:25Z")

</div>

Hi All,

I’m experiencing a weird issue. I’ve written a module that starts and stops live recording and 98% of times it works like a charm.  
Sometimes it happens that the recording (triggered on the onPublish event of the IMediaStreamActionNotify3 interface) is started after the stream as been already closed and obviously it fails saying “Stream not found”!  
Those streams don’t last very long, duration between 10 sec and 10 minutes, but these are standard durations for our application.

Here the code that starts the recording:

```auto
private void startRecording() {
String streamName = getRecordingStreamName();
if(this.recordingParams == null) {
        this.recordingParams = buildStreamRecorderParameters("somepath");
}
iApplicationInstance.getVHost().getLiveStreamRecordManager().startRecording(iApplicationInstance,iMediaRecordingName, this.recordingParams);
}

private StreamRecorderParameters buildStreamRecorderParameters(String outputPath) {
    StreamRecorderParameters params = new StreamRecorderParameters(iApplicationInstance);
params.fileFormat = IStreamRecorderConstants.FORMAT_MP4;
params.versioningOption = IStreamRecorderConstants.APPEND_FILE;
params.segmentationType = IStreamRecorderConstants.SEGMENT_NONE;
params.startOnKeyFrame = true;
params.recordData = false;
params.notifyListener = new RecorderActionNotifyImpl(this);
File file = new File(outputPath);
params.outputPath = file.getParent();
params.outputFile = file.getName();    
return params;
}

```

Any clue?
