Can I start and stop recording of a camera using the Web SDK ?

I cannot find a clue in any example provided with the javascript library.

Hi Alexandre, you cannot do that.

Br,

Nikolay

Hi Nikolay,

Thank you for your answer.

Can I do that with any other library provided by Milestone ?

Alexandre

Not with any API provided by the Mobile server…

I’m not an expert on other APIs but this forum thread seems related

https://developer.milestonesys.com/s/question/0D50O00003EIrxQSAT/startstop-record-manually-using-sdk

@Alexandre Quivy​ Actually there’s a workaround to achieve what you need via Mobile Server’s API, given you have pre-setup your VMS config.

First part - setup.

Open Management client and do the following configuration:

  1. Make sure recordings are enabled on your camera (mine is called ‘Bunny camera’, on the image below)
  2. Create two user-defined events (I have called mine ‘Start rec’ and ‘Stop rec’)
  3. Create a new rule and specify your camera and events
  4. Make sure you don’t have conflicting rules, e.g. a rule saying all cameras should record always.

Second part - requests to Mobile Server.

Beware - I’ll describe this in terms of our command protocol. I’m sure you’ll be able to relate this to the Javascript API (Web SDK):

  1. Call GetOutputsAndEvents and find in the response what’s the ID of your event - lines 12 and 13 in the code snippet below:
<?xml version="1.0" encoding="utf-8"?>
<Communication xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
	<ConnectionId>2daecd2c-ceb6-4761-98b3-4af0878b82da</ConnectionId>
	<Command SequenceId="753">
		<OEHeaderGroup Name="Outputs" CameraId="00000000-0000-0000-0000-000000000000" SubsCount="3" Type="OutputsGroup">
			<OEGroup Name="Whatever Camera" CameraId="79be95fb-8abf-4391-96c9-0aafe625b0e8" SubsCount="1">
				<OEItem Name="Whatever Output" ObjectId="0692e1c0-15fd-4711-89f2-e59949991b66" CameraId="79be95fb-8abf-4391-96c9-0aafe625b0e8" CanActivate="true"/>
			</OEGroup>
		</OEHeaderGroup>
		<OEHeaderGroup Name="Events" CameraId="00000000-0000-0000-0000-000000000000" SubsCount="10" Type="EventsGroup">
			<OEItem Name="Whatever Event" ObjectId="423a2d7c-a005-483a-a7be-ed61f38985eb" CameraId="00000000-0000-0000-0000-000000000000" CanActivate="true"/>
			<OEItem Name="Start rec" ObjectId="31931ee0-43cf-4643-8730-ef7f5f2b37aa" CameraId="00000000-0000-0000-0000-000000000000" CanActivate="true"/>
			<OEItem Name="Stop rec" ObjectId="2507d71d-006c-4624-95ea-09cb1576df76" CameraId="00000000-0000-0000-0000-000000000000" CanActivate="true"/>
		</OEHeaderGroup>
		<Type>Response</Type>
		<Name>GetOutputsAndEvents</Name>
		<InputParams/>
		<OutputParams>
			<Param Name="Challenge" Value="03323B58-12B0-4ED1-816B-345B86EF4BD6"/>
		</OutputParams>
		<Items/>
		<Result>OK</Result>
	</Command>
</Communication>

2. Call RequestActivation with the ID of the corresponding user-defined event. E.g. request to start recording:

<?xml version="1.0" encoding="utf-8"?>
<Communication xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
	<ConnectionId>2daecd2c-ceb6-4761-98b3-4af0878b82da</ConnectionId>
	<Command SequenceId="771">
		<Type>Request</Type>
		<Name>RequestActivation</Name>
		<InputParams>
			<Param Name="ObjectId" Value="31931ee0-43cf-4643-8730-ef7f5f2b37aa"/>
			<Param Name="TriggerType" Value="TriggerEvent"/>
			<Param Name="Challenge" Value="4D78E159-989D-4616-AA05-A4854114CD63"/>
			<Param Name="ChalAnswer" Value="YvwmTYWYQd53TzISfodvYFKlVtvVUzLlXwBchgbGw7mlP9eGrtcLy8R+v7bItJXizC+rNRtm2rvqmz1oZ5kEoQ=="/>
		</InputParams>
	</Command>
</Communication>

Br,

Nikolay

Hi Nikolay,

I had already this solution in mind but it requires a lot more work during deployment (specific configuration for each camera).

I also have to parametrize my integration code as it cannot know which ID to use until it is configured.

Thank you anyway.

Alexandre