Page 1 of 1
Options -> Web -> WEB_SOUND_ON_ALARM
Posted: Fri Apr 15, 2022 1:21 am
by RonRN18
I'm not sure if I just don't understand how this works or if this feature actually does work. I have enabled the option and then tried to find the "sounds" directory. I did a bunch of searching and the only "sounds" folder I could find was at /usr/share/sounds. In this directory, I saw several sub-directories that had several different sound effects. I initially thought this was what it was looking for, but it would not trigger any sounds. I then searched around and saw
this post, and saw the suggestion to modify the zm.conf file. There was no mention of a ZM_DIR_SOUNDS directory anywhere, so I created a new entry in the configuration file... I wasn't sure if it was looking for a relative or a specific directory location. If it were relative, I'd think it relative to the "www" directory, I create a sub-directory to "www" and set the "ZM_DIR_SOUNDS=sounds". That didn't work. I then tried to put in the long name and changed it to "ZM_DIR_SOUNDS=/usr/share/zoneminder/www/sounds" but that doesn't work either. I've tried all I could think of and hoping someone here could steer me right.
Re: Options -> Web -> WEB_SOUND_ON_ALARM
Posted: Thu Apr 06, 2023 1:53 pm
by Simpler
I also can't get this to work.
I've toggled on
WEB_SOUND_ON_ALARM (from Options -> Web) and I've specified an
WEB_ALARM_SOUND file as a .ogg file that is in the www/sounds directory. I've even tested that the sound plays on the web if I enter
Code: Select all
http://localhost/zm/sounds/Soft_Airy_Swish.ogg
as the URL.
Does anyone have this working?
I'm on 1.36.33.
Thanks
Re: Options -> Web -> WEB_SOUND_ON_ALARM
Posted: Thu Apr 06, 2023 6:54 pm
by iconnor
I once had this working but it was very inconsistent across browsers and browsers have gotten more complicated since then. I'll try to find some time to revisit this and post back here.
Re: Options -> Web -> WEB_SOUND_ON_ALARM
Posted: Fri Apr 07, 2023 3:17 pm
by Simpler
Hi Isaac,
Thanks for the reply.
I created a pull request to address this issue.
Check it out
here.
Re: Options -> Web -> WEB_SOUND_ON_ALARM
Posted: Fri Apr 07, 2023 3:32 pm
by iconnor
Merged, thanks so much. I'll get it into 1.36.34 as well.
Re: Options -> Web -> WEB_SOUND_ON_ALARM
Posted: Thu Jul 06, 2023 8:08 am
by dougmccrary
I see 1.36.34 in proposed ppa, but apt doesn't get it?
Re: Options -> Web -> WEB_SOUND_ON_ALARM
Posted: Thu Jul 06, 2023 1:04 pm
by iconnor
Should show up if you have the proposed ppa in your sources.list. What does apt-cache madison zoneminder say?
Re: Options -> Web -> WEB_SOUND_ON_ALARM
Posted: Thu Jul 06, 2023 10:58 pm
by dougmccrary
Code: Select all
doug@doug-HP-Z400-ZM:~$ sudo apt-cache madison zoneminder
[sudo] password for doug:
zoneminder | 1.36.33-focal1 | http://ppa.launchpad.net/iconnor/zoneminder-1.36/ubuntu focal/main amd64 Packages
zoneminder | 1.36.33~20230223.55-focal1 | http://ppa.launchpad.net/iconnor/zoneminder-proposed/ubuntu focal/main amd64 Packages
zoneminder | 1.32.3-2ubuntu2+esm1 | https://esm.ubuntu.com/apps/ubuntu focal-apps-security/main amd64 Packages
zoneminder | 1.32.3-2ubuntu2 | http://us.archive.ubuntu.com/ubuntu focal/universe amd64 Packages
doug@doug-HP-Z400-ZM:~$
Also
Code: Select all
doug@doug-HP-Z400-ZM:~$ sudo apt policy zoneminder
[sudo] password for doug:
zoneminder:
Installed: 1.36.33-focal1
Candidate: 1.36.33-focal1
Version table:
*** 1.36.33-focal1 500
500 http://ppa.launchpad.net/iconnor/zoneminder-1.36/ubuntu focal/main amd64 Packages
100 /var/lib/dpkg/status
1.36.33~20230223.55-focal1 500
500 http://ppa.launchpad.net/iconnor/zoneminder-proposed/ubuntu focal/main amd64 Packages
1.32.3-2ubuntu2+esm1 500
500 https://esm.ubuntu.com/apps/ubuntu focal-apps-security/main amd64 Packages
1.32.3-2ubuntu2 500
500 http://us.archive.ubuntu.com/ubuntu focal/universe amd64 Packages
doug@doug-HP-Z400-ZM:~$
Re: Options -> Web -> WEB_SOUND_ON_ALARM
Posted: Fri Jul 07, 2023 1:24 pm
by iconnor
Right. There are build issues on focal. SOmething wrong with my fixes for ffmpeg5.
Re: Options -> Web -> WEB_SOUND_ON_ALARM
Posted: Fri Jul 07, 2023 6:13 pm
by dougmccrary
OK, thanks.
Re: Options -> Web -> WEB_SOUND_ON_ALARM
Posted: Sat Feb 01, 2025 3:05 am
by dawansv
I had trouble getting this to work on 1.36.35 so figured I would share what I did. My ZM is running on Ubuntu but I was trying to get the alarm to sound on Windows 11 with Chrome or Edge.
After some testing, I found that I couldn't get it working with the current <embed> tag. However I was able to get it working by using the newer <audio> tag. One advantage of the <audio> tag is that is has play() and pause() functions we can be used in the javascript file instead of the autostart option used by the <embed> tag.
So in /usr/share/zoneminder/www/skins/classic/views/watch.php, I made the following change:
I replaced
<embed src="<?php echo $soundSrc ?>"
autostart="true"
loop="true"
hidden="true">
</embed>
with
Code: Select all
<audio id="alarmAudio"
src="<?php echo $soundSrc ?>"
loop="true"
hidden="true">
</audio>
Then in /usr/share/zoneminder/www/js/MonitorStream.js I made the following changes:
I replaced
$j('#alarmSound').removeClass('hidden');
with
and
$j('#alarmSound').addClass('hidden');
with
Last thing was to deselect WEB_USE_OBJECT_TAGS in Options - Web to avoid ending up with the old mediaplayer option. I think in fact this whole section of media player in both files should be removed as it was I think mostly for IE which I don't think needs to be supported anymore. Not sure.
Finally, because of browser policy both in Chrome and Edge (and other chromium browsers I assume), in order for the alarm to sound, after opening the watch window for a camera, you must at least click on the screen once because the audio tag will not play only if you didn't interact at least once with the screen. Just clicking anywhere is enough.
PS: If you want a custom sound file, you need to put it in the sounds subdirectory within the zoneminder www directory.
On ubuntu that's located at /usr/share/zoneminder/www/sounds
There is ALARM.WAV by default in there but you can also define another one and set it via WEB_ALARM_SOUND in the Options - Web screen.
Re: Options -> Web -> WEB_SOUND_ON_ALARM
Posted: Mon Feb 03, 2025 12:24 am
by iconnor
Thanks for that analysis and detailed info. I'll look into this in a little while. I think there were some udpates in 1.37 to this but I don't remember if I pack ported them or what.
THere is definitely a TON of stuff in ZM that is no longer relevant. But I don't have the time to do the cleanup I'd like to do. Every now and then I remove something but the years go by...