ZoneMinder Client Mobile Application for Android

If you've made a patch to quick fix a bug or to add a new feature not yet in the main tree then post it here so others can try it out.
danko
Posts: 5
Joined: Fri Aug 09, 2013 11:28 am

Re: ZoneMinder Client Mobile Application for Android

Post by danko »

awesome !!!
TheKorn
Posts: 142
Joined: Fri Aug 02, 2013 12:39 pm

Re: ZoneMinder Client Mobile Application for Android

Post by TheKorn »

kevin186 wrote:Hi everybody. I am sorry that I have not released a newer version lately as I have been busy with work and family. I will try to find time to clean up my current version that I use so that I can let everyone else try it.
That would be awesome! I paid for zmview on g'play, but I like how your app works a lot better. (It just doesn't do events, which is why I keep zmview around.)

Thanks!
kevin186
Posts: 55
Joined: Mon May 10, 2010 4:11 am
Location: Worth, IL

Re: ZoneMinder Client Mobile Application for Android

Post by kevin186 »

I just packaged the latest version of my app and the corresponding skins @ http://dvr-security.net/mobile/zmc/ .

Please make sure that you follow the instructions and install the new skins, otherwise the app will not work.

I still have not added event playback. Instead, I have focused on cleaning up my code and optimizing the way the app communicates with the server. At least for me, the app runs alot faster and loads the monitor feeds much quicker.

New features(or maybe just fixed, I lost track):
- Override Streaming Mode: This is found in the settings for montage or watch. When checked, the app will detect if you are on wi-fi or mobile network. It will automatically switch you from jpeg streaming to single image refresh which will give you more control over how much bandwidth is used.
- Monitor Cycling: This was combined with the watch view. Just press the cycle button and your monitor feeds will change at your set interval. It now waits to receive the first frame and then activates the countdown timer to load the next monitor.
- Montage Monitor Loading: Originally, each monitor feed used to make a request to the server to find out the url to use for the video feed, then start the video feed. I overhauled and changed alot of internal code. Now the monitors start faster because only 1 call is made to the server to find out the latest hash(if needed) and then immediately start the video feeds.
- Button Icons Look Better: I converted the button icons from png to svg so that they can scale without losing resolution.
- Custom User-Agent: Check your server logs and your will have more detailed info about your mobile device.
- SSL Support: SSL using https:// does work just fine if you have a trusted certificate. If you have a self-signed or free cert, then the flash player popups up a warning each time you first connect. After that point, I test the connection using a secureSocket function and see if I can termporarily add the cert as trusted. If your have a expired cert or principaMismatch, then you will be unable to do jpeg stream, only single image refresh can work. I have no other ways of bypassing flash because you have a bad cert, so please don't complain. I know that some native java apps just simply override everything and tell your phone that it is a trusted connection without warning.
- Other tweaks that I can't remember right now: I did alot of code changes over the past months and I lost track of them.

Everything runs good for me on the 5 devices that I test with. Let me know if any problems arise. And please be specific. Thanks.

Upcoming plans:
I do plan on adding the event feature. Also, I just paid my 105$ yearly fee to be an iOS developer. I am going to start testing the current version of my app on some ios devices.

p.s. I just started testing my app on an ipod(after spending an hour setting up and signing certs) for the first time and have some results:
-When using ssl, the ipod will not let me even try to connect when it is a self-signed cert. But when I use a free cert issued from StartCom, it gave me no trouble. My android complained about the StartCom cert, but ipod did not. Weird. Sadly, jpeg streaming will not work on ssl because the global variable in iOS is telling me that secureSocket is not supported. Maybe just because this is an old ipod 4. I will have to test more devices to confirm this.
-The app was unable to detect the network device(wifi, etc.) using my existing code. I will have to further develop that feature to make it iOS compatible.
-The username, password, and url text boxes on the login view were a little buggy. After typing the first letter, it became highlighted and then deleted when I typed the 2nd letter. This does not sound too hard to fix.

It was still pretty cool to see that the app I developed for android worked almost 100% for iOS. After I make these tweaks to catch my iOS app up with the android version, I will most likely start working on the event viewing feature.
TheKorn
Posts: 142
Joined: Fri Aug 02, 2013 12:39 pm

Re: ZoneMinder Client Mobile Application for Android

Post by TheKorn »

kevin186 wrote:I just packaged the latest version of my app and the corresponding skins @ http://dvr-security.net/mobile/zmc/ .
Please make sure that you follow the instructions and install the new skins, otherwise the app will not work.
Wellllll... Installed the new APK, (and also updated AIR), and updated the skin on the server. App can start fine, and can do a single frame updates just fine, even with the delay set to zero. But mjpeg streaming instantly says "stream closed". If I double tap the icon, it goes in/out of full screen, but still says stream closed.

