Clear dvr without stream restart

Hello!

I’d like to have opportunity to save DVR after stream restart but sometimes I need to clean it by hand.

Can I clear DVR for stream/application by some api call?

I’ve found purgeEntries method in https://www.wowza.com/resources/serverapi/com/wowza/wms/dvr/IDvrStreamManager.html

This is it? If yes - how can I get DvrStreamManager from stream or application object?

The correct call @mikhail Kartashov is:

deleteArchivedStore. https://www.wowza.com/resources/serverapi/com/wowza/wms/dvr/IDvrStreamManager.html#deleteArchivedStore-java.lang.String-

You would need to determine what the versioned stream name is (normally streamName.n ) and then pass that into the method. Also, it will upset any players currently playing from the DVR store so the call should be made before any players connect, ideally from onAppStart.

You would need to create an IDvrStreamManager for each stream then call deleteArchivedStore on it.

IDvrStreamManager dvrManager = appInstance.getStreams().getLiveStreamPacketizer(streamName, "dvrstreamingpacketizer", true);
dvrManager.deleteArchivedStore(versionedStreamName);

In some cases (for example, a problem with copyright holders), we must clear the DVR in the stream, but we must not restart it, because at this moment some event may be streamed and recorded.

So I’ve done that:

public void clearDVR(String streamName, long timeShiftSeconds){

IDvrStreamManager manager = this.appInstance.getStreams().getStream(streamName).getDvrRecorder(“dvrrecorder”).getDvrManager();

// Dirty hack there. We use only one version :slight_smile:

IDvrStreamStore store = manager.getStreamStore(stream.getName()+".0");

IDvrManifest paramIDvrManifest = store.getManifest();

DvrChannelManifest manifest = paramIDvrManifest.getManifestChannel(IVHost.CONTENTTYPE_VIDEO);

if (manifest == null) {

manifest = paramIDvrManifest.getManifestChannel(IVHost.CONTENTTYPE_AUDIO); // for audio-only streams

if (manifest == null) {

return;

}

}

long currentTime = manifest.getDvrTime();

DvrManifestEntryRangeGroup fragmentsToPurge = new DvrManifestEntryRangeGroup();

DvrManifestEntryRange entryRange = manifest.getLiveRangeEndingBeforeTime(currentTime - timeShiftSeconds*1000);

if (entryRange != null && !entryRange.isEmpty()){

fragmentsToPurge.addRange(entryRange);

}

// Dirty hack there. We use only one version :slight_smile:

manager.purgeManifestEntries(stream.getName()+".0", fragmentsToPurge);

}