https://github.com/eeeeeric/mpc-hc-api
Java library for controlling MPC-HC over a network
https://github.com/eeeeeric/mpc-hc-api
java mpc-hc
Last synced: about 1 year ago
JSON representation
Java library for controlling MPC-HC over a network
- Host: GitHub
- URL: https://github.com/eeeeeric/mpc-hc-api
- Owner: eeeeeric
- License: apache-2.0
- Created: 2015-04-19T02:47:42.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2016-06-06T01:38:00.000Z (about 10 years ago)
- Last Synced: 2025-03-10T06:06:58.928Z (over 1 year ago)
- Topics: java, mpc-hc
- Language: Java
- Homepage:
- Size: 28.3 KB
- Stars: 12
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# mpc-hc-api
[MPC-HC](https://mpc-hc.org/), or Media Player Classic - Home Cinema, is an open source media player for Microsoft Windows.
mpc-hc-api is a Java library for controlling MPC-HC over a network.
Download
--------
mpc-hc-api is available on Maven Central. Simply add it as a dependency to your pom.
```xml
com.eeeeeric
mpc-hc-api
0.1.0
```
Quickstart
----------
First, you'll need to enable the network interface to MPC-HC.
* Launch MPC-HC
* Press `o` for options
* Navigate to `Player` > `Web Interface`
* Check the box for `Listen on port`
* Select a port
Now in your Java application...
```java
MediaPlayerClassicHomeCinema mpc = new MediaPlayerClassicHomeCinema("127.0.0.1", 55555);
// Browse for files
List files = mpc.browse();
// Realistically, you'll want to display this in your UI, and let the user
// navigate the file tree, and select a file for playback
if (!files.isEmpty())
{
FileInfo file = files.get(0);
if (!file.isDirectory())
{
mpc.openFile(file);
}
}
// Control the player
Assert.assertTrue(mpc.isPlaying());
mpc.setMute(true);
mpc.toggleMute();
mpc.setVolume(50);
mpc.pause();
TimeCode fiveMinutes = new TimeCode("00:05:00");
mpc.seek(fiveMinutes);
mpc.play();
```
License
-------
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.