# Replay live video while still recording

**URL:** <https://community.wowza.com/t/replay-live-video-while-still-recording/39060>\
**Category:** Wowza Developer Dojo\
**Tags:** wowza-streaming-server-java-api\
**Created:** [February 26, 2015, 10:55am UTC](https://community.wowza.com/t/replay-live-video-while-still-recording/39060 "2015-02-26T10:55:22Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Enrico\_Detoma](https://avatars.discourse-cdn.com/v4/letter/e/ec9cab/32.png) [@Enrico\_Detoma](https://community.wowza.com/u/Enrico_Detoma)\
**Post date:** [February 26, 2015, 10:55am UTC](https://community.wowza.com/t/replay-live-video-while-still-recording/39060/1 "2015-02-26T10:55:22Z")

</div>

Hi,

I have developed a custom Java module that, on the onPublish event of a live stream from a camera, records it as a MP4 file with this code:

```auto
      			//create a livestreamrecorder instance to create .mp4 files
      			ILiveStreamRecord recorder = new LiveStreamRecorderMP4();
      		    recorder.setRecordData(true);
      		    recorder.setStartOnKeyFrame(true);
      		    recorder.setVersionFile(true);
      		       
      			// add it to the recorders list
      			synchronized (recorders)
      			{
      				ILiveStreamRecord prevRecorder = recorders.get(streamName);
      				if (prevRecorder != null)
      					prevRecorder.stopRecording();
      				recorders.put(streamName, recorder);
      			}
      		  recorder.startRecording(stream, false);

```

Now I would like the user to be able to replay the live video, **while still recording it**.

Let’s say, the live video lasts 2 hours, a user connects after 1 hour and would like to replay this first recorded hour before the recording has ended.

How can I programmatically create a new stream for this purpose, based on the partially recorded MP4 file?

---

<div class="post-metadata">

**Author:** ![Paul\_Shields](https://sea2.discourse-cdn.com/flex002/user_avatar/community.wowza.com/paul_shields/32/390_2.png) [@Paul\_Shields](https://community.wowza.com/u/Paul_Shields)\
**Post date:** [February 28, 2015, 12:41am UTC](https://community.wowza.com/t/replay-live-video-while-still-recording/39060/2 "2015-02-28T00:41:23Z")

</div>

Hi,

If using LiveStreamRecord you will need the MP4 file to be finalized before playback. This occurs when the recording of that specific file has ended.

Paul

---

<div class="post-metadata">

**Author:** ![Daren\_Johnson](https://avatars.discourse-cdn.com/v4/letter/d/ee59a6/32.png) [@Daren\_Johnson](https://community.wowza.com/u/Daren_Johnson)\
**Post date:** [March 2, 2015, 11:52pm UTC](https://community.wowza.com/t/replay-live-video-while-still-recording/39060/3 "2015-03-02T23:52:17Z")

</div>

Hi,

Segmenting/splitting the recordings into small chunks that can be played individually might be the best option.

You would need a way to manage the playback of the segmented files. The recording / Splitting can still be accomplished using the

[Recording API](https://www.wowza.com/docs/how-to-record-live-streams-wowza-streaming-engine#livestreamrecordapi)

Daren

---

<div class="post-metadata">

**Author:** ![Enrico\_Detoma](https://avatars.discourse-cdn.com/v4/letter/e/ec9cab/32.png) [@Enrico\_Detoma](https://community.wowza.com/u/Enrico_Detoma)\
**Post date:** [March 3, 2015, 7:12am UTC](https://community.wowza.com/t/replay-live-video-while-still-recording/39060/4 "2015-03-03T07:12:03Z")

</div>

> Hi,
> 
> If using LiveStreamRecord you will need the MP4 file to be finalized before playback. This occurs when the recording of that specific file has ended.
> 
> Paul

Thank you Paul for your answer.

Is there another way to be able to accomplish the “replay while recording” feature (e.g. recording the stream in a different format)?
