mpv
v2.0.1
Published
mpv player json ipc wrapper
Downloads
64
Readme
▶️ MPV
This library spawns mpv and talks to it using the JSON IPC protocol.
Quick start
const mpv = Mpv({
args: [], // Arguments to child_process.spawn,
options: {} // Options to child_process.spawn,
path: 'mpv' // Path of mpv (defaults to mpv or mpv.exe in path or cwd)
})
mpv.command('loadfile', 'http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4')
mpv.on('playback-time', time =>
console.log(time)
)
await mpv.get('volume')
await mpv.set('volume', 0.5)
const unobserve = await mpv.observe('volume', volume => {
// volume is the new value
})
unobserve() // stops observing the related property
mpv.process // process from child_process.spawn
mpv.socket // raw tcp socket