#mpv #control #sockets #bindings #instance #playback #sock

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

#244 in Concurrency

Download history 15/week @ 2024-07-19 20/week @ 2024-07-26 16/week @ 2024-08-02 17/week @ 2024-08-09 19/week @ 2024-08-16 22/week @ 2024-08-23 41/week @ 2024-08-30 23/week @ 2024-09-06 18/week @ 2024-09-13 63/week @ 2024-09-20 35/week @ 2024-09-27 21/week @ 2024-10-04 15/week @ 2024-10-11 16/week @ 2024-10-18 13/week @ 2024-10-25 15/week @ 2024-11-01

60 downloads per month
Used in 3 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.5–1MB
~22K SLoC