mc

mpv-controller

Node.js module which controls mpv media player.

Showing:

Popularity

Downloads/wk

6

GitHub Stars

9

Maintenance

Last Commit

2yrs ago

Contributors

3

Package

Dependencies

1

Size (min+gzip)

2.4KB

License

MIT

Type Definitions

Tree-Shakeable

No?

Categories

Readme

mpv-controller

Node.js module which controls mpv media player written in ES2015.

npm: https://www.npmjs.com/package/mpv-controller

Installation

npm install mpv-controller

Usage

Example

const mpv = require('mpv-controller');

var player = new mpv(status => {
    console.log(status);
});
player.limitStatusMessages(5);

player.play("/path/to/video.mkv");

setTimeout(player.pause.bind(player), 5000); // Pauses after 5 seconds

Creating an instance

var player =  new mpv(statusListener);

where statusListener will receive an object containing playback status on the form

{
    playing: true,
    buffering: false,
    elapsed: 282,
    total: 421,
    elapsedStr: "00:04:42",
    totalStr: "00:07:01",
    progress: 0.6698
}

or

{
    exit: true
}

if mpv has been closed.

Play a video

player.play(video [, subtitles [, mpv-flags]]);

Pause/resume

player.togglePause();

Other commands

player.stop();
player.seekForward(); // Seek 5 seconds forwards
player.seekBackward(); // Seek 5 seconds backwards
player.bigSeekForward(); // Seek 30 seconds forwards
player.bigSeekBackward(); // Seek 30 secons Backwards
player.seek(seconds [, mode]); // See mpv documentation for modes
player.displayStatus(); // Displays status hud
player.increaseSpeed();
player.decreaseSpeed();
player.resetSpeed();
player.decreaseVolume();
player.increaseVolume();
player.mute();
player.toggleFullscreen();
player.exitFullscreen();
player.toggleSubtitle();
player.addSubtitle(filepath);

Limit the amount of status messages

Will show every mod update returned by mpv. mod = 5 will show every fifth update.

player.limitStatusMessages(mod);

Sending flags to mpv

player.play("https://www.youtube.com/watch?v=rOOdfugvsIY", ["--fs", "--ytdl-format=best"]);

Dependencies

  • mpv

Contact

Licence

MIT: https://opensource.org/licenses/MIT

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100