Read the statement by Michael Teeuw here.
MMM-MPlayer - display issue
-
Hi,
I have this issue with MMM-MPlayer, that also has been reported by other users of the module.
When using the module, the MPlayer window is seen in the middle of the screen and has a MPlayer title.
This is what is running when using the module:
admin@MagicPi3b:~/MagicMirror/modules/MMM-MPlayer $ ps -eaf | grep mplayer | grep -v grep admin 38919 38729 18 12:17 ? 00:00:01 mplayer -monitoraspect 0 -noborder -vf rotate=-1 -geometry 10:225 -xy 640 -rtsp-stream-over-tcp -vo xv,gl,gl_nosw,vdpau, -nosound rtsp://axisviewer:password@192.168.178.55/axis-media/media.amp?streamprofile=ACC_Low
The value of DISPLAY is:
:0
When I run the same command like this, it is working as expected:
admin@MagicPi3b:~/MagicMirror/modules/MMM-MPlayer $ DISPLAY=:0 mplayer -monitoraspect 0 -noborder -vf rotate=-1 -geometry 10:225 -xy 640 -rtsp-stream-over-tcp -vo xv,gl,gl_nosw,vdpau, -nosound rtsp://axisviewer:password@192.168.178.55/axis-media/media.amp?streamprofile=ACC_Low
The MMM-MPlayer module uses this to start mplayer:
const env = { ...process.env, DISPLAY: ':0' }; const mplayerProcess = spawn(`mplayer`, [`${mplayerOption}`, `${mplayerOptionValue}`, : : `${stream}`], {env: env});
I cannot get my finger behind this and I have no idea why this happens like this.
Any ideas ? -
-
To answer myself:
I cleaned the array using:
const mplayerArgumentsArrayFilter = mplayerArgumentsArray.filter(discardEmptyArgument); function discardEmptyArgument(value, index, array) { return value != ''; }
Then spawned using that array:
// Spawn a new mplayer process const env = { ...process.env, DISPLAY: ':0' }; const mplayerProcess = spawn(`mplayer`, mplayerArgumentsArrayFilter, {env: env});
Now it is working correct.
-
I found out following:
When using
// Spawn a new mplayer process const env = { ...process.env, DISPLAY: ':0' }; const mplayerProcess = spawn(`mplayer`, ['-rtsp-stream-over-tcp', '-noborder', '-monitoraspect', '0', '-vf', 'rotate=-1', '-geometry', '5:225', '-x', '640', '-y', '360', 'rtsp://axisviewer:password@192.168.178.55/axis-media/media.amp?streamprofile=ACC_Low'], {env: env});
The stream is correct on the monitor.
When using
// Spawn a new mplayer process const env = { ...process.env, DISPLAY: ':0' }; const mplayerProcess = spawn(`mplayer`, ['', '', '', '-rtsp-stream-over-tcp', '', '', '', '-noborder', '-monitoraspect', '0', '-vf', 'rotate=-1', '-geometry', '5:225', '-x', '640', '-y', '360', 'rtsp://axisviewer:password@192.168.178.55/axis-media/media.amp?streamprofile=ACC_Low'], {env: env});
The stream is NOT correct on the monitor (MPlayer window in the center).
So the problem is spawning with empty parameters.
When running it from the command line, this is not an issue, as the shell takes care of the empty places between the arguments.I tried with
undefined
andnull
iso''
but that does not work.Only idea how to solve this ?
Cleaning the array somehow ? -
To answer myself:
I cleaned the array using:
const mplayerArgumentsArrayFilter = mplayerArgumentsArray.filter(discardEmptyArgument); function discardEmptyArgument(value, index, array) { return value != ''; }
Then spawned using that array:
// Spawn a new mplayer process const env = { ...process.env, DISPLAY: ':0' }; const mplayerProcess = spawn(`mplayer`, mplayerArgumentsArrayFilter, {env: env});
Now it is working correct.
-