Attached is a Plugin for JRiver Media Center.
https://jriver.com
To install the plugin, use the Plugin Import utility in the Designer. The import process will ask you for the Host (IP Address) of the server running JRiver.
Here is the plugin code:
JRiverMediaCenter.plugin (2.4 KB)
plugin.Name = "JRiverMediaCenter";
plugin.OnChangeRequest = onChangeRequest;
plugin.OnConnect = onConnect;
plugin.OnDisconnect = onDisconnect;
plugin.OnPoll = onPoll;
plugin.OnSynchronizeDevices = onSynchronizeDevices;
plugin.PollingInterval = -1;
plugin.DefaultSettings = { "Host": "192.168.1.100" };
var http = new HTTPClient();
var baseUrl;
var commands = {
"Play": "Playback/PlayPause?Zone=-1&ZoneType=ID",
"Pause": "Playback/PlayPause?Zone=-1&ZoneType=ID",
"Stop": "Playback/Stop?Zone=-1&ZoneType=ID",
"SkipForward": "Playback/Next?Zone=-1&ZoneType=ID",
"SkipBackward": "Playback/Previous?Zone=-1&ZoneType=ID",
"DirectionUp": "Control/Key?Key=Up",
"DirectionRight": "Control/Key?Key=Right",
"DirectionDown": "Control/Key?Key=Down",
"DirectionLeft": "Control/Key?Key=Left",
"Select": "Control/Key?Key=Enter",
"PageUp": "Control/Key?Key=Page%20Up",
"PageDown": "Control/Key?Key=Page%20Down",
"Back": "Control/Key?Key=Backspace",
"Space": "Control/Key?Key=Space",
"DisplayToggle": "Control/MCC?Command=10012",
"ShuffleOn": "Control/MCC?Command=10005&Parameter=4",
"ShuffleOff": "Control/MCC?Command=10005&Parameter=3",
"PowerOff": "Control/MCC?Command=27001,0",
"FastForward": "Control/MCC?Command=10008&Parameter=10",
"Rewind": "Control/MCC?Command=10009&Parameter=10",
"Audio": "Control/MCC?Command=22001&Parameter=3",
"Video": "Control/MCC?Command=22001&Parameter=5",
"Images": "Control/MCC?Command=22001&Parameter=4",
"Home": "Control/MCC?Command=22001&Parameter=1",
}
function onChangeRequest(device, attribute, value) {
if (attribute != "MediaCommand")
throw "Invalid attribute";
var command = commands[value];
if (!command)
throw "Invalid command";
http.get(baseUrl + command);
}
function onConnect() {
baseUrl = "http://" + plugin.Settings["Host"] + ":52199/MCWS/v1/";
var mediaCenter = plugin.Devices["1"];
if (mediaCenter != null) {
mediaCenter.SupportedMediaCommands = Object.keys(commands);
}
}
function onDisconnect() {
}
function onPoll() {
}
function onSynchronizeDevices() {
var mediaCenter = new Device();
mediaCenter.Id = "1";
mediaCenter.DisplayName = "JRiver Media Center";
mediaCenter.Capabilities = ["MediaControl"];
mediaCenter.Attributes = [];
plugin.Devices[mediaCenter.Id] = mediaCenter;
}