Implement audio instruction.

This commit is contained in:
Michael Jumper
2012-10-24 00:18:43 -07:00
parent 61abcc639b
commit 56495c7cfa

View File

@@ -273,6 +273,9 @@ Guacamole.Client = function(tunnel) {
// No initial parsers // No initial parsers
var parsers = []; var parsers = [];
// No initial audio channels
var audio_channels = [];
tunnel.onerror = function(message) { tunnel.onerror = function(message) {
if (guac_client.onerror) if (guac_client.onerror)
guac_client.onerror(message); guac_client.onerror(message);
@@ -528,6 +531,18 @@ Guacamole.Client = function(tunnel) {
} }
function getAudioChannel(index) {
var audio_channel = audio_channels[index];
// If audio channel not yet created, create it
if (audio_channel == null)
audio_channel = audio_channels[index] = new Guacamole.AudioChannel();
return audio_channel;
}
/** /**
* Handlers for all defined layer properties. * Handlers for all defined layer properties.
* @private * @private
@@ -561,6 +576,17 @@ Guacamole.Client = function(tunnel) {
}, },
"audio": function(parameters) {
var channel = getAudioChannel(parseInt(parameters[0]));
var mimetype = parameters[1];
var duration = parseInt(parameters[2]);
var data = parameters[3];
channel.play(mimetype, duration, data);
},
"cfill": function(parameters) { "cfill": function(parameters) {
var channelMask = parseInt(parameters[0]); var channelMask = parseInt(parameters[0]);