STANAG 4609 Player .NET SDK
Version 3.9.1
|
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.
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:
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.
If a user requests the content recorded a long time ago, the player will go directly to the externally recorded video.
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.
The amount (duration) of the video that can be stored in the local buffer depends on the video bitrate.
In order to use the SDK in DVR mode, pass True to the CKlvPlayer constructor.
Next, proceed with the usual Player initialization (as you would in the Stream Playback mode). You can configure some optional DVR parameters if needed:
Start the player.
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).
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.
To go to the live edge, call GoToLive method.
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.