How can I check whether a playback video exist for a particular time stamp T ?

We are working on a MileStone Component Integration for both 32 bit and 64 bit MIP SDKs. Our goal is to communicate with MileStone VMS, and

1. Show the live and playback streaming of a camera through our application.

2. Initiate PTZ and Preset operations on a camera through our application.

My question is, for Playback Stream - how can I check whether a playback video exist for a particular time stamp T. Currently, if video is not available for T, Milestone either provide oldest available playback video or the live video.

For example, if the VMS has oldest playback from 01/02/2021 4:00:00 AM and end-user requested a playback video older than the last available playback time(say 04/15/2020 07:05:45 AM), VMS will start providing the video from 01/02/2021 4:00:00 AM. On the other hand, if the end-user requested a playback on 04/15/2021 when the current date is 01/05/2021, VMS will provide the live stream.

I am wondering if there is any SDK support using which I can determine whether the requested playback-video is available or not, so that I can give an alert message to my end-users.

There are two options:

  1. You could see the timestamp of a picture, see if it in the expected time frame.
    
  2. You could ask for sequences which gives you timing information, when there is recorded footage and when there is not.
    

Please explore DataSource sample which demonstrates this.

https://doc.developer.milestonesys.com/html/index.html?base=samples/datasource_sample.html&tree=tree_1.html

Hi Rie,

I have gone through few posts in the Milestone Developer Forum regarding how we can use Sequence data to get playback time-line records. I have few more queries:

1. >> You could see the timestamp of a picture, see if it in the expected time frame.

Not understood the above statement clearly. Where I will find such pictures and how can I access those images programmatically via Milestone SDKs.

2. I have found that in XProtect C-code (XProtect Advanced VMS) and E-code (XProtect Professional VMS) products the types of sequences are different. To get the time line records, I have used following code:

var sequences = dataSource.GetData(archieve_DateTime.ToUniversalTime(), new TimeSpan(0, 1, 0), int.MaxValue, new TimeSpan(0, 1, 0), int.MaxValue);

Apart from the above code is there anything else that I need to do to handle the different implementation of sequence data in different milestone product.

3. I already explained my requirements in this post. In simple words, before requesting playback for a particular time stamp, I want to check if any playback exist for that time stamp. In the above statement, the parameters of the GetData method are as follows:

a. maxTimeBefore = 1 minute,

b. maxCountBefore = int.MaxValue,

c. maxTimeAfter = 1 minute,

d. maxCountAfter = int.MaxValue

Now, suppose last(or oldest) playback video exist on 02/03/2021 4:17:20 AM and I want to check the playback of 02/02/2021 4:17:20 AM(1 day back). In that case no sequence will be found 1 minute before or after 02/02/2021 4:17:20 AM and I can conclude that no playback exist 02/02/2021 4:17:20 AM. Please feel free to correct me if my conclusion is wrong.

Now, if I want to check the playback on 02/03/2021 4:16:20 AM(just 1 minute back), does this approach give me correct result.

4. From the discussion in different posts, I found there are different types of sequences, such as, MotionSequence, RecordingSequence, RecordingWithTriggerSequence,

TimelineMotionDetected,TimelineRecording. I am little bit confused. I just want to record my video always even if there is no motion is detected or any event occurred.

One Way to get a picture is VideoOS.Platform.Data.JPEGVideoSource.GetAtOrBefore (DateTime dateTime) and then use DateTime VideoOS.Platform.Data.JPEGData.DateTime to get the time of the picture.

https://doc.developer.milestonesys.com/html/index.html?base=miphelp/class_video_o_s_1_1_platform_1_1_data_1_1_j_p_e_g_video_source.html&tree=tree_search.html?search=jpegvideosource

https://doc.developer.milestonesys.com/html/index.html?base=miphelp/class_video_o_s_1_1_platform_1_1_data_1_1_j_p_e_g_data.html&tree=tree_search.html?search=jpegvideosource

The CameraStreamResolution sample might be a help, seeing how the JpegVideoSource is used in that sample.

https://doc.developer.milestonesys.com/html/index.html?base=samples/camerastreamresolution.html&tree=tree_search.html?search=jpegvideosource