I'd love to give you more diag info, but can't seem to find a place to get any. ;)
kevin186
Posts: 55
Joined: Mon May 10, 2010 4:11 am
Location: Worth, IL

Re: ZoneMinder Client Mobile Application for Android

Post by kevin186 »

TheKorn wrote:
kevin186 wrote:I just packaged the latest version of my app and the corresponding skins @ http://dvr-security.net/mobile/zmc/ .
Please make sure that you follow the instructions and install the new skins, otherwise the app will not work.
Wellllll... Installed the new APK, (and also updated AIR), and updated the skin on the server. App can start fine, and can do a single frame updates just fine, even with the delay set to zero. But mjpeg streaming instantly says "stream closed". If I double tap the icon, it goes in/out of full screen, but still says stream closed.

I'd love to give you more diag info, but can't seem to find a place to get any. ;)
Thanks for the quick feedback. That is bad news. If you had the app installed in the past, did it work then? Using port other than 80? Are you using ssl? The little green text at the top actionbar, does it say wifi-jpeg or something like that?

"Stream Closed" means that the socket was able to connect to the server, but then the server disconnected from the app. Probably from my app having some malformed data that your server does not like. If it said Stream Failed, that means that it was not event able to open the socket to ask for the monitor feed. It if said Stream Stopped, that indicates it stopping from some user action.

Also, to restart a stopped monitor feed, long press it, not double tap. I have to change that to a play button or something.

I have a feeling that there is some server configuration that I didnt take into consideration, maybe from it being a different version of zoneminder. I would love to see the ouput from your console by going to youraddress.com/zm/?skin=zmc_xml&view=console.xml .

If anyone has trouble and would be willing to give me a user account, I would try to connect my app to your server and debug.
TheKorn
Posts: 142
Joined: Fri Aug 02, 2013 12:39 pm

Re: ZoneMinder Client Mobile Application for Android

Post by TheKorn »

kevin186 wrote:Thanks for the quick feedback. That is bad news. If you had the app installed in the past, did it work then?
Yup, had both v1 & v2 installed previously, they worked great! (android 2.3, 4.0, 4.1.2 devices)
Using port other than 80? Are you using ssl? The little green text at the top actionbar, does it say wifi-jpeg or something like that?
Port 80, no SSL. Green text at the top says wifi-single when it works, says wifi-jpeg when it dies.
Also, to restart a stopped monitor feed, long press it, not double tap. I have to change that to a play button or something.
Ah! I switched to streaming then did a long press. It says... something (it goes by too quick to really see) then it says stream closed again.
I have a feeling that there is some server configuration that I didnt take into consideration, maybe from it being a different version of zoneminder. I would love to see the ouput from your console by going to youraddress.com/zm/?skin=zmc_xml&view=console.xml .
Ask and ye shall receive!

Code: Select all

