{ "name": "node-mplayer", "version": "0.0.5", "description": "Node.js wrapper for mplayer on linux.", "main": "./lib/node-mplayer.js", "repository": { "type": "git", "url": "https://github.com/loics2/node-mplayer.git" }, "keywords": [ "mplayer", "wrapper", "music", "player", "sound", "media" ], "author": { "name": "Loïc Stankovic" }, "license": "MIT", "readme": "node-mplayer\n============\n\nA node.js wrapper for MPlayer on Linux. Use it to play music on your sound card!\n\n## Usage\n\nFirst, install the module with (assuming you already installed MPlayer)\n\n npm install node-mplayer\n\nThen, you need to make a new instance of the module. The constructor of the module can take the path of the file to play. \n\n var Mplayer = require('node-mplayer'); \n \n var player1 = new Mplayer('/home/node/Music/Kalimba.mp3');\n var player2 = new Mplayer();\n \n## Available methods\n\n### play\n\nThis method will play the file defined when the player object was instanciated or setted with `setFile()`. This method MUST be called before any other. \nIt can take in parameter an object that contains the volume and the number of times to play the file (see `setVolume` and `setLoop`).\n\n player.play();\n player.play({volume: 50});\n player.play({volume: 50,\n loop: 10});\n\n### checkPlaying\n\nThis method indicates if the player is currently playing something.\n\n player.checkPlaying(); //returns true if playing, false if not\n\n### stop\n\nThis method will stop the played file. \n\n player.stop();\n\n\n### quit\n\nThis Method will close the underlying process\n\n player.quit();\n \n### pause\n\nThis one will toggle pause.\n\n player.pause();\n \n### mute\n\nThe method to toggle mute\n\n player.mute();\n \n### setVolume\n\nThis method is used to set the volume. It takes one parameter, the volume value that can go from 1 to 100.\n\n player.setVolume(52); //will set the volume to 52%\n\n### seek\n\nThis method is used to navigate in the playing file. It take one parameter, the seek value in seconds that goes from 0 to the end of the file. This value is absolute.\n\n player.seek(50); //will go to 50 seconds\n\n### setLoop\n\nThis will set the number of times to replay the file. The parameter is the number of times, -1 is forever.\n\n player.setLoop(20); //will play the file 20 times\n \n### setSpeed\n\nThis will set the playing speed. It takes one parameter, the speed. 1 is the default speed.\n\n player.setSpeed(0.5); //will play the file 0.5x slower\n player.setSpeed(20); //will play the file 20x faster\n \n### setFile\n\nThis one is used to set the file to play. The changes will take effect after calling the `play()` method. It takes the path of the file in parameter.\n\n player.setFile('/home/node/Music/asdf.mp3');\n\n### getTimeLength\n\nReturns the length of the file in seconds. It needs a callback.\n\n player.getTimeLength(function(length){\n console.log(length);\n });\n\n### getTimePosition\n\nReturns the elapsed play time in seconds. It needs a callback.\n\n player.getTimePosition(function(elapsedTime){\n console.log(elapsedTime);\n });\n\n### getPercentPosition\n\nReturn the elapsed time in percent. It needs a callback.\n\n player.getPercentPosition(function(elapsedPercent){\n console.log(elapsedPercent);\n });\n\n\n### getVolume\n\nReturn the current volume. It needs a callback.\n\n player.getVolume(function(currentVolume){\n console.log(currentVolume);\n });\n\n##Events\n\n### end\n\nThe end event is emitted when the file has ended.\n\n### error\n\nThe error event is emitted when an error has ocurred.\n\n## Stability\n\nThis module uses the [`readline`](http://www.nodejs.org/api/readline.html) module, which is currently marked unstable. \n\nThis module has been tested on Ubuntu 14.04 LTS with MPlayer 1.1-4.8 and on Ubuntu 15.04 with MPlayer2 2.0-728-g2c378c7-4.\n\n## Contributing\n\nAny contribution is welcome! Just create a pull request, and I'll take a look as soon as possible.\n\n## Credits\n\nHere's a list of people who contributed to this project :\n\n* [Maocx](https://github.com/Maocx)\n* [lacrioque](https://github.com/lacrioque)\n* [nkcr](https://github.com/nkcr)", "readmeFilename": "README.md", "bugs": { "url": "https://github.com/loics2/node-mplayer/issues" }, "homepage": "https://github.com/loics2/node-mplayer", "_id": "node-mplayer@0.0.5", "dist": { "shasum": "fb7a7d950199f61dff0c905e06b0c67d8a6cbc11" }, "_from": "node-mplayer@*", "_resolved": "https://registry.npmjs.org/node-mplayer/-/node-mplayer-0.0.5.tgz" }