https://github.com/maxmellon/simplayer
A sound player module is not depend on native extension for node.
https://github.com/maxmellon/simplayer
Last synced: 12 months ago
JSON representation
A sound player module is not depend on native extension for node.
- Host: GitHub
- URL: https://github.com/maxmellon/simplayer
- Owner: MaxMEllon
- License: mit
- Created: 2016-04-04T09:14:31.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2016-04-06T18:18:47.000Z (about 10 years ago)
- Last Synced: 2025-04-02T23:01:38.903Z (about 1 year ago)
- Language: JavaScript
- Homepage:
- Size: 12.7 KB
- Stars: 9
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
- - -
## About
This is simple multi platform sound player.
I get ideas from [opener](https://www.npmjs.com/package/opener).
This module should be used when to play simple sound or sound effect.
Not suitable for music players.
## Installation
```sh
npm install simplayer -g
# if you want to use in node
npm install simplayer --save
```
If platform is linux, then need to install the `alsa`
```sh
# before we start the work, please update
sudo apt-get update
sudo apt-get upgrade
# install ALSA
sudo apt-get install alsa-base alsa-utils
```
## Usage
Simplayer function return child process instance.
```js
var simplayer = require('simplayer');
var musicProcess = simplayer('/path/to/sound.mp3');
var musicProcess = simplayer('path/to/song.mp3', function (error) {
if (error) throw error;
console.log('end of song!');
});
```
If platform is windows, then support wav file only.
```js
var musicProcess = simplayer('C:\\path\\to\\sound.wav');
// or
var musicProcess = simplayer('C:/path/to/sound.wav');
```
If handle to close event, Please, in the following manner.
```js
var simplayer = require('simplayer');
var musicProcess = simplayer('/path/to/sound.mp3');
musicProcess.on('close', function(code) {
console.log('child process exited with code ' + code);
});
```
Use in the following manner in command line.
```sh
simplayer /path/to/sample.mp3
```
## For Japanese
- [http://qiita.com/maxmellon/items/afe7497ef3b4976ee87d](http://qiita.com/maxmellon/items/afe7497ef3b4976ee87d)
## Author
- Maxmellon
## LICENSE
MIT