This document had no style information.
<console>
<authLevel>
0
</authLevel>
<skinVersion>
3
</skinVersion>
<running>
1
</running>
<username>
admin
</username>
<maxBandwidth>
high
</maxBandwidth>
<highBandwidth>
30
</highBandwidth>
<mediumBandwidth>
10
</mediumBandwidth>
<lowBandwidth>
15
</lowBandwidth>
<phoneBandwidth>
15
</phoneBandwidth>
<viewStream>
1
</viewStream>
<viewMonitors>
1
</viewMonitors>
<editMonitors>
1
</editMonitors>
<viewEvents>
1
</viewEvents>
<editEvents>
1
</editEvents>
<serverName>
[REDACTED -- ip address]
</serverName>
<serverPort>
80
</serverPort>
<baseURL>
http://[REDACTED -- ip address]
</baseURL>
<pathZMS>
/cgi-bin/nph-zms
</pathZMS>
<monitor>
<monitorID>
8
</monitorID>
<monitorName>
Garage-2
</monitorName>
<monitorMaxFPS>
0.00
</monitorMaxFPS>
<monitorWidth>
640
</monitorWidth>
<monitorHeight>
480
</monitorHeight>
<monitorSequence>
1
</monitorSequence>
<monitorFunction>
Modect
</monitorFunction>
<monitorEnabled>
1
</monitorEnabled>
<monitorEvents>
454
</monitorEvents>
</monitor>
<monitor>
<monitorID>
9
</monitorID>
<monitorName>
Garage-3
</monitorName>
<monitorMaxFPS>
0.00
</monitorMaxFPS>
<monitorWidth>
640
</monitorWidth>
<monitorHeight>
480
</monitorHeight>
<monitorSequence>
2
</monitorSequence>
<monitorFunction>
Modect
</monitorFunction>
<monitorEnabled>
1
</monitorEnabled>
<monitorEvents>
1076
</monitorEvents>
</monitor>
<monitor>
<monitorID>
7
</monitorID>
<monitorName>
FrontDoor
</monitorName>
<monitorMaxFPS>
0.00
</monitorMaxFPS>
<monitorWidth>
640
</monitorWidth>
<monitorHeight>
480
</monitorHeight>
<monitorSequence>
3
</monitorSequence>
<monitorFunction>
Modect
</monitorFunction>
<monitorEnabled>
1
</monitorEnabled>
<monitorEvents>
441
</monitorEvents>
</monitor>
<monitor>
<monitorID>
10
</monitorID>
<monitorName>
SideDoor
</monitorName>
<monitorMaxFPS>
0.00
</monitorMaxFPS>
<monitorWidth>
640
</monitorWidth>
<monitorHeight>
480
</monitorHeight>
<monitorSequence>
4
</monitorSequence>
<monitorFunction>
Modect
</monitorFunction>
<monitorEnabled>
1
</monitorEnabled>
<monitorEvents>
455
</monitorEvents>
</monitor>
<monitor>
<monitorID>
4
</monitorID>
<monitorName>
PinballAlley-HD
</monitorName>
<monitorMaxFPS>
0.00
</monitorMaxFPS>
<monitorWidth>
1280
</monitorWidth>
<monitorHeight>
800
</monitorHeight>
<monitorSequence>
5
</monitorSequence>
<monitorFunction>
Nodect
</monitorFunction>
<monitorEnabled>
1
</monitorEnabled>
<monitorEvents>
661
</monitorEvents>
</monitor>
<monitor>
<monitorID>
11
</monitorID>
<monitorName>
PinballAlley-SD
</monitorName>
<monitorMaxFPS>
0.00
</monitorMaxFPS>
<monitorWidth>
640
</monitorWidth>
<monitorHeight>
400
</monitorHeight>
<monitorSequence>
6
</monitorSequence>
<monitorFunction>
Modect
</monitorFunction>
<monitorEnabled>
1
</monitorEnabled>
<monitorEvents>
5
</monitorEvents>
</monitor>
<monitor>
<monitorID>
3
</monitorID>
<monitorName>
Garage-1
</monitorName>
<monitorMaxFPS>
0.00
</monitorMaxFPS>
<monitorWidth>
640
</monitorWidth>
<monitorHeight>
480
</monitorHeight>
<monitorSequence>
7
</monitorSequence>
<monitorFunction>
None
</monitorFunction>
<monitorEnabled>
1
</monitorEnabled>
<monitorEvents>
0
</monitorEvents>
</monitor>
<monitor>
<monitorID>
12
</monitorID>
<monitorName>
Fixed_Roamer
</monitorName>
<monitorMaxFPS>
0.00
</monitorMaxFPS>
<monitorWidth>
640
</monitorWidth>
<monitorHeight>
480
</monitorHeight>
<monitorSequence>
8
</monitorSequence>
<monitorFunction>
Modect
</monitorFunction>
<monitorEnabled>
1
</monitorEnabled>
<monitorEvents>
29
</monitorEvents>
</monitor>
</console>
If anyone has trouble and would be willing to give me a user account, I would try to connect my app to your server and debug.
If you have a PPTP VPN client (such as built into windows & ubuntu), I can give you temporary access.
kevin186
Posts: 55
Joined: Mon May 10, 2010 4:11 am
Location: Worth, IL

Re: ZoneMinder Client Mobile Application for Android

Post by kevin186 »

@TheKorn

I see that the monitorMaxFPS is returning a value of 0.00. I am not sure if that is what you actually have it set to, or if there is a problem with the skin file. I tried setting one of my monitors to 0.00 and it immediately stopped as yours does with jpeg streaming. With my latest version of the app, I have it set to respect the current framerate of the bandwidth you have set, as long as it does not exceed the maxFPS of the individual monitor. It will use the lesser of the 2, thus setting your jpeg stream to a value of 0.00 which simply will not work. Can you please tell me if your real setting of Maximum FPS is in fact 0.00? If it is 0.00, can you please set it to something higher so that we can see if the app will work. And also I am wondering that if it is set to 0.00 on purpose, is that to say that there is no limit?

About that PPTP VPN, I never even heard of that. You must be running some kind of advanced setup there.
TheKorn
Posts: 142
Joined: Fri Aug 02, 2013 12:39 pm

Re: ZoneMinder Client Mobile Application for Android

Post by TheKorn »