No.

The DataSource plugin sample might be a help.

https://doc.developer.milestonesys.com/html/index.html?base=samples/datasource_sample.html&tree=tree_search.html?search=datasource

Correct.

In E-code there is only MotionSequence, asking for RecordingSequence you will get a MotionSequence. I doubt it will work in the scenario you outline. Unfortunately, there will be no correction of this in E-code as it is end of life.

https://doc.developer.milestonesys.com/html/index.html?base=miphelp/class_video_o_s_1_1_platform_1_1_data_1_1_data_type_1_1_sequence_type_guids.html&tree=tree_search.html?search=recordingsequence+

The two TimelineX sources actually translate the sequence to one-minute intervals, effective only if you intend to build a time-line.

RecordingSequence is the sequences with recorded footage.

MotionSequence is the sequences where motion detection is triggered.

RecordingWithTriggerSequence is the sequences that is triggered in other ways than motion detection, i.e. users triggered recording in the clients.

Thanks for all the information. I have couple of more queries:

I am using XProtect Essential+ 2020 R3. I have a camera HikVision DS-2CD2010F-I and I keep it switch on always.

1. I used the following statements to get sequence data and just for discussion I pasted few data here:

var sequences = dataSource.GetData(archieve_DateTime.ToUniversalTime(), new TimeSpan(0, 1, 0), int.MaxValue, new TimeSpan(0, 1, 0), int.MaxValue, VideoOS.Platform.Data.DataType.SequenceTypeGuids.RecordingSequence);

string s = “”;

foreach (SequenceData sequence in sequences)

    {

      s += "\\n" + [sequence.EventHeader.Name](https://sequence.EventHeader.Name) + " " + sequence.EventSequence.StartDateTime.ToLocalTime().ToString() + " TO " + sequence.EventSequence.EndDateTime.ToLocalTime().ToString();

    }

16-02-2021 19:44:06 TO 16-02-2021 19:44:17

16-02-2021 19:44:49 TO 16-02-2021 19:45:00

16-02-2021 19:52:51 TO 16-02-2021 19:53:02

16-02-2021 19:54:12 TO 16-02-2021 19:54:23

16-02-2021 19:54:52 TO 16-02-2021 19:55:04

16-02-2021 19:59:51 TO 16-02-2021 20:00:02

16-02-2021 20:01:13 TO 16-02-2021 20:01:24

16-02-2021 20:03:02 TO 16-02-2021 20:03:13

16-02-2021 20:39:10 TO 16-02-2021 20:39:21

If we check the last two entries, there was 36 minutes gap. I have analyzed some other data also and found similar kind of gaps. Please correct me if I am wrong, but I have a feeling that Milestone only saves video if there is some kind of motion happened in front of camera. If I keep the camera in a place where there is always some kind of activity, gap length reduces to few seconds only.

I am wondering whether XProtect Essential+ 2020 R3 comes under E-Code Products or C-Code. If it is come under E-Code, why I am not getting a continuous recording information, even if I am asking for SequenceTypeGuids.RecordingSequence.

2. I am using following controls for playback streaming:

<platformclient:ImageViewerWpfControl x:Name=“playbackPlayer” />

<platformclient:PlaybackWpfUserControl x:Name=“_playbackUserControl” />

I can see the playback date time over the video running on ImageViewerWpfControl, but did not find any way to access that current playback date time from those controls. I am wondering if there is any easy way to get that date part just like we can get the date part from JPEGData object:

VideoOS.Platform.Data.JPEGVideoSource.GetAtOrBefore (DateTime dateTime) and then use DateTime VideoOS.Platform.Data.JPEGData.DateTime

Let me explain C-code product and E-code product. C-code products are Corporate, Expert, Professional+, Express+ and Essential+. E-code products are Professional and Express which Milestone no longer released since 2019 R2.

Note : C-code products and E-code products are completely different, not only products but also source code.

Please see PlaybackController, it might be helpful.

https://doc.developer.milestonesys.com/html/index.html?base=miphelp/class_video_o_s_1_1_platform_1_1_client_1_1_playback_controller.html&tree=tree_search.html?search=playbackcontroller