Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
92 changes: 92 additions & 0 deletions app/images/audio.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
46 changes: 44 additions & 2 deletions app/ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,9 @@ const UI = {
document.getElementById("noVNC_view_drag_button")
.addEventListener('click', UI.toggleViewDrag);

document.getElementById("noVNC_audio_button")
.addEventListener('click', UI.toggleEnableAudio);

document.getElementById("noVNC_control_bar_handle")
.addEventListener('mousedown', UI.controlbarHandleMouseDown);
document.getElementById("noVNC_control_bar_handle")
Expand Down Expand Up @@ -448,7 +451,7 @@ const UI = {
UI.enableSetting('port');
UI.enableSetting('path');
UI.enableSetting('repeaterID');
UI.updatePowerButton();
UI.updateCapabilities();
UI.keepControlbar();
}

Expand Down Expand Up @@ -891,6 +894,24 @@ const UI = {
}
},

updateCapabilities() {
UI.updatePowerButton();
UI.updateAudioButton();
},

updateAudioButton() {
if (UI.connected &&
UI.rfb.capabilities.audio) {
document.getElementById('noVNC_audio_button')
.classList.remove("noVNC_hidden");
document.getElementById('noVNC_audio_button')
.classList.remove("noVNC_selected");
} else {
document.getElementById('noVNC_audio_button')
.classList.add("noVNC_hidden");
}
},

/* ------^-------
* /SETTINGS
* ==============
Expand Down Expand Up @@ -1059,7 +1080,7 @@ const UI = {
UI.rfb.addEventListener("credentialsrequired", UI.credentials);
UI.rfb.addEventListener("securityfailure", UI.securityFailed);
UI.rfb.addEventListener("clippingviewport", UI.updateViewDrag);
UI.rfb.addEventListener("capabilities", UI.updatePowerButton);
UI.rfb.addEventListener("capabilities", UI.updateCapabilities);
UI.rfb.addEventListener("clipboard", UI.clipboardReceive);
UI.rfb.addEventListener("bell", UI.bell);
UI.rfb.addEventListener("desktopname", UI.updateDesktopName);
Expand Down Expand Up @@ -1722,6 +1743,27 @@ const UI = {
}
},

toggleEnableAudio() {
if (!UI.rfb) return;

if (!document.getElementById('noVNC_audio_button')
.classList.contains("noVNC_selected")) {
UI.rfb.enableAudio(
2,
MediaSource.isTypeSupported('audio/webm;codecs=opus') ?
RFB.audioCodecs.OpusWebM :
RFB.audioCodecs.MP3,
32 * 1024 // 32kbps
);
document.getElementById('noVNC_audio_button')
.classList.add("noVNC_selected");
} else {
UI.rfb.disableAudio();
document.getElementById('noVNC_audio_button')
.classList.remove("noVNC_selected");
}
},

updateShowDotCursor() {
if (!UI.rfb) return;
UI.rfb.showDotCursor = UI.getSetting('show_dot');
Expand Down
1 change: 1 addition & 0 deletions core/encodings.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export const encodings = {
pseudoEncodingContinuousUpdates: -313,
pseudoEncodingCompressLevel9: -247,
pseudoEncodingCompressLevel0: -256,
pseudoEncodingReplitAudio: 0x52706c41,
pseudoEncodingVMwareCursor: 0x574d5664,
pseudoEncodingExtendedClipboard: 0xc0a1e5ce
};
Expand Down
Loading
Loading