mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-07 05:31:22 +00:00
GUACAMOLE-346: Always replay frames asynchronously when seeking.
This commit is contained in:
@@ -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,39 +357,42 @@ Guacamole.SessionRecording = function SessionRecording(tunnel) {
|
|||||||
// Advance to frame index after current state
|
// Advance to frame index after current state
|
||||||
startIndex++;
|
startIndex++;
|
||||||
|
|
||||||
var startTime = new Date().getTime();
|
// Replay frames asynchronously
|
||||||
|
seekTimeout = window.setTimeout(function continueSeek() {
|
||||||
|
|
||||||
// Replay any applicable incremental frames
|
var startTime = new Date().getTime();
|
||||||
for (; startIndex <= index; startIndex++) {
|
|
||||||
|
|
||||||
// Stop seeking if the operation is taking too long
|
// Replay any applicable incremental frames
|
||||||
var currentTime = new Date().getTime();
|
for (; startIndex <= index; startIndex++) {
|
||||||
if (currentTime - startTime >= MAXIMUM_SEEK_TIME)
|
|
||||||
break;
|
|
||||||
|
|
||||||
replayFrame(startIndex);
|
// Stop seeking if the operation is taking too long
|
||||||
}
|
var currentTime = new Date().getTime();
|
||||||
|
if (currentTime - startTime >= MAXIMUM_SEEK_TIME)
|
||||||
|
break;
|
||||||
|
|
||||||
// Current frame is now at requested index
|
replayFrame(startIndex);
|
||||||
currentFrame = startIndex - 1;
|
}
|
||||||
|
|
||||||
// Notify of changes in position
|
// Current frame is now at requested index
|
||||||
if (recording.onseek)
|
currentFrame = startIndex - 1;
|
||||||
recording.onseek(recording.getPosition());
|
|
||||||
|
|
||||||
// If the seek operation has not yet completed, schedule continuation
|
// Notify of changes in position
|
||||||
if (currentFrame !== index)
|
if (recording.onseek)
|
||||||
seekTimeout = window.setTimeout(function continueSeek() {
|
recording.onseek(recording.getPosition());
|
||||||
|
|
||||||
|
// If the seek operation has not yet completed, schedule continuation
|
||||||
|
if (currentFrame !== index)
|
||||||
seekToFrame(index, callback);
|
seekToFrame(index, callback);
|
||||||
}, 0);
|
|
||||||
|
|
||||||
else {
|
else {
|
||||||
|
|
||||||
// Notify that the requested seek has completed
|
// Notify that the requested seek has completed
|
||||||
if (callback)
|
if (callback)
|
||||||
callback();
|
callback();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}, 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
|
||||||
|
Reference in New Issue
Block a user