#mpv #sockets #bindings #control #instance #sock #idle

mpvipc

A small library which provides bindings to control existing mpv instances through sockets

15 stable releases

1.3.0 Aug 3, 2023
1.2.2 Jul 21, 2022
1.1.9 Oct 24, 2020
1.1.8 Jun 24, 2019
1.1.1 May 31, 2017

#115 in Concurrency

46 downloads per month
Used in 2 crates

GPL-3.0 license

45KB
1K SLoC

mpvipc

A small library which provides bindings to control existing mpv instances through sockets.

To make use of this library, please make sure mpv is started with the following option: $ mpv --input-ipc-server=/tmp/mpv.sock --idle ...

Dependencies

  • mpv
  • cargo (makedep)

Install

You can use this package with cargo.

Example

Make sure mpv is started with the following option: $ mpv --input-ipc-server=/tmp/mpv.sock --idle

Here is a small code example which connects to the socket /tmp/mpv.sock and toggles playback.

extern crate mpvipc;

use mpvipc::*;
use std::sync::mpsc::channel;

fn main() {
    let mpv = Mpv::connect("/tmp/mpv.sock").unwrap();
    let paused: bool = mpv.get_property("pause").unwrap();
    mpv.set_property("pause", !paused).expect("Error pausing");
}

For a more extensive example and proof of concept, see project mpvc.

Bugs / Ideas

Check out the Issue Tracker

Dependencies

~0.4–0.9MB
~19K SLoC