mirror of
https://github.com/dkmstr/openuds.git
synced 2024-12-22 13:34:04 +03:00
Updated to allow audio redirection, and newer build methods.
This commit is contained in:
parent
7e8fa876fa
commit
bf47f40939
@ -4,10 +4,10 @@
|
||||
http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>net.sourceforge.guacamole</groupId>
|
||||
<groupId>org.openuds.server</groupId>
|
||||
<artifactId>transport</artifactId>
|
||||
<packaging>war</packaging>
|
||||
<version>1.2.0</version>
|
||||
<version>1.2.1</version>
|
||||
<name>Guacamole Transport</name>
|
||||
<url>http://openuds.org/</url>
|
||||
|
||||
@ -36,7 +36,7 @@
|
||||
<configuration>
|
||||
<overlays>
|
||||
<overlay>
|
||||
<groupId>net.sourceforge.guacamole</groupId>
|
||||
<groupId>org.glyptodon.guacamole</groupId>
|
||||
<artifactId>guacamole-common-js</artifactId>
|
||||
<type>zip</type>
|
||||
</overlay>
|
||||
@ -60,16 +60,17 @@
|
||||
|
||||
<!-- Main Guacamole library -->
|
||||
<dependency>
|
||||
<groupId>net.sourceforge.guacamole</groupId>
|
||||
<groupId>org.glyptodon.guacamole</groupId>
|
||||
<artifactId>guacamole-common</artifactId>
|
||||
<version>0.8.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- Guacamole JavaScript library -->
|
||||
<dependency>
|
||||
<groupId>net.sourceforge.guacamole</groupId>
|
||||
<groupId>org.glyptodon.guacamole</groupId>
|
||||
<artifactId>guacamole-common-js</artifactId>
|
||||
<version>0.7.2</version>
|
||||
<version>0.7.4</version>
|
||||
<type>zip</type>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
@ -77,13 +78,4 @@
|
||||
</dependencies>
|
||||
|
||||
|
||||
<repositories>
|
||||
<!-- Main Guacamole repository -->
|
||||
<repository>
|
||||
<id>guac-dev</id>
|
||||
<url>http://guac-dev.org/repo</url>
|
||||
</repository>
|
||||
|
||||
</repositories>
|
||||
|
||||
</project>
|
||||
|
@ -3,12 +3,14 @@ package org.openuds.guacamole;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.FileReader;
|
||||
import java.net.URL;
|
||||
import java.util.Arrays;
|
||||
import java.util.Enumeration;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Properties;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpSession;
|
||||
|
||||
import net.sourceforge.guacamole.GuacamoleException;
|
||||
import net.sourceforge.guacamole.net.GuacamoleSocket;
|
||||
import net.sourceforge.guacamole.net.GuacamoleTunnel;
|
||||
@ -69,7 +71,6 @@ public class TunnelServlet
|
||||
if( data == null || width == null || height == null)
|
||||
throw new GuacamoleException("Can't read required parameters");
|
||||
|
||||
|
||||
Hashtable<String,String> params = Util.readParameters( getConfigValue(UDS) + UDS_PATH + data);
|
||||
|
||||
if( params == null ) {
|
||||
@ -82,6 +83,16 @@ public class TunnelServlet
|
||||
GuacamoleClientInformation info = new GuacamoleClientInformation();
|
||||
info.setOptimalScreenWidth(Integer.parseInt(width));
|
||||
info.setOptimalScreenHeight(Integer.parseInt(height));
|
||||
|
||||
// Add audio mimetypes
|
||||
String[] audio_mimetypes = request.getParameterValues("audio");
|
||||
if (audio_mimetypes != null)
|
||||
info.getAudioMimetypes().addAll(Arrays.asList(audio_mimetypes));
|
||||
|
||||
// Add video mimetypes
|
||||
String[] video_mimetypes = request.getParameterValues("video");
|
||||
if (video_mimetypes != null)
|
||||
info.getVideoMimetypes().addAll(Arrays.asList(video_mimetypes));
|
||||
|
||||
// Create our configuration
|
||||
GuacamoleConfiguration config = new GuacamoleConfiguration();
|
||||
|
@ -44,6 +44,109 @@
|
||||
<script type="text/javascript" src="guacamole-common-js/audio.js"></script>
|
||||
<script type="text/javascript" src="guacamole-common-js/guacamole.js"></script>
|
||||
<script type="text/javascript" src="guacamole-common-js/oskeyboard.js"></script>
|
||||
<script type="text/javascript"> /* <![CDATA[ */
|
||||
|
||||
/**
|
||||
Get Audio supported items
|
||||
*/
|
||||
GuacAudio = new (function() {
|
||||
|
||||
var codecs = [
|
||||
'audio/ogg; codecs="vorbis"',
|
||||
'audio/mp4; codecs="mp4a.40.5"',
|
||||
'audio/mpeg; codecs="mp3"',
|
||||
'audio/webm; codecs="vorbis"',
|
||||
'audio/wav; codecs=1'
|
||||
];
|
||||
|
||||
var probably_supported = [];
|
||||
var maybe_supported = [];
|
||||
|
||||
/**
|
||||
* Array of all supported audio mimetypes, ordered by liklihood of
|
||||
* working.
|
||||
*/
|
||||
this.supported = [];
|
||||
|
||||
// Build array of supported audio formats
|
||||
codecs.forEach(function(mimetype) {
|
||||
|
||||
var audio = new Audio();
|
||||
var support_level = audio.canPlayType(mimetype);
|
||||
|
||||
// Trim semicolon and trailer
|
||||
var semicolon = mimetype.indexOf(";");
|
||||
if (semicolon != -1)
|
||||
mimetype = mimetype.substring(0, semicolon);
|
||||
|
||||
// Partition by probably/maybe
|
||||
if (support_level == "probably")
|
||||
probably_supported.push(mimetype);
|
||||
else if (support_level == "maybe")
|
||||
maybe_supported.push(mimetype);
|
||||
|
||||
});
|
||||
|
||||
// Add probably supported types first
|
||||
Array.prototype.push.apply(
|
||||
this.supported, probably_supported);
|
||||
|
||||
// Prioritize "maybe" supported types second
|
||||
Array.prototype.push.apply(
|
||||
this.supported, maybe_supported);
|
||||
|
||||
})();
|
||||
|
||||
|
||||
GuacVideo = new (function() {
|
||||
|
||||
var codecs = [
|
||||
'video/ogg; codecs="theora, vorbis"',
|
||||
'video/mp4; codecs="avc1.4D401E, mp4a.40.5"',
|
||||
'video/webm; codecs="vp8.0, vorbis"'
|
||||
];
|
||||
|
||||
var probably_supported = [];
|
||||
var maybe_supported = [];
|
||||
|
||||
/**
|
||||
* Array of all supported video mimetypes, ordered by liklihood of
|
||||
* working.
|
||||
*/
|
||||
this.supported = [];
|
||||
|
||||
// Build array of supported audio formats
|
||||
codecs.forEach(function(mimetype) {
|
||||
|
||||
var video = document.createElement("video");
|
||||
var support_level = video.canPlayType(mimetype);
|
||||
|
||||
// Trim semicolon and trailer
|
||||
var semicolon = mimetype.indexOf(";");
|
||||
if (semicolon != -1)
|
||||
mimetype = mimetype.substring(0, semicolon);
|
||||
|
||||
// Partition by probably/maybe
|
||||
if (support_level == "probably")
|
||||
probably_supported.push(mimetype);
|
||||
else if (support_level == "maybe")
|
||||
maybe_supported.push(mimetype);
|
||||
|
||||
});
|
||||
|
||||
// Add probably supported types first
|
||||
Array.prototype.push.apply(
|
||||
this.supported, probably_supported);
|
||||
|
||||
// Prioritize "maybe" supported types second
|
||||
Array.prototype.push.apply(
|
||||
this.supported, maybe_supported);
|
||||
|
||||
})();
|
||||
|
||||
|
||||
/* ]]> */
|
||||
</script>
|
||||
|
||||
</head>
|
||||
|
||||
@ -80,10 +183,21 @@
|
||||
// Get display div from document
|
||||
var display = document.getElementById("display");
|
||||
|
||||
var tunnel;
|
||||
|
||||
// If WebSocket available, try to use it.
|
||||
if (window.WebSocket)
|
||||
tunnel = new Guacamole.ChainedTunnel(
|
||||
new Guacamole.WebSocketTunnel("websocket-tunnel"),
|
||||
new Guacamole.HTTPTunnel("tunnel")
|
||||
);
|
||||
|
||||
// If no WebSocket, then use HTTP.
|
||||
else
|
||||
tunnel = new Guacamole.HTTPTunnel("tunnel")
|
||||
|
||||
// Instantiate client, using an HTTP tunnel for communications.
|
||||
var guac = new Guacamole.Client(
|
||||
new Guacamole.HTTPTunnel("tunnel")
|
||||
);
|
||||
var guac = new Guacamole.Client(tunnel);
|
||||
|
||||
|
||||
// Add client to display div
|
||||
@ -115,6 +229,15 @@
|
||||
// the sake of authentication.
|
||||
var connect_string = "data=" + data + "&width=" + optimal_width + "&height=" + optimal_height;
|
||||
|
||||
// Add audio mimetypes to connect_string
|
||||
GuacAudio.supported.forEach(function(mimetype) {
|
||||
connect_string += "&audio=" + encodeURIComponent(mimetype);
|
||||
});
|
||||
|
||||
// Add video mimetypes to connect_string
|
||||
GuacVideo.supported.forEach(function(mimetype) {
|
||||
connect_string += "&video=" + encodeURIComponent(mimetype);
|
||||
});
|
||||
display.appendChild(inner);
|
||||
|
||||
guac.connect(connect_string);
|
||||
|
Loading…
Reference in New Issue
Block a user