kevin186 wrote:I see that the monitorMaxFPS is returning a value of 0.00. I am not sure if that is what you actually have it set to, or if there is a problem with the skin file.
Well, all my cameras are IP cameras of one flavor or another. The standard setup for an IP camera is to not define alarm or max FPS on the server, and instead do it on the camera end. Bad things happen if you try and limit IP cameras on the zoneminder end.
http://www.zoneminder.com/wiki/index.php/Main_Documentation wrote:Note for IP cameras: ZoneMinder has no way to set or limit the mjpeg stream the camera passes, some cams you can set this through the url string, others do not. So if you're using mjpeg feeds you must NOT throttle here at the server end, only the cam end. If you want to use this feature, the server to throttle, then you MUST use jpeg instead of mjpeg method to get picture from the camera
kevin186 wrote:Can you please tell me if your real setting of Maximum FPS is in fact 0.00?
Nope, both max and alarm max fps are unset (empty) for all my cameras. None of them are explicitly set to 0 max fps.
And also I am wondering that if it is set to 0.00 on purpose, is that to say that there is no limit?
I believe that's zoneminder's internal representation for 'use limit set on source device'. i.e. choke down as fast as the source sends it! :mrgreen:
About that PPTP VPN, I never even heard of that. You must be running some kind of advanced setup there.
Ha, it's not all that advanced; PPTP is permanently cryptographically compromised. It's just a lot easier/faster (and good enough for this use) to set up temporary PPTP VPNs than generate OpenVPN keys. :D
kevin186
Posts: 55
Joined: Mon May 10, 2010 4:11 am
Location: Worth, IL

Re: ZoneMinder Client Mobile Application for Android

Post by kevin186 »

Ok. This should be an easy fix. I will remove the code that checks the max fps. Apparently I misunderstood the use of that monitor value. I will push out the newer version of the app shortly and post here to let you know. As for the skin, I will update it by removing the unnecessary monitorMaxFPS. You will not need to install a new skin, as leaving that line of code will not hurt. But if you wanted to edit the skin, you could delete the line of code on console.xml.php:

Code: Select all

echo "<monitorMaxFPS>" . $monitor['MaxFPS'] . "</monitorMaxFPS>\n";
Thanks for finding this flaw.
kevin186
Posts: 55
Joined: Mon May 10, 2010 4:11 am
Location: Worth, IL

Re: ZoneMinder Client Mobile Application for Android

Post by kevin186 »

The fixed app has been uploaded to the server, along with the edited skin. Download @ http://dvr-security.net/mobile/zmc/
TheKorn
Posts: 142
Joined: Fri Aug 02, 2013 12:39 pm

Re: ZoneMinder Client Mobile Application for Android

Post by TheKorn »

That did the trick, mjpeg streaming working again! Thanks!

(should cycle be working? That's never worked for me, still doesn't.)
kevin186
Posts: 55
Joined: Mon May 10, 2010 4:11 am
Location: Worth, IL

Re: ZoneMinder Client Mobile Application for Android

Post by kevin186 »

TheKorn wrote:That did the trick, mjpeg streaming working again! Thanks!

(should cycle be working? That's never worked for me, still doesn't.)
Works for me on android and ipod. Must be another bug. Are you able to change monitors by swiping left or right while on the watch view? The cycle just triggers a left swipe to change monitor at set interval. What happens when you press the cycle button on the watch view, or launch it from the console?
TheKorn
Posts: 142
Joined: Fri Aug 02, 2013 12:39 pm

Re: ZoneMinder Client Mobile Application for Android

Post by TheKorn »

kevin186 wrote:Are you able to change monitors by swiping left or right while on the watch view? The cycle just triggers a left swipe to change monitor at set interval. What happens when you press the cycle button on the watch view, or launch it from the console?
Yep, if I bring up a monitor, I can switch to another monitor by swiping left/right. Cycle doesn't bring up any monitors at all. Swiping left/right does nothing, but I can back out to the main menu.

Actually, let me clarify that... hitting cycle from the main menu gives the screenshot. If I'm already in a monitor then hit the loop button, cycle works as I'd expect it to.
Attachments
Screenshot_2013-11-14-21-20-37.png
Screenshot_2013-11-14-21-20-37.png (19.33 KiB) Viewed 8136 times
kevin186
Posts: 55
Joined: Mon May 10, 2010 4:11 am
Location: Worth, IL

Re: ZoneMinder Client Mobile Application for Android

Post by kevin186 »

Made another update. It turns out that I was assuming that the first monitor would have an ID of 1. But looking at your console dump, your monitor ID's are not in such an order. It should be fixed now.
TheKorn
Posts: 142
Joined: Fri Aug 02, 2013 12:39 pm

Re: ZoneMinder Client Mobile Application for Android

Post by TheKorn »

Yup, that got it all fixed up! Thanks!

Can I do a feature request for ptz support? :)
Post Reply