KronTalk

Chronos => Software Dev => Topic started by: Kristian on September 11, 2020, 04:16:34 AM

Title: Web API control: /control/startPlayback results in 400 error
Post by: Kristian on September 11, 2020, 04:16:34 AM
Hi!

I'm doing some testing with Node.js to remote control the camera via a custom web interface.

Here's part of my Node.js code, which is inside a try/catch block inside an async function.
The recording works fine, but the startPlayback command gives me a 400 error:
https://gist.github.com/kristianpedersen/107a127251698d44e7dad08c265f72dd

I tried reading the source code of the Chronos web control panel, and it seems like the play button sends two different calls to "/control/startPlayback", changing the framerate to 60 or 0, in order to play and pause.

Is there some kind of state that needs to be toggled before I can play back the last recorded video?
Why does the Chronos web interface work, and not my Node.js code?
Title: Re: Web API control: /control/startPlayback results in 400 error
Post by: sanjay on September 11, 2020, 02:39:28 PM
Hi Kristian,

Are you able to get the startPlayback to work if you use a curl command? On my camera here in the office, the below command will successfully put the video pipeline into playback mode and
advance through frames as expected:

curl --header "Content-Type: application/json" --request POST --data '{"framerate":60, "position":0}' http://192.168.1.118/control/startPlayback


I took some time to try out the axios client in some test scripts as well and had trouble with post requests whenever they needed extra parameters, so I think something is missing there.
Title: Re: Web API control: /control/startPlayback results in 400 error
Post by: Kristian on September 14, 2020, 02:35:12 AM
Thanks, Sanjay! The curl command works perfectly.

I'm having some issues if I disable auto save though:

Recording works fine, but it doesn't play back unless I've hit hit "play" on the camera to enter the playback window.

Is there another command available, so I can switch into this mode and then start playback?