Socket
Socket
Sign inDemoInstall

mpc-hc-control

Package Overview
Dependencies
6
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    mpc-hc-control

Lib for control Media Player Classic - Home Cinema via HTTP API


Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Install size
1.80 MB
Created
Weekly downloads
 

Readme

Source

MPC-HC Control

Basic control over Media Player Classic - Home Cinema via http api.

Setup

Enable web interface in mpc-hc settings.

npm i mpc-hc-control

Usage

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:

/**
 * @filePath - path to video file
 */
openFile(filePath: string): Promise<any>;
isPlaying(): Promise<boolean>
isPaused(): Promise<boolean>
isStopped(): Promise<boolean>
isMuted(): Promise<boolean>
getVolume(): Promise<number>
getPosition(): Promise<IPositionInfo>

interface IPositionInfo {
    duration: number;
    position: number;
}
play(): Promise<void>
pause(): Promise<void>
togglePlay(): Promise<void>
stop(): Promise<boolean>
toggleFullscreen(): Promise<void>
/**
 * @position - new position in ms
 */
seek(position: number): Promise<void>
/**
 * @delta - delta from current position in ms
 */
async jump(delta: number): Promise<void>
skipBack(): Promise<void>
skipForward(): Promise<void>
/**
 * @volume - new volume in percents
 */
setVolume(volume: number): Promise<void>
toggleMute(): Promise<void>
nextAudioTrack(): Promise<void>
prevAudioTrack(): Promise<void>
nextSubtitles(): Promise<void>
prevSubtitles(): Promise<void>
getVariables(): Promise<IPlayerVariables>

interface 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:

/**
 * @commandId - any mpc-hc supported command from commands/mpcCommands.ts
 * @data - additional data provided in to api call
 */
execute(commandId: MpcCommands, data?: Dictionary<any>): Promise<any>

Keywords

FAQs

Last updated on 22 Jul 2018

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc