At the beginning of the Playback() process in TcpVideoViewer, it may take time to receive the video stream once.

I am using `MIPSDK\ProtocolSamples\TcpVideoViewer`.

In `ImageServerConnection.cs`, there is a `Playback()` function. This function receives a video stream using the `goto` method of MIP SDK.

However, after 1 to 2 minutes from the start of the reception process, the video stream can no longer be received.

Specifically, I want to retrieve the video stream every second using `RecvUtil()`, but it sometimes takes several seconds to receive a single frame.

This delay continues for several to tens of seconds, which causes a problem.

At this time, when checking the header at line 491, `h.Current` and `h.Next` have the same timestamp.

Please tell me the cause of this issue and how to resolve it.

    301         public void Playback()
    302         {
    303             Stream networkStream = null;
    304
    305             try
    306             {
    307
    308                 networkStream = ConnectToImageServer();
    309                 // Errors are handled by ConnectToImageServer
    310                 if (networkStream == null) return;
    311
    312                 _playback = true;
    313                 int maxbuf = 1024 * 64;
    314
    315                 string sendBuffer = FormatConnect();
 
 
    382                     sendBuffer = string.Format(
    383                         "<?xml version=\"1.0\" encoding=\"utf-8\"?><methodcall><requestid>{0}</requestid>" +
    384                         "<methodname>goto</methodname>" +
    385                         "<time>{1}</time>" +
    386                         "<compressionrate>{2}</compressionrate>" +
    387                         "<keyframesonly>no</keyframesonly>" +
    388                         "</methodcall>\r\n\r\n",
    389                         ++count, _playbackTime, qual);
    390
    391                     bytesSent = Encoding.UTF8.GetBytes(sendBuffer);
    392                     networkStream.Write(bytesSent, 0, bytesSent.Length);
    393
    394                     bytes = RecvUntil(networkStream, bytesReceived, 0, maxbuf);
    395                     if (bytes < 0)
    396                     {
    397                         throw new Exception("Receive error A");
    398                     }
 
 
 
    490                         // Stop if we reach the end of the sequence
    491                         long nextTime = long.Parse(h.Next);
    492                         if (nextTime > PlaybackEndTime)
    493                             break;
    494
    495                         // If there is no more video, do not keep repeating the last image, but stop the playback.
    496                         if (nextTime == _playbackTime)
    497                             break;
    498
    499                         int interval =
    500                             (int) (nextTime -
    501                                    _playbackTime); // We ought to subtract also the number of milliseconds elapsed in real time since last update
    502                         _playbackTime = nextTime;
    503
    504                         Thread.Sleep(interval / _speed);
    505                     }

For a baseline before troubleshooting the sample could you please make some observations.

When using the same camera from the same PC using the same user, does Smart Client perform playback without any delays or pausing?

Is the camera setup in a way where you know there will be video to playback at the time? For testing purposes perhaps you could temporarily make a rule so that the camera always records.

If you test with another camera is the behavior the same?

Playback will always start with a key frame, therefore these settings might be of special interest: ‘Max frames between keyframes’ and ‘Max. frames between keyframes mode’, if making the mode ‘yes’ or lowering the max, does it mediate the issue? What are these settings?

Generally settings can be so that either the camera itself or the recording server isn’t performing well, if you use settings that lower the resolution or bitrate or similar can you make the issue go away?

What version is XProtect VMS? Can you confirm you use the newest sample?

I have indications than when “Next” is the same as “Current” it means that you have reached the end of the database, in other words; nothing newer is recorded and you have reached the end of video data available for playback. This points back to my question whether you know there is video to playback.

Thank you for your reply.

I will respond regarding the case when “Next” is the same as “Current.”

This phenomenon occurs when playing back recorded video. It does not occur when specifying a time about 2 minutes before the current time, but it does occur when specifying a time closer to the current time (for example, about 1 minute before the current time).

Could this be related to limitations of XProtect in terms of video storage and recording?

If you ask for playback too close to the present time you will most likely get the end of the database, the last video data that has been stored.

This is a known limitation. If you need live images please use live interface/methods in the Image Server, if you need playback please ask for data from a time that is not too close to the present time.

I understand your response. Please tell me a bit more.

The situation where “Next” is the same as “Current” tends to occur intermittently for several minutes to tens of minutes, and after that, it tends to stop occurring. Is this also a known issue?

Also, if there are any official documents regarding the known limitations, please let me know.

I think it can happen as a result of the setup, rules on when to record and stream video are relevant, it is not necessarily because of an error situation. If there are intermittent errors on the camera or on the recording server it would explain yours observation.

In the case it is setup or general errors that is the issue you will be able to observe the same in the Smart Client and it is not down to the sample and the way the sample works.

What is your recording rules? Your streaming rules? Do you have default rules only? Do you see Communication Error or other errors pertaining to the camera in the Server Logs- System logs in the Management Client?

You are using a very old sample, please for reference and troubleshooting switch to use the newest sample. - https://github.com/milestonesys

I would really like to hear if another camera or camera simulator results in the same issues… https://doc.developer.milestonesys.com/html/index.html?base=gettingstarted/stablefps.html&tree=tree_home.html

The same issue did not occur in the Smart Client.

We are only using the default rules.

No errors were shown in the server logs.

We compared the sample included with MIPSDK 2022 and the XProtect 2024 R1 release (https://github.com/milestonesys/mipsdk-samples-protocol/blob/main/TcpVideoViewer/ImageServerConnection.cs), but found no differences.

We have received an official response that this is a known limitation, so we will consider possible countermeasures.

With this, we would like to close the inquiry.

Best Regards

Thank you for your reply.

I will check if the Smart Client can play the video without delay or pauses when using the same camera with the same user on the same PC.

Since I cannot prepare a different camera, I won’t be able to verify that.

I will try lowering the maximum number of keyframes, as well as adjusting the resolution and bitrate settings.

The version of XProtect VMS is 2024 R2, and the sample is from the MIPSDK 2022 version.