UNPKG

node-omx

Version:

Provide a nodejs interface for omxplayer (Raspberry Pi player). Support multiple file and loop.

16 lines (14 loc) 442 B
var exec = require('child_process').exec; /* * Check that only one process of omxplayer is running * Fixes problems with omxplayer not exiting. */ var onlyOneProcess = function () { exec('ps xa | grep "[o]mxplayer.bin" | wc -l', function (error, stdout, stderr) { var processCount = parseInt(stdout); if (processCount > 1) { exec('killall -9 omxplayer.bin'); } }); }; module.exports.onlyOneProcess = onlyOneProcess;