npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

node-mplayer-async

v0.0.1

Published

Node.js wrapper for mplayer on linux.

Downloads

4

Readme

node-mplayer-async

A node.js wrapper for MPlayer on Linux. It's currently focused on sound playing, more options and video playing will come later. Promises rely on the great q library

##Usage

First, install the module with (assuming you already installed MPlayer)

npm install node-mplayer-async

Then, you need to make a new instance of the module. The constructor of the module can take the path of the file to play.

var Mplayer = require('node-mplayer-async'); 

var player1 = new Mplayer('/home/node/Music/Kalimba.mp3');
var player2 = new Mplayer();

##Available methods

###play

This method will play the file defined when the player object was instanciated or setted with setFile(). This method MUST be called before any other. It can take in parameter an object that contains the volume and the number of times to play the file (see setVolume and setLoop).

player.play();
player.play({volume: 50});
player.play({volume: 50,
			loop: 10});

###stop

This method will stop the played file.

player.stop();

###pause

This one will toggle pause.

player.pause();

###mute

The method to toggle mute

player.mute();

###setVolume

This method is used to set the volume. It takes one parameter, the volume value that can go from 1 to 100.

player.setVolume(52);    //will set the volume to 52%

###seek

This 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.

player.seek(50);    //will go to 50 seconds

###setLoop

This will set the number of times to replay the file. The parameter is the number of times, -1 is forever.

player.setLoop(20);    //will play the file 20 times

###setSpeed

This will set the playing speed. It takes one parameter, the speed. 1 is the default speed.

player.setSpeed(0.5);    //will play the file 0.5x slower
player.setSpeed(20);    //will play the file 20x faster

###setFile

This 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.

player.setFile('/home/node/Music/asdf.mp3');

###getTimeLength

Returns the length of the file in seconds. Returns a promise

player.getTimeLength()
.then(function(length){
    console.log(length);
}

###getTimePosition

Returns the elapsed play time in seconds. It needs a callback.

player.getTimePosition()
.then(function(length){
    console.log(length);
}

###getMetaData

Return metadata of the file that is played in the for of an object. {artist: "Some Artist", title: "Some Title", album: "Some Album"}

getMetaData()
.then(function(metaData){
    console.log(metaData);
});

##Events

###end

The end event is emitted when the file has ended.

###error

The error event is emitted when an error has ocurred.

##Stability

This module uses the readline module, which is currently marked unstable.

This module has been tested on Ubuntu 14.04 LTS with MPlayer 1.1-4.8.