Page 1 of 1

ZMS Event stream controls

Posted: Tue Feb 09, 2016 8:42 pm
by BananaPukeh
When opening the /zms stream for a monitor, you can play events. But in the ZM console there are all kind of controls where the event stream can be manipulated with. Is there some kind of way to manipulate the stream from the /zms url like in the ZM console?

Re: ZMS Event stream controls

Posted: Tue Feb 09, 2016 8:53 pm
by asker
BananaPukeh wrote:When opening the /zms stream for a monitor, you can play events. But in the ZM console there are all kind of controls where the event stream can be manipulated with. Is there some kind of way to manipulate the stream from the /zms url like in the ZM console?
There are certain things you can control via the URL and certain things you can control by sending POST requests to zms.

To get you started:

1) As of today, a new zms is spawned for each incoming connection (to the best of my knowledge)
2) always make sure you use a unique connkey in the URLs that involve zms - you need the connkey to send it commands. If you don't generate a connkey, one is generated but you don't know about it and you can't talk to it (the zms-NNNNNN socket ids that people keep reporting about missing streams etc - each NNNN is a connkey)

read this file to understand how to send POST requests https://github.com/ZoneMinder/ZoneMinde ... s/event.js and this file to get a list of commands https://github.com/ZoneMinder/ZoneMinde ... ream.h#L60

Re: ZMS Event stream controls

Posted: Tue Feb 09, 2016 8:56 pm
by BananaPukeh
Ah thanks! Great explanation

Re: ZMS Event stream controls

Posted: Tue Feb 09, 2016 8:58 pm
by asker
BTW what are you building? I'm interested to see what people are doing with the APIs

Re: ZMS Event stream controls

Posted: Tue Feb 09, 2016 9:04 pm
by BananaPukeh
I'm developing a native iOS app for zoneminder, I'il let you guys know when it's ready :)

Re: ZMS Event stream controls

Posted: Tue Feb 09, 2016 9:07 pm
by asker
awesome - look forward to it. I'd also recommend you post to the Mobile Apps forum if you are developing a mobile app - its meant for this purpose as your questions are not really 1.29 related

Re: ZMS Event stream controls

Posted: Tue Feb 09, 2016 10:34 pm
by BananaPukeh
Hmm, can't seem to get it working.

I'm calling this url to start the event playing
note: i've added the connkey

Code: Select all

/zm/cgi-bin/nph-zms?mode=jpeg&monitor=1&scale=100&user=admin&pass=xxxx&connkey=1123
than I want to pause that stream, so I send command 1 in a POST request

Code: Select all

/zm/cgi-bin/nph-zms?mode=jpeg&monitor=1&scale=100&user=admin&pass=xxxx&connkey=1123&command=1
But nothing happens?

Re: ZMS Event stream controls

Posted: Tue Feb 09, 2016 10:35 pm
by BananaPukeh
Than I will make my future posts in Mobile apps ;)

Re: ZMS Event stream controls

Posted: Wed Feb 10, 2016 12:42 am
by asker
The invocation is wrong - please see the code I pointed to and trace through the invocations in streamReq.send
the view/request/connkey and auth need to be inside the data part of the POST not the url.

Some other notes: the pause is unreliable, once you do get it working :-D ZMS has many issues