omx-player-wrapper
v1.1.0
Published
A library to control Omx-Player with Node.js
Downloads
21
Readme
Omx Player Wrapper
A library to control Omx-Player-Wrapper with Node.js
Get Started
const OMX = require('omx-player-wrapper');
const omxPlayer = new OMX('./public/audio/file.mp3');
omxPlayer.setOutput('alsa');
omxPlayer.start();
Installation
npm install omx-player-wrapper
This package is a OMXPlayer wrapper so you need to install OMXPlayer in your system:
sudo apt-get install omxplayer
How it's work
Instance new process
In the constructor method set the file (only information required)
const omxPlayer = new OMX('./public/audio/file.mp3');
now you can set different outputs with setOutput
("local" is default value). The only valid outputs are "hdmi", "local", "both" or "alsa"
omxPlayer.setOutput('alsa');
Quits player
omxPlayer.quit()
Resumes playback
omxPlayer.play()
Pauses playback
omxPlayer.pause()
Callback on end
It's possible to add a callback on end
omxPlayer.onEnd(() => {
console.log('Do something');
});
Status
It's possible get status information with:
const playerStatus = omxPlayer.getStatus();
The only valid status are "stopped" or "inProgress"
NOTE: send me a feedback, message, pull request or carrier pigeon to change, fix or improve this library. Happy to help.