diff --git a/guacamole/src/main/webapp/WEB-INF/web.xml b/guacamole/src/main/webapp/WEB-INF/web.xml index 61ae0b21b..ce87d3406 100644 --- a/guacamole/src/main/webapp/WEB-INF/web.xml +++ b/guacamole/src/main/webapp/WEB-INF/web.xml @@ -77,4 +77,13 @@ /tunnel + + mp3 + audio/mpeg + + + ogg + audio/ogg + + diff --git a/guacamole/src/main/webapp/scripts/interface.js b/guacamole/src/main/webapp/scripts/interface.js index 28bca1111..445b8d5b9 100644 --- a/guacamole/src/main/webapp/scripts/interface.js +++ b/guacamole/src/main/webapp/scripts/interface.js @@ -61,6 +61,9 @@ var GuacamoleUI = { }; +// Supported mimetypes +GuacamoleUI.supportedAudio = {}; + // Constant UI initialization and behavior (function() { @@ -484,6 +487,33 @@ var GuacamoleUI = { GuacamoleUI.eventTarget.style.top = window.pageYOffset + "px"; }); + function testAudio(url, mimetype) { + + // If browser says we can't play it, don't try + var audio = new Audio(); + if (!audio.canPlayType(mimetype)) + return; + + // Otherwise, test + audio.src = url; + + // On error, explicitly unsupported + audio.addEventListener("error", function() { + GuacamoleUI.supportedAudio[mimetype] = false; + }); + + // On successful play, explicitly supported + audio.addEventListener("ended", function() { + GuacamoleUI.supportedAudio[mimetype] = true; + }); + + audio.play(); + + } + + testAudio("sounds/silence.mp3", "audio/mpeg"); + testAudio("sounds/silence.ogg", "audio/ogg"); + })(); // Tie UI events / behavior to a specific Guacamole client diff --git a/guacamole/src/main/webapp/sounds/silence.mp3 b/guacamole/src/main/webapp/sounds/silence.mp3 new file mode 100644 index 000000000..9dd6ef37a Binary files /dev/null and b/guacamole/src/main/webapp/sounds/silence.mp3 differ diff --git a/guacamole/src/main/webapp/sounds/silence.ogg b/guacamole/src/main/webapp/sounds/silence.ogg new file mode 100644 index 000000000..91ddd7e15 Binary files /dev/null and b/guacamole/src/main/webapp/sounds/silence.ogg differ diff --git a/guacamole/src/main/webapp/sounds/silence.wav b/guacamole/src/main/webapp/sounds/silence.wav new file mode 100644 index 000000000..4b2f5cc09 Binary files /dev/null and b/guacamole/src/main/webapp/sounds/silence.wav differ