STANAG 4609 Player .NET SDK  Version 3.9.1
DVR mode.

DVR mode can be used for live low latency feed monitoring, delayed playback (time-shifting), recording, and on-demand investigation. The SDK uses externally recorded (as HLS Live) video segments and a local buffer (sliding window) recording, providing seamless switching between the two.
User can Pause the live stream, investigate the video frames / telemetry using frame accurate Step Forward / Backward methods, Seek. At any time he can Continue (resume) the playback from the current position (time shifted playback) and Go back to the low latency live edge.

Note
STANAG Player SDK does not provide recording (apart from short in-memory local buffer recording) functionality internally. You can use any HLS recorder that preserves original timestamps. StanagStream Recorder SDK or StanagOnDemand Server may be used.

DVR operation scenarios

DVR has 3 operating scenarios:

If DVR mode is set (at the player instance creation time, at the constructor), the player continuously records the video to the local (in memory) buffer. When a user pauses the live stream, trick mode operations, like Step Forward / Backward / Seek methods are first attempted on this local buffer:

DvrScenario1.png
DVR Scenario 1

At some point (when the time passed since the user pressed Pause exceeds the allowed local buffer recording time), the local sliding window is overridden with the new data, so the player will attempt to fetch the required data from the externally recorded video segments.

DvrScenario2.png
DVR Scenario 2

If a user requests the content recorded a long time ago, the player will go directly to the externally recorded video.

DvrScenario3.png
DVR Scenario 3

Local buffer size and RefTime MatchMode

DvrLocalBufferSize can be set at the initialization phase. The buffer size should define the required local recording time for a given stream bitrate.
DvrRefTimeMatchMode defines how to match the time of the live source and the recorded source. It can be done either by using PTS, or by matching Klv timestamps. If your recorded stream preserves the original timestamps, you can use the VideoPts mode. If some transcoding module in the middle overrides the timestamps, you can try to use the synchronization by KLV data (if exists) If stream's timestamps were changed and there is no Klv data present, there is no way to sync between the live and recorded video.

...
m_KlvPlayer.DvrLocalBufferSize = 20000; // In kBytes
m_KlvPlayer.DvrRefTimeMatchMode = DVR_RefTimeMatchMode.RefTimeMatchMode_VideoPts;
// Initialize the player
m_KlvPlayer.Init(m_Url);
...

The amount (duration) of the video that can be stored in the local buffer depends on the video bitrate.

Using DVR mode

In order to use the SDK in DVR mode, pass True to the CKlvPlayer constructor.

Note
Please note, if DVR mode (Shifted TV) is not needed, pass False to avoid the overhead related to DVR mode (constantly recorded video to the local buffer, etc).
...
m_KlvPlayer = new CKlvPlayer(true); // Create Player instance.
...

Next, proceed with the usual Player initialization (as you would in the Stream Playback mode). You can configure some optional DVR parameters if needed:

...
m_KlvPlayer.DvrRefTimeMatchMode = DVR_RefTimeMatchMode.RefTimeMatchMode_VideoPts;
m_KlvPlayer.DvrLocalBufferSize = 20000;
// Initialize the player
m_KlvPlayer.Init(m_Url);
...

Start the player.

...
m_KlvPlayer.Start();
...

The SDK engine will start recording to the local buffer (the size is configured via LocalDvrBufferSize property). When you pause the playback, the trick mode operations will be performed on that locally recorded buffer all the time the requested data is available.

At any time you can add an externally recorded video (as HLS manifest, for example).

...
m_KlvPlayer.AddRecordedUrl(m_urlDvrRecording);
...

When the decoder will need data that is not available locally, the player will seamlessly fetch it from the external url.

Pausing the player will freeze the currently displayed video, but the internal recorder will continue its operation. So, calling the Start method will resume the playback from the current position.

To seek the specific position, use SetPosition method.

...
m_KlvPlayer.SetPosition(pos);
...

To go to the live edge, call GoToLive method.

...
m_KlvPlayer.GoToLive();
...

For GUI presentation (for example to properly show the slider), you may need to know an available data range. GetAvailableRange method will do the job.

...
double posStart, posEnd;
m_KlvPlayer.GetAvailableRange(out posStart, out posEnd))
...
Untitled 1




 Copyright 2019,    IMPLEOTV SYSTEMS LTD