https://github.com/slashformotion/gompv
MPV remote control library written in golang
https://github.com/slashformotion/gompv
Last synced: 4 months ago
JSON representation
MPV remote control library written in golang
- Host: GitHub
- URL: https://github.com/slashformotion/gompv
- Owner: slashformotion
- License: mit
- Created: 2022-11-12T20:31:45.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2023-03-04T17:44:00.000Z (over 2 years ago)
- Last Synced: 2025-01-05T13:44:03.774Z (5 months ago)
- Language: Go
- Size: 16.6 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# MPV (remote) control library
[](https://pkg.go.dev/github.com/slashformotion/gompv)
This library provides everything needed to (remotely) control the [mpv media player](https://mpv.io/).
It provides an easy api, a json api and rpc functionality.
## Usage
```bash
go get github.com/slashformotion/gompv
```Start mpv:
```bash
mpv --idle --input-ipc-server=/tmp/mpvsocket
```Remote control:
```go
import (
mpv github.com/slashformotion/gompv
)func main(){
ipcc := mpv.NewIPCClient("/tmp/mpvsocket") // Lowlevel client
c := mpv.NewClient(ipcc) // Highlevel client// Play "movie.mp4"
c.LoadFile("movie.mp4", mpv.LoadFileModeReplace)
// Pause
c.SetPause(true)
// Seek a position in the track
c.Seek(600, mpv.SeekModeAbsolute)
c.SetFullscreen(true)
// Unpause
c.SetPause(false)// Get position
pos, err := c.Position()
fmt.Printf("Position in Seconds: %.0f", pos)
}
```## Features
- Low-Level and High-Level API
## Contribute
Feel free to make a pull request.
## License
See [LICENSE](LICENSE) file.