Skip to content

LittleKey/go-mplayer

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 

Repository files navigation

go-mplayer - Go interface with the MPlayer slave-mode

Short module allowing the user to control a fork'd MPlayer process in slave-mode.

You can read all about the MPlayer slave protocol at mplayerhq.hu

Requirements

MPlayer should be installed and available in the current PATH

Example

This example launches MPlayer in the background, requests it to play a file, wait for 5 seconds then stop playback:

import (
	"time"
	"github.com/tamentis/go-mplayer"
)

mplayer.StartSlave()

mplayer.SendCommand("loadfile /tmp/myfile.mp3")
time.Sleep(5 * time.Seconds)
mplayer.SendCommand("stop")

This example uses the blocking command PlayAndWait(), it allows you to use the module in a similar fashion to os/exec except that you can pre-load the process to get a better response time (e.g. on slow hardware):

import (
	"github.com/tamentis/go-mplayer"
)

mplayer.StartSlave()

mplayer.PlayAndWait("/tmp/myfile.mp3")

About

MPlayer wrapper for Go

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Go 100.0%