Can't view stream over the web [SOLVED]

Forum for questions and support relating to the 1.30.x releases only.
Locked
basketcase
Posts: 31
Joined: Thu Aug 22, 2013 10:04 pm

Can't view stream over the web [SOLVED]

Post by basketcase »

Hi,

I recently decided to switch my older Centos 6.7 for a new Ubuntu 16.04 build, ZM 1.30 iconnor/zoneminder repo installed without a hitch, or at least I thought.

Fairly certain this is an apache setup issue, but I can't pin it down.

I have montage view working inside my own LAN but via the web it will not load, looking at the browser dev tools I can see as the montage is loaded it calls the normal external domain name, then for the streams themselves the cgi calls are to the hostname of the server itself, which explains why it works inside the network - but I can't for the life of me workout why just the nph-zms calls are reverting to the hostname.

Any pointers would be awesome!

Cheers!
Last edited by basketcase on Sat Oct 22, 2016 2:52 am, edited 1 time in total.
bbunge
Posts: 2930
Joined: Mon Mar 26, 2012 11:40 am
Location: Pennsylvania

Re: Can't view stream over the web

Post by bbunge »

I know of no reason why montage will not work for you port forwarding through your firewall. There is a chance that it is your web browser and not your Ubuntu/Zoneminder setup. If you are using Firefox make sure you have done the browser fixes for montage. Otherwise look over the instructions in the WIKI to see if the instructions you followed had you do something different: https://wiki.zoneminder.com/Ubuntu_Serv ... der_1.30.0
basketcase
Posts: 31
Joined: Thu Aug 22, 2013 10:04 pm

Re: Can't view stream over the web

Post by basketcase »

Thanks for getting back to me.

I've tried a bunch of tests, I noticed it didn't work on iPhone, so tried Chrome and firefox on my lappy. Firefox has the browser fixes already as I'm a long time ZM user.

Ran my laptop with a 4G wireless connection.

It's not a Http or Https issue as I forwarded both sets of ports independently and tested both with the same behaviour. I have working ssl certs on the ZMserver but brought it back to http for testing.

In Firefox / Chrome if you use the devtools - Network, you can see each object load and the domain being connected to.
Looks similar to:

Code: Select all

www.homezoneminder.com    items.js  50ms
www.homezoneminder.com    montage.js 62ms
ZONEMINDERSERVERNAME       stream1     12000ms
ZONEMINDERSERVERNAME       stream2     12001ms
Obviously I've changed my real external URL's into whats above but you get the idea...

Streams obviously don't load as there's no DNS entry on the www to connect to that ZONEMINDERSERVERNAME... but on my home network that works just fine.

I also went through all the setup details again before posting because my first thought was I missed a command to enable an apache mod or giving a permission to www-data or something... All are enabled, the ZM instance appears to work perfectly aside from this issue.

The other thing worth mentioning it will also play back events fine over the web.
User avatar
knight-of-ni
Posts: 2404
Joined: Thu Oct 18, 2007 1:55 pm
Location: Shiloh, IL

Re: Can't view stream over the web

Post by knight-of-ni »

I still don't understand if you are saying that live streaming does not work at all outside your firewall, or live streaming works, one monitor at a time, and only montage doesn't work.

Shows us:
- contents of your servers tab
- value of ZM_SERVER_HOST in zm.conf
- full zoneminder log, from the moment you start zoneminder up until just after you attempt to view the live stream
Visit my blog for ZoneMinder related projects using the Raspberry Pi, Orange Pi, Odroid, and the ESP8266
All of these can be found at https://zoneminder.blogspot.com/
basketcase
Posts: 31
Joined: Thu Aug 22, 2013 10:04 pm

Re: Can't view stream over the web

Post by basketcase »

Apologies,
To clarify:
-Live streaming works inside my own network (inside firewall)
-Outside of network, ZM (its a single server instance) works for event playback and all other features except for live streaming single or montage, niether will play. I've tried differing browsers, devices and never seen this behaviour before.
-When I investigate that I can see the browser calls to the live streams are directed at the hostname of the ZM server rather than a full URL, which of course will not work outside the network which explains why the streams don't load outside.

I've had a busy couple of days and I'm 3 minutes from rushing to work again, so I'll have another crack at this on the weekend.

To answer the quick questions I can:
ZM_SERVER_HOST

Code: Select all

# Do NOT set ZM_SERVER_HOST if you are not using Multi-Server
# You have been warned
#
# The name specified here must have a corresponding entry
# in the Servers tab under Options
ZM_SERVER_HOST=
In the servers tab, I have the single server hostname listed.

I'll do some more testing on the weekend and grab the logs.
From what I've seen in the logs already, there's nothing telling there - no errors, no socket fails (I've experienced that once before with a bad cgi path) it looks good.

Thanks again :)
User avatar
knight-of-ni
Posts: 2404
Joined: Thu Oct 18, 2007 1:55 pm
Location: Shiloh, IL

Re: Can't view stream over the web

Post by knight-of-ni »

basketcase wrote: In the servers tab, I have the single server hostname listed.
That right there is the problem. Why did you do that? None of our instructions told you to set that.
Your servers tab should be left alone (completely blank) if you don't want to use the Multiserver feature, which right now is not firewall friendly.
Visit my blog for ZoneMinder related projects using the Raspberry Pi, Orange Pi, Odroid, and the ESP8266
All of these can be found at https://zoneminder.blogspot.com/
basketcase
Posts: 31
Joined: Thu Aug 22, 2013 10:04 pm

Re: Can't view stream over the web

Post by basketcase »

Aha, thanks!

As mentioned I'd changed over from my old build, which was years old and had many ZM upgrades starting at maybe 1.23 or 4...

Being a lazy sod and figuring I'm going from 1.30 to 1.30: I migrated the database + all the settings in which the server had been set on the old build (less events) without incident and was quietly pleased as all the cams and things came online and I did update the server tab as it had the former server's hostname which never caused an incident before so had no reason to think it would now...

...turns out I was completely wrong!

Thanks again you narrowed it right down for me, cheers!
basketcase
Posts: 31
Joined: Thu Aug 22, 2013 10:04 pm

Re: Can't view stream over the web

Post by basketcase »

Just to thank you again, now all is working 100% - Quick update on the last ironing out of kinks in case someone else does the same stupid thing I did quite by accident.

FIX
Once I removed the servers and checked the server table was empty I was getting errors in the log:

Code: Select all

Unable to load Server record for Id=1
...and socket creation errors, knowing the socket directories are fine I looked for this ServerID.

Looking at the /usr/share/zoneminder/www/includes/Monitor.php quickly guided me to the serverID field in the monitors, which was set to 1 on all monitors.

Did a quick SQL Update

Code: Select all

update `Monitors` set  `ServerId` = 0  where `Id` > 0


Seeing as I have no servers as you were good enough to point out, it all went back to normal after a restart.

Thanks again, I don't think I would have narrowed it down to that without your input.
Locked