Catch errors for when we can't play bell
Many browsers, for example Chrome on Android will not allow audio to play unless it's initiated from a user action. It is not reasonable to display an error for this. Fixes issue #821.
This commit is contained in:
parent
53f41f9692
commit
d4fc89d8b9
11
app/ui.js
11
app/ui.js
|
@ -1681,7 +1681,16 @@ const UI = {
|
|||
|
||||
bell: function(rfb) {
|
||||
if (WebUtil.getConfigVar('bell', 'on') === 'on') {
|
||||
document.getElementById('noVNC_bell').play();
|
||||
document.getElementById('noVNC_bell').play()
|
||||
.catch(function(e) {
|
||||
if (e.name === "NotAllowedError") {
|
||||
// Ignore when the browser doesn't let us play audio.
|
||||
// It is common that the browsers require audio to be
|
||||
// initiated from a user action.
|
||||
} else {
|
||||
Log.Error("Unable to play bell: " + e);
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
|
|
Loading…
Reference in New Issue