updated web client to respond to new remote control commands
This commit is contained in:
parent
ce67f87714
commit
c1819ff31f
2 changed files with 74 additions and 6 deletions
|
@ -1180,11 +1180,37 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
self.mute = function () {
|
self.mute = function () {
|
||||||
currentMediaElement.volume = 0;
|
|
||||||
|
if (currentMediaElement) {
|
||||||
|
currentMediaElement.volume = 0;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
self.unmute = function () {
|
self.unmute = function () {
|
||||||
currentMediaElement.volume = volumeSlider.val();
|
if (currentMediaElement) {
|
||||||
|
currentMediaElement.volume = volumeSlider.val();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
self.toggleMute = function () {
|
||||||
|
|
||||||
|
if (currentMediaElement) {
|
||||||
|
currentMediaElement.volume = currentMediaElement.volume ? 0 : volumeSlider.val();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
self.volumeUp = function () {
|
||||||
|
|
||||||
|
if (currentMediaElement) {
|
||||||
|
currentMediaElement.volume = Math.max(currentMediaElement.volume - 5, 0);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
self.volumeDown = function () {
|
||||||
|
|
||||||
|
if (currentMediaElement) {
|
||||||
|
currentMediaElement.volume = Math.min(currentMediaElement.volume + 5, 100);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
self.stop = function () {
|
self.stop = function () {
|
||||||
|
|
|
@ -72,9 +72,9 @@ var Dashboard = {
|
||||||
if (header.length) {
|
if (header.length) {
|
||||||
// Re-render the header
|
// Re-render the header
|
||||||
header.remove();
|
header.remove();
|
||||||
|
|
||||||
if (Dashboard.getUserPromise) {
|
if (Dashboard.getUserPromise) {
|
||||||
Dashboard.getUserPromise.done(function(user) {
|
Dashboard.getUserPromise.done(function (user) {
|
||||||
Dashboard.ensureHeader(page, user);
|
Dashboard.ensureHeader(page, user);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
@ -812,6 +812,48 @@ var Dashboard = {
|
||||||
MediaPlayer.previousTrack();
|
MediaPlayer.previousTrack();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (msg.MessageType === "SystemCommand") {
|
||||||
|
|
||||||
|
if (msg.Data === 'GoHome') {
|
||||||
|
Dashboard.navigate('index.html');
|
||||||
|
}
|
||||||
|
else if (msg.Data === 'GoToSettings') {
|
||||||
|
Dashboard.navigate('dashboard.html');
|
||||||
|
}
|
||||||
|
else if (msg.Data === 'Mute') {
|
||||||
|
MediaPlayer.mute();
|
||||||
|
}
|
||||||
|
else if (msg.Data === 'Unmute') {
|
||||||
|
MediaPlayer.unmute();
|
||||||
|
}
|
||||||
|
else if (msg.Data === 'VolumeUp') {
|
||||||
|
MediaPlayer.volumeUp();
|
||||||
|
}
|
||||||
|
else if (msg.Data === 'VolumeDown') {
|
||||||
|
MediaPlayer.volumeDown();
|
||||||
|
}
|
||||||
|
else if (msg.Data === 'ToggleMute') {
|
||||||
|
MediaPlayer.toggleMute();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (msg.MessageType === "MessageCommand") {
|
||||||
|
|
||||||
|
var cmd = msg.Data;
|
||||||
|
|
||||||
|
if (cmd.TimeoutMs) {
|
||||||
|
var notification = {
|
||||||
|
title: cmd.Header,
|
||||||
|
body: cmd.Text,
|
||||||
|
timeout: cmd.TimeoutMs
|
||||||
|
};
|
||||||
|
|
||||||
|
WebNotifications.show(notification);
|
||||||
|
} else {
|
||||||
|
Dashboard.showFooterNotification({ html: "<b>" + cmd.Header + ": </b>" + cmd.Text, timeout: cmd.TimeoutMs });
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
onBrowseCommand: function (cmd) {
|
onBrowseCommand: function (cmd) {
|
||||||
|
@ -1113,7 +1155,7 @@ $(function () {
|
||||||
|
|
||||||
alert("This browser does not support web sockets. For a better experience, try a newer browser such as Chrome (android, desktop), Firefox, IE10, Safari (iOS) or Opera.");
|
alert("This browser does not support web sockets. For a better experience, try a newer browser such as Chrome (android, desktop), Firefox, IE10, Safari (iOS) or Opera.");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!IsStorageEnabled()) {
|
if (!IsStorageEnabled()) {
|
||||||
alert("This browser does not support local storage or is running in private mode. For a better experience, try a newer browser such as Chrome (android, desktop), Firefox, IE10, Safari (iOS) or Opera.");
|
alert("This browser does not support local storage or is running in private mode. For a better experience, try a newer browser such as Chrome (android, desktop), Firefox, IE10, Safari (iOS) or Opera.");
|
||||||
}
|
}
|
||||||
|
@ -1135,7 +1177,7 @@ $(document).on('pagebeforeshow', ".page", function () {
|
||||||
Dashboard.logout();
|
Dashboard.logout();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Dashboard.ensureHeader(page);
|
Dashboard.ensureHeader(page);
|
||||||
Dashboard.ensurePageTitle(page);
|
Dashboard.ensurePageTitle(page);
|
||||||
Dashboard.refreshSystemInfoFromServer();
|
Dashboard.refreshSystemInfoFromServer();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue