Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rzcoder/mpc-hc-control
Basic api for control over MPC-HC
https://github.com/rzcoder/mpc-hc-control
Last synced: 30 days ago
JSON representation
Basic api for control over MPC-HC
- Host: GitHub
- URL: https://github.com/rzcoder/mpc-hc-control
- Owner: rzcoder
- Created: 2018-07-17T19:51:18.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2024-01-09T12:18:30.000Z (10 months ago)
- Last Synced: 2024-10-10T16:34:01.929Z (about 1 month ago)
- Language: TypeScript
- Size: 28.3 KB
- Stars: 12
- Watchers: 3
- Forks: 1
- Open Issues: 3
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# MPC-HC Control
Basic control over [Media Player Classic - Home Cinema](https://mpc-hc.org/) via http api.
## Setup
Enable web interface in mpc-hc settings.
`npm i mpc-hc-control`## Usage
```ts
const {MpcControl} = require("mpc-hc-control");
const mpcApi = new MpcControl("localhost", 13579);
mpcApi.openFile("c:\\video.mkv"));
mpcApi.setVolume(75);
```## Methods list
Basic methods list:
```ts
/**
* @filePath - path to video file
*/
openFile(filePath: string): Promise;
``````ts
isPlaying(): Promise
``````ts
isPaused(): Promise
``````ts
isStopped(): Promise
``````ts
isMuted(): Promise
``````ts
getVolume(): Promise
``````ts
getPosition(): Promiseinterface IPositionInfo {
duration: number;
position: number;
}
``````ts
play(): Promise
``````ts
pause(): Promise
``````ts
togglePlay(): Promise
``````ts
stop(): Promise
``````ts
toggleFullscreen(): Promise
``````ts
/**
* @position - new position in ms
*/
seek(position: number): Promise
``````ts
/**
* @delta - delta from current position in ms
*/
async jump(delta: number): Promise
``````ts
skipBack(): Promise
``````ts
skipForward(): Promise
``````ts
/**
* @volume - new volume in percents
*/
setVolume(volume: number): Promise
``````ts
toggleMute(): Promise
``````ts
nextAudioTrack(): Promise
``````ts
prevAudioTrack(): Promise
``````ts
nextSubtitles(): Promise
``````ts
prevSubtitles(): Promise
``````ts
getVariables(): Promiseinterface IPlayerVariables {
version: string;file: string;
filepath: string;
filedir: string;
size: string;state: number;
statestring: string;position: number;
positionstring: string;
duration: number;
durationstring: string;volumelevel: number;
muted: boolean;
}
```Also you can use:
```ts
/**
* @commandId - any mpc-hc supported command from commands/mpcCommands.ts
* @data - additional data provided in to api call
*/
execute(commandId: MpcCommands, data?: Dictionary): Promise
```