GUACAMOLE-346: Always replay frames asynchronously when seeking.

This commit is contained in:
Michael Jumper
2017-07-15 16:06:32 -07:00
parent 1d6e8d2216
commit 744574d026

View File

@@ -315,11 +315,10 @@ Guacamole.SessionRecording = function SessionRecording(tunnel) {
/** /**
* Moves the playback position to the given frame, resetting the state of * Moves the playback position to the given frame, resetting the state of
* the playback client and replaying frames as necessary. If the seek * the playback client and replaying frames as necessary. The seek
* cannot be completed quickly, the seek operation may proceed * operation will proceed asynchronously. If a seek operation is already in
* asynchronously. If a seek operation is already in progress, that seek is * progress, that seek is first aborted. The progress of the seek operation
* first aborted. The progress of the seek operation can be observed * can be observed through the onseek handler and the provided callback.
* through the onseek handler and the provided callback.
* *
* @private * @private
* @param {Number} index * @param {Number} index
@@ -358,6 +357,9 @@ Guacamole.SessionRecording = function SessionRecording(tunnel) {
// Advance to frame index after current state // Advance to frame index after current state
startIndex++; startIndex++;
// Replay frames asynchronously
seekTimeout = window.setTimeout(function continueSeek() {
var startTime = new Date().getTime(); var startTime = new Date().getTime();
// Replay any applicable incremental frames // Replay any applicable incremental frames
@@ -380,9 +382,7 @@ Guacamole.SessionRecording = function SessionRecording(tunnel) {
// If the seek operation has not yet completed, schedule continuation // If the seek operation has not yet completed, schedule continuation
if (currentFrame !== index) if (currentFrame !== index)
seekTimeout = window.setTimeout(function continueSeek() {
seekToFrame(index, callback); seekToFrame(index, callback);
}, 0);
else { else {
@@ -392,6 +392,8 @@ Guacamole.SessionRecording = function SessionRecording(tunnel) {
} }
}, 0);
}; };
/** /**
@@ -598,8 +600,7 @@ Guacamole.SessionRecording = function SessionRecording(tunnel) {
* currently being played back, playback will continue after the seek is * currently being played back, playback will continue after the seek is
* performed. If the recording is currently paused, playback will be * performed. If the recording is currently paused, playback will be
* paused after the seek is performed. If a seek operation is already in * paused after the seek is performed. If a seek operation is already in
* progress, that seek is first aborted. Depending on how much processing * progress, that seek is first aborted. The seek operation will proceed
* the seek operation requires, the seek operation may proceed
* asynchronously. * asynchronously.
* *
* @param {Number} position * @param {Number} position