https://github.com/mrxdst/mpv-json-ipc
JSON-IPC wrapper for mpv
https://github.com/mrxdst/mpv-json-ipc
ipc json mpv
Last synced: about 1 month ago
JSON representation
JSON-IPC wrapper for mpv
- Host: GitHub
- URL: https://github.com/mrxdst/mpv-json-ipc
- Owner: mrxdst
- Created: 2020-07-27T15:15:28.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2021-06-12T03:10:08.000Z (about 5 years ago)
- Last Synced: 2025-08-09T11:25:35.216Z (11 months ago)
- Topics: ipc, json, mpv
- Language: TypeScript
- Homepage:
- Size: 65.4 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# mpv-json-ipc
JSON-IPC wrapper for mpv
## Install
```
npm install mpv-json-ipc
```
## Example
```javascript
import net from 'net';
import { MpvJsonIpc } from 'mpv-json-ipc';
const socket = net.createConnection('your input-ipc-server');
const jsonIpc = new MpvJsonIpc(socket);
jsonIpc.on('file-loaded', async () => {
console.log('file-loaded');
const duration = await jsonIpc.command('get_property', 'duration');
console.log(`Duration: ${duration.data}`);
});
socket.on('connect', async () => {
await jsonIpc.command('loadfile', 'my file');
});
```