I’m new in milestones SDK so sorry for the probably basic question.
I’m developing a plug-in. In general, when I receive an event from a camera I want to start recording few second before the event occurred. Due to other plugin requirements, I can’t use Rules I want to do this in code.
When I sent a message
EnvironmentManager.Instance.SendMessage(new Message(MessageId.Control.StartRecordingCommand), cameraFQID);
recording start immediately but I missing pre-buffered part of the video. I need only 2 or 3 sec before the event, no matter how long pre-buffer time is set.
Is it possible to start recording before the event occurred from code?
Thanks in advance
You need to configure the pre-buffer on the camera (in management client) - then you will get the configured number of seconds before the event recorded as well.
Thank You for your response Anders.
Pre-buffer time is set for a camera and works fine when eg recording is triggered by motion(default rule). But when I start recording from code by sending StartRecordingCommand, video not contains pre-buffered part.
This is strange - the StartRecordingCommand is actually triggering a rule - so it all works in the same way.
How have you checked that the video is in the database?
Can you single step frame by frame in the Smart Client and see what is available?
I simply check in Playback tab what was recorded. I don’t know if it is a good approach, but I solved this by adding new simple rule:
Perform an action on Analytics Event (Analytics Events)
from All cameras
start recording 5 seconds before on the devices from metadata
Perform action 5 seconds after
stop recording immediately
and in code I send Analytics Event instead of StartRecordingCommand
EnvironmentManager.Instance.SendMessage(new VideoOS.Platform.Messaging.Message(MessageId.Server.NewEventCommand) { Data = eventData });