This library provides everything needed to (remote) control the mpv media player.
It provides an easy api, a json api and rpc functionality.
Usecases: Remote control your mediaplayer running on a raspberry pi or laptop or build a http interface for mpv
$ go get github.com/blang/mpv
Note: Always vendor your dependencies or fix on a specific version tag.
Start mpv:
$ mpv --idle --input-ipc-server=/tmp/mpvsocket
Remote control:
import github.com/blang/mpv
ipcc := mpv.NewIPCClient("/tmp/mpvsocket") // Lowlevel client
c := mpv.NewClient(ipcc) // Highlevel client, can also use RPCClient
c.LoadFile("movie.mp4", mpv.LoadFileModeReplace)
c.SetPause(true)
c.Seek(600, mpv.SeekModeAbsolute)
c.SetFullscreen(true)
c.SetPause(false)
pos, err := c.Position()
fmt.Printf("Position in Seconds: %.0f", pos)
Also check the GoDocs.
- Low-Level and High-Level API
- RPC Server and Client (fully transparent)
- HTTP Handler exposing lowlevel API (json)
Feel free to make a pull request. For bigger changes create a issue first to discuss about it.
See LICENSE file.