From efcda749122860d94bf4aeadd67c182a940ad447 Mon Sep 17 00:00:00 2001 From: Michael Jumper Date: Tue, 24 Sep 2013 14:08:39 -0700 Subject: [PATCH] Modify audio support to handle blob packets rather than base64. --- .../src/main/resources/audio.js | 73 +++++++++++++------ 1 file changed, 49 insertions(+), 24 deletions(-) diff --git a/guacamole-common-js/src/main/resources/audio.js b/guacamole-common-js/src/main/resources/audio.js index 9002dc1f3..8560aea55 100644 --- a/guacamole-common-js/src/main/resources/audio.js +++ b/guacamole-common-js/src/main/resources/audio.js @@ -68,7 +68,7 @@ Guacamole.AudioChannel = function() { * @param {String} mimetype The mimetype of the data provided. * @param {Number} duration The duration of the data provided, in * milliseconds. - * @param {String} data The base64-encoded data to play. + * @param {Blob} data The blob data to play. */ this.play = function(mimetype, duration, data) { @@ -130,7 +130,7 @@ Guacamole.AudioChannel.getTimestamp = function() { * @constructor * * @param {String} mimetype The mimetype of the data contained by this packet. - * @param {String} data The base64-encoded sound data contained by this packet. + * @param {Blob} data The blob of sound data contained by this packet. */ Guacamole.AudioChannel.Packet = function(mimetype, data) { @@ -154,19 +154,15 @@ Guacamole.AudioChannel.Packet = function(mimetype, data) { readyBuffer = buffer; }; - // Convert to ArrayBuffer - var binary = window.atob(data); - var arrayBuffer = new ArrayBuffer(binary.length); - var bufferView = new Uint8Array(arrayBuffer); - - for (var i=0; i