mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
support sending nav commands
This commit is contained in:
parent
d619275f90
commit
093ee4c866
7 changed files with 138 additions and 32 deletions
|
@ -28,19 +28,32 @@
|
|||
ApiClient.sendPlayStateCommand(sessionId, command, options);
|
||||
}
|
||||
|
||||
function sendCommand(command, options) {
|
||||
|
||||
var sessionId = MediaController.getPlayerInfo().id;
|
||||
|
||||
ApiClient.sendCommand(sessionId, command, options);
|
||||
}
|
||||
|
||||
function remoteControlPlayer() {
|
||||
|
||||
var self = this;
|
||||
|
||||
self.name = 'Remote Control';
|
||||
|
||||
function sendCommandByName(name, options) {
|
||||
|
||||
var command = {
|
||||
Name: name
|
||||
};
|
||||
|
||||
if (options) {
|
||||
command.Arguments = options;
|
||||
}
|
||||
|
||||
self.sendCommand(command);
|
||||
}
|
||||
|
||||
self.sendCommand = function (command) {
|
||||
|
||||
var sessionId = MediaController.getPlayerInfo().id;
|
||||
|
||||
ApiClient.sendCommand(sessionId, command);
|
||||
};
|
||||
|
||||
self.play = function (options) {
|
||||
|
||||
sendPlayCommand(options, 'PlayNow');
|
||||
|
@ -99,19 +112,19 @@
|
|||
};
|
||||
|
||||
self.mute = function () {
|
||||
sendCommand('Mute');
|
||||
sendCommandByName('Mute');
|
||||
};
|
||||
|
||||
self.unMute = function () {
|
||||
sendCommand('Unmute');
|
||||
sendCommandByName('Unmute');
|
||||
};
|
||||
|
||||
self.toggleMute = function () {
|
||||
sendCommand('ToggleMute');
|
||||
sendCommandByName('ToggleMute');
|
||||
};
|
||||
|
||||
self.setVolume = function (vol) {
|
||||
sendCommand('SetVolume', {
|
||||
sendCommandByName('SetVolume', {
|
||||
|
||||
Volume: vol
|
||||
|
||||
|
@ -120,7 +133,7 @@
|
|||
|
||||
self.displayContent = function (options) {
|
||||
|
||||
sendCommand('DisplayContent', {
|
||||
sendCommandByName('DisplayContent', {
|
||||
|
||||
ItemName: options.itemName,
|
||||
ItemType: options.itemType,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue