@imdickie I’d be happy to take a look. First thing to try: change the name
property of the second stream so it is different from the first one and see if that fixes it. In your config above, both are name: 'Front Door'
Read the statement by Michael Teeuw here.
Posts
-
RE: [MMM-RTSPStream] - Video Streaming from Live Feeds & Security Cameras
-
RE: Update
@zkab Looks like everything worked to me for what you’re trying to do.
-
RE: Update
pi@mirror:~/MagicMirror/modules/default/currentweather $ git pull && npm install
Make sure you’re in the
~/MagicMirror
directory before running the command.what about Changes not staged for commit and Untracked files
Ignore them. For your purposes, you don’t need to worry about them as long as all the merge errors are gone.
-
RE: Exit MM2 process gracefully?
@j-e-f-f Thanks for the quick feedback!
I was assuming I would need the cleanup routine in my module, I was just wondering if there was some routine in the core code that already listened for SIGINT and then called each module’s cleanup function (if there was one)–like it does with each node_helper.js’s start function–that way I would just have to add a function instead of add multiple SIGINT handlers (one in each module).
It’s probably a niche requirement and it’s easy enough to add them for each module that needs one. Just curious if it existed, or was maybe worth adding.
-
Exit MM2 process gracefully?
I may be missing it somewhere, but does the core MM2 process call anything to clean up modules and exit gracefully?
I was going to add a shutdown function to clean up some child processes started by my module, but was wondering if this functionality is already built into the core node-js app anywhere? This really only comes into play when restarting the MM process (without restarting the server itself).
What I’m looking for would be something similar to the pseudo-code below:
process.on('SIGINT', function() { modules.forEach( m => { if (typeof m.exit === "function") { m.exit() } }); setTimeout(function() { process.exit(0); }, 300 ); );
-
RE: [MMM-RTSPStream] - Video Streaming from Live Feeds & Security Cameras
@bhepler Thank you so much for the feedback and the testing.
The video was displaced from the border only on the PI, but not on Chrome nor Firefox whilst viewing the PI’s interface.
Viewing the interface via Chrome or Firefox did show a video image, but it started up FFMPEG and started to heat the Pi up.
Removing the 47 pixel offset made no difference in border position when viewing the Magic Mirror interface via Chrome or Firefox. Everything lined up perfectly.– This is to be expected. OMXPlayer draws the video on top of the Pi’s screen (over the desktop & electron.js running the mirror). It can only do that on the Pi itself, so if you view it in another browser, the module defaults back to FFMPEG and software decoding.
Removing the 47 pixel offset made everything line up perfectly on the mirror itself.
Good – I will continue looking for a way to improve how the module “finds” the border box to give to OMX. For now this offset may just get moved into a config setting.
when I’m running this module, I cannot tell PM2 to restart the MM process. Any attempt to shut down the Magic Mirror and then start it again results in an error claiming that port 8080 is already in use. I have to reboot the Pi in order to get MM running again.
I noticed this on my system too, but didn’t associate it back to this module. Thanks for pointing it out. Something is not getting cleaned up properly. I am able to restart MM without restarting the whole Pi by killing the
electron
process manually (e.g.pkill electron
orps aux | grep electron
and thenkill {pid}
on the process number that comes up. I will work on a fix for this in the next update.Additional Development Notes:
- Still working on finding a better solution to using FFMPEG to decode and then re-transmit the stream. With Chrome/Firefox removing support for NPAPI plug-ins, it’s very restricting for RTSP. If anyone has any suggestions, I’m open to them.
-
RE: Update
@zkab If you know what changes you made to that file, it’s easier to do the second option above and then redo your changes. If you must try to keep your changes as is, try
git reset --merge
first and then thegit stash
sequence above, otherwise you can manually edit the file and look for the conflicts.Google, “git resolve failed merge” for what you’re looking for, or see below for an excerpt.
-
RE: Update
It looks like you’ve made some changes to the currentweather modules’ source code.
If you want to keep your changes - this should do it
git stash git pull && npm install git stash apply
If you don’t need your changes to that file:
git checkout -- modules/default/currentweather/currentweather.js git pull && npm install
-
RE: Restarting MM² when config.js file changes
For those that do a lot of testing, something I’ve found very useful as well: extract the
config.js
file out into it’s own git repo; then just switch between branches when you want to test something, that way you don’t break your “main” config file.cd ~ mkdir mmConfig cd mmConfig git init mv ~/MagicMirror/config/config.js ./config.js ln -s /home/pi/mmConfig/config.js /home/pi/MagicMirror/config/config.js git commit -am "Initial Commit" git checkout -b testing # Change and test config.js without fear of breaking it! # Use checkout -f master to switch back to your main branch
-
Restarting MM² when config.js file changes
This has been helpful for me, but I didn’t see it mentioned anywhere, so I thought I’d share. For anyone looking for a simple way to automatically restart your MM² when you change the
config.js
file:Note: This assumes you are using
pm2
to start the server, as described here: Auto Starting MagicMirror- Create a file in the same location as your
mm.sh
script calledmm.json
. - Paste the contents of this gist into the file (adjust if needed for your setup).
- Run
pm2 stop mm && pm2 delete mm
to stop & remove the current mm script. - Run
pm2 start mm.json
to restart MM. Now any time you changeconfig.js
,pm2
will automatically restart the process. - Run
pm2 save
to save your changes for the next reboot.
That’s it!
Originally inspired by: Restart Mirror?
- Create a file in the same location as your