diff --git a/guacamole/pom.xml b/guacamole/pom.xml index c60c62988..d8dea090f 100644 --- a/guacamole/pom.xml +++ b/guacamole/pom.xml @@ -30,7 +30,7 @@ org.apache.maven.plugins maven-war-plugin - + diff --git a/guacamole/src/main/webapp/client.xhtml b/guacamole/src/main/webapp/client.xhtml index 34e4ec4bc..11af52c2b 100644 --- a/guacamole/src/main/webapp/client.xhtml +++ b/guacamole/src/main/webapp/client.xhtml @@ -149,6 +149,12 @@ window.location.search.substring(1) + "&width=" + window.innerWidth + "&height=" + window.innerHeight; + + // Add audio mimetypes to connect_string + GuacamoleUI.supportedAudio.forEach(function(mimetype) { + connect_string += "&audio=" + mimetype; + }); + guac.connect(connect_string); } diff --git a/guacamole/src/main/webapp/scripts/interface.js b/guacamole/src/main/webapp/scripts/interface.js index 445b8d5b9..7ac5998ac 100644 --- a/guacamole/src/main/webapp/scripts/interface.js +++ b/guacamole/src/main/webapp/scripts/interface.js @@ -61,8 +61,11 @@ var GuacamoleUI = { }; -// Supported mimetypes -GuacamoleUI.supportedAudio = {}; +/** + * Array of all supported audio mimetypes, populated when this script is + * loaded. + */ +GuacamoleUI.supportedAudio = []; // Constant UI initialization and behavior (function() { @@ -487,32 +490,20 @@ GuacamoleUI.supportedAudio = {}; GuacamoleUI.eventTarget.style.top = window.pageYOffset + "px"; }); - function testAudio(url, mimetype) { + // Build array of supported audio formats + [ + 'audio/ogg; codecs="vorbis"', + 'audio/mpeg; codecs="mp3"', + 'audio/wav' + ].forEach(function(mimetype) { - // If browser says we can't play it, don't try var audio = new Audio(); - if (!audio.canPlayType(mimetype)) - return; + var support_level = audio.canPlayType(mimetype); - // Otherwise, test - audio.src = url; + if (support_level != "") + GuacamoleUI.supportedAudio.push(mimetype); - // 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"); + }); })(); diff --git a/guacamole/src/main/webapp/sounds/silence.mp3 b/guacamole/src/main/webapp/sounds/silence.mp3 deleted file mode 100644 index 9dd6ef37a..000000000 Binary files a/guacamole/src/main/webapp/sounds/silence.mp3 and /dev/null differ diff --git a/guacamole/src/main/webapp/sounds/silence.ogg b/guacamole/src/main/webapp/sounds/silence.ogg deleted file mode 100644 index 91ddd7e15..000000000 Binary files a/guacamole/src/main/webapp/sounds/silence.ogg and /dev/null differ diff --git a/guacamole/src/main/webapp/sounds/silence.wav b/guacamole/src/main/webapp/sounds/silence.wav deleted file mode 100644 index 4b2f5cc09..000000000 Binary files a/guacamole/src/main/webapp/sounds/silence.wav and /dev/null differ