From d0257122bbd77928886c28b47137a4cd6a76bde8 Mon Sep 17 00:00:00 2001 From: Michael Jumper Date: Mon, 14 Feb 2022 09:21:22 -0800 Subject: [PATCH] GUACAMOLE-896: Leverage Blobs for storage of recording keyframes. --- .../src/main/webapp/modules/SessionRecording.js | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/guacamole-common-js/src/main/webapp/modules/SessionRecording.js b/guacamole-common-js/src/main/webapp/modules/SessionRecording.js index cc8f9e6fc..9673a0760 100644 --- a/guacamole-common-js/src/main/webapp/modules/SessionRecording.js +++ b/guacamole-common-js/src/main/webapp/modules/SessionRecording.js @@ -548,7 +548,7 @@ Guacamole.SessionRecording = function SessionRecording(source) { // Store client state if frame is flagged as a keyframe if (frame.keyframe && !frame.clientState) { playbackClient.exportState(function storeClientState(state) { - frame.clientState = state; + frame.clientState = new Blob([JSON.stringify(state)]); }); } @@ -606,8 +606,10 @@ Guacamole.SessionRecording = function SessionRecording(source) { // If frame has associated absolute state, make that frame the // current state if (frame.clientState) { - playbackClient.importState(frame.clientState); - currentFrame = index; + frame.clientState.text().then(function textReady(text) { + playbackClient.importState(JSON.parse(text)); + currentFrame = index; + }); break; } @@ -1058,10 +1060,12 @@ Guacamole.SessionRecording._Frame = function _Frame(timestamp, start, end) { /** * A snapshot of client state after this frame was rendered, as returned by - * a call to exportState(). If no such snapshot has been taken, this will - * be null. + * a call to exportState(), serialized as JSON, and stored within a Blob. + * Use of Blobs here is required to ensure the browser can make use of + * larger disk-backed storage if the size of the recording is large. If no + * such snapshot has been taken, this will be null. * - * @type {object} + * @type {Blob} * @default null */ this.clientState = null;