Product
Introducing SSO
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
mplayer
Advanced tools
Readme
This module is a wrapper for mplayer started in slave mode (see documentation). It ensures that an instance of mplayer is always running in background ready for playback.
You need mplayer installed on your system for it to work properly!
See the Changelog section for all breaking changes which may cause issues if you've updated the module.
npm install mplayer
Start off with instantiating the client
var MPlayer = require('mplayer');
var player = new MPlayer();
You may want to pass in an object with options allowing for better debugging
true
, false
- if set to true all player events will be logged to consoletrue
, false
- log mplayer stdout
, stderr
streams directly to console, along with everything written to stdin
streamor passing additional options to the spawned mplayer instance
After this you will have access to all player methods and events. The player instance uses node's native EventEmitter for events management.
set_property
function to set them for the currently running instanceoptions
is an object with one or more key value pairs, determining which parameters should be set, see the last section
of slave mode documentation for the list of possible parameters and values
Example:
player.setOptions({
cache: 128,
cacheMin: 1
});
file
is the location of the file you want to open either in your filesystem or on the web
options
is an object passed to the setOptions method right before opening the file
Example:
player.openFile('/Users/noodny/Downloads/sample-video.avi');
file
is the location of the playlist file you want to open either in your filesystem or on the web
options
is an object passed to the setOptions method right before opening the file
Example:
player.openPlaylist('http://www.radio.com/radio-stream.pls', {
cache: 128,
cacheMin: 1
});
status
object has the following properties:{
muted: Boolean,
playing: Boolean,
volume: Number, // percent
duration: Number, // seconds
fullscreen: Boolean,
subtitles: Boolean,
filename: String,
title: String // currently playing stream title - valid only for radio streams
}
The following example will set up a player instance, open a radio stream and set it's volume to 50% after 1 second, while logging the player status event output to the console:
var MPlayer = require('mplayer');
var player = new MPlayer();
player.on('start', console.log.bind(this, 'playback started'));
player.on('status', console.log);
player.openPlaylist('http://www.miastomuzyki.pl/n/rmfclassic.pls', {
cache: 128,
cacheMin: 1
});
setTimeout(player.volume.bind(player, 50), 1000);
open
method to openFile
and openPlaylist
verbose
and debug
constructor optionsFAQs
Node.js wrapper for mplayer
The npm package mplayer receives a total of 30 weekly downloads. As such, mplayer popularity was classified as not popular.
We found that mplayer demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.