Multiple Streams from singe Monitor

Forum for questions and support relating to the 1.32.x releases only.
Post Reply
klcstaysbusy
Posts: 2
Joined: Sun Feb 23, 2020 2:08 am

Multiple Streams from singe Monitor

Post by klcstaysbusy »

Maybe the subject was phrased incorrectly, I apologize..

Here's the setup

ZoneMinder Host
Debian 9 (TKL ZoneMinder)
ZM version 1.30.4

Camera
Ubiquiti UVC-3 Bullet

Other Elements
UniFi Video Controller

Monitor Config
Image

My issue is mostly presentation related, in that everything works between the Camera that sends its live stream to the UniFi Controller, and from there, Zoneminder looks to the UniFi Video Controller for the RTSP stream of the camera which theirs a ZM Monitor setup for.

I'm also embedding the stream coming from ZoneMinder for this monitor into a custom webpage.

Example --

<html>
<body>
<p>My Monitor</p>
<img src="https://custom.webpage.com/zm/cgi-bin/n ... 1582429740"
</body>
</html>

The issue is that at any given time, I can't seem to open more than 2 separate instances of this embedded live stream (to this same camera / zm monitor) either in multiple browser tabs, or between separate devices in their respective browsers.

For example, if navigate to the embedded live stream on 3 different devices, and the live stream opens on the first 2 sessions to tap into the footage, the 3rd device in line fails to load the live stream, until I close the browser to this live stream on one of the other devices.

I imagine this falls into a recommended use for RTMP, Wowza, things of that nature for providing this for the masses, but I opted for ZoneMinder for the sake of keeping this self-hosted, etc.

The plan is to have these live streams available on Marketing related web pages for my company, and so I didn't know what the best course of action was here.

On a side note, I have created more than one monitor aimed at the same Camera, and have considered having the secondary monitor for a fallback in the event viewers have the original monitor tied up but I'm not super savy with how the HTML code would need to be expressed (if this could even be done via HTML) so that a fallback monitor could allow viewers to watch if the initial monitor stream is being occupied.

**UPDATE**

I think I pinpointed the source of my problem.

If I launch multiple instances of the stream by directly launching the view of the monitor from the ZoneMinder dashboard, the image URL API issues a slightly different token at the end of the URL to make a distinction for that session, and therefore I have no issues launching multiple instances of the same camera stream directly from the ZM dashboard link it self.

Example --
First tab open URL ends with "rand=1582430624"

Next tab open to same monitor ends with "rand=1582430654"

So this makes me think its an API solution I need read up on so that my custom web page calls through the ZM API for a unique URL on any instance viewing the stream (as though this were being done from the ZM Dashboard link).
klcstaysbusy
Posts: 2
Joined: Sun Feb 23, 2020 2:08 am

Re: Multiple Streams from singe Monitor

Post by klcstaysbusy »

Problem solved (sort of)..

So the issue being, this is a session layer matter, not Multicast, not really a presentation layer issue either.

I re-read the API documentation, and noted where the embedded URL need not include anything after the auth token except the "&connkey=XXXXX"

I noted where I could alter and/or increment the number of the connkey, and launch a new instance with each incremented connkey number.

Example --

First launch of live stream URL ending with "&connkey=46396"

Second launch of live stream URL ending with "&connkey=46397"

Third launch of live stream URL ending with "&connkey=46398"

And so on...

So I need only figure a way to generate an incremental, or potentially a totally random but unique connkey on any given session when a visitor clicks to watch the live stream.
User avatar
snake
Posts: 337
Joined: Sat May 21, 2016 2:20 am

Re: Multiple Streams from singe Monitor

Post by snake »

For reference, If this is on the LAN you can just use https://wiki.zoneminder.com/Example_Camera_View_HTML
and viewtopic.php?f=37&t=26982
viewtopic.php?f=40&t=29064
e.g.

Code: Select all

<img width="412px" height="268px" src="http://IPOFZMSERVER/zm/cgi-bin/nph-zms?mode=jpeg&monitor=1&scale=100"&user="watchinguser"&pass="somepassword" >
User avatar
iconnor
Posts: 2879
Joined: Fri Oct 29, 2010 1:43 am
Location: Toronto
Contact:

Re: Multiple Streams from singe Monitor

Post by iconnor »

The connkey is for identifying a communication channel to the streaming process zms. There is locking in place to prevent multiple people from talking to the same channel. If you aren't going to be talking back to zms, then you can leave off the connkey and it will work fine and will even be a little lighter-weight as it won't open and listen on the communications channel.
Post Reply