STANAG 4609 Player .NET SDK  Version 4.0.0
StanagOnDemand VMS client

STANAG Player SDK can serve as a client for the STANAG OnDemand server VMS.

By default, the demo application is installed in "C:\Program Files\ImpleoTV\StanagPlayerSdkNet\Samples\KlvPlayerStServerClientTestApp" directory. Open the KlvPlayerStServerClientTestAppPr.sln solution and build it as a 64 bit application (debug or release).
Make sure NuGet packages are restored.

StServerClientDemo.jpg
STANAG OnDemand server VMS client

Sample code.

The code is very similar to the code in the basic file/stream console app. STANAG OnDemand server VMS has a REST API interface and can be used by a client to get a video url. This url should be then provided to the player. You can use any method to access the server. The demo application is using a helper library StServerUtils that handles some basic tasks.

In order to use it, add the reference to the StServerUtils and make sure RestSharp and SocketIOClient nuget libraries are installed.

Creating Player Instance.

First, make sure you have all prerequisites in place. For more info on Prerequisites.

Create the player instance:

// Create Player instance
CKlvPlayer m_KlvPlayer = new CKlvPlayer();

Configuring events.

Setup events

// Setup events
m_KlvPlayer.PlayerEvent += new NotifyPlayerEvent(OnPlayerEvent); // Player general events notification
m_KlvPlayer.ErrorEvent += new NotifyError(OnErrorEvent); // Player error events
m_KlvPlayer.PidDetectionEvent += new NotifyPidDetection(OnPidDetectionEvent); // PID detection events (video / KLV / audio / data)
m_KlvPlayer.SyncFrameEvent += new NotifySyncFrame(OnSyncFrameEvent); // Synchronized Video frames / Klv / Private data. For more info on Video / Data sync see \ref pageSync

Create StServerUtils instance and wire events:

StServerUtils m_StServer = new StServerUtils(m_ServerUrl);
m_StServer.InfoReceived += StServer_InfoReceived;
m_StServer.StateChanged += StServer_StateChanged;

StServer_StateChanged event will report the state. When the server is online, you can query it for a list of available missions. Once you have a mission name, get a video url using m_StServer.BuildSensorUrl method.

m_StServer.BuildSensorUrl(m_SelectedMission).ContinueWith(u =>
{
if(u.Status == TaskStatus.RanToCompletion)
{
m_Url = u.Result;
}
});

Initializing Player

Initialize the Player

// Initialize the player
m_KlvPlayer.Init(m_Url);

Optional parameters:

m_KlvPlayer.RenderVideo - true / false // Set to true if you want to render the video, false if you don't need it (when you only need metadata or decoder frames)
m_KlvPlayer.RenderAudio - true / false // Set to true if you need audio processing.
m_KlvPlayer.VideoCaptureMode.uncompressedVideo -
UncompressedVideoMode_None
UncompressedVideoMode_Rgb
UncompressedVideoMode_Yuv
UncompressedVideoMode_Grayscale
m_KlvPlayer.VideoCaptureMode.fCompressedVideo - true / false // set to true if you don't need an uncompressed frame, but still want to get video timing info.
m_KlvPlayer.Hwnd // Window handle to render video to. If set to 0, the window will be created internally.
m_KlvPlayer.MaxSyncDelay - buffer size in ms // Allowed Sync time for video / data synchronization
m_KlvPlayer.CalculatePacketRate - true / false // Enable / disable Calculation of average rate for received packets

Starting Player

Now, all you need is to start playback.

// Start Playback
m_KlvPlayer.Start();

Video will be rendered in the Window provided during the initialization phase and OnKlvDataEvent method will be called on Klv data arrival.

Playback Events

During the playback, the relevant events (if set) will be fired.

Player Events.

For a complete code sample please use the KlvPlayerStServerClientTestApp demo project.

Untitled 1




 Copyright 2023,    IMPLEOTV SYSTEMS LTD