mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-06 13:17:41 +00:00
GUACAMOLE-346: Playback must take into account that seeking is asynchronous.
This commit is contained in:
@@ -415,32 +415,34 @@ Guacamole.SessionRecording = function SessionRecording(tunnel) {
|
|||||||
var continuePlayback = function continuePlayback() {
|
var continuePlayback = function continuePlayback() {
|
||||||
|
|
||||||
// Advance to next frame
|
// Advance to next frame
|
||||||
seekToFrame(currentFrame + 1);
|
seekToFrame(currentFrame + 1, function playbackSeekComplete() {
|
||||||
|
|
||||||
// If frames remain after advancing, schedule next frame
|
// If frames remain after advancing, schedule next frame
|
||||||
if (currentFrame + 1 < frames.length) {
|
if (currentFrame + 1 < frames.length) {
|
||||||
|
|
||||||
// Pull the upcoming frame
|
// Pull the upcoming frame
|
||||||
var next = frames[currentFrame + 1];
|
var next = frames[currentFrame + 1];
|
||||||
|
|
||||||
// Calculate the real timestamp corresponding to when the next
|
// Calculate the real timestamp corresponding to when the next
|
||||||
// frame begins
|
// frame begins
|
||||||
var nextRealTimestamp = next.timestamp - startVideoTimestamp + startRealTimestamp;
|
var nextRealTimestamp = next.timestamp - startVideoTimestamp + startRealTimestamp;
|
||||||
|
|
||||||
// Calculate the relative delay between the current time and
|
// Calculate the relative delay between the current time and
|
||||||
// the next frame start
|
// the next frame start
|
||||||
var delay = Math.max(nextRealTimestamp - new Date().getTime(), 0);
|
var delay = Math.max(nextRealTimestamp - new Date().getTime(), 0);
|
||||||
|
|
||||||
// Advance to next frame after enough time has elapsed
|
// Advance to next frame after enough time has elapsed
|
||||||
playbackTimeout = window.setTimeout(function frameDelayElapsed() {
|
playbackTimeout = window.setTimeout(function frameDelayElapsed() {
|
||||||
continuePlayback();
|
continuePlayback();
|
||||||
}, delay);
|
}, delay);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Otherwise stop playback
|
// Otherwise stop playback
|
||||||
else
|
else
|
||||||
recording.pause();
|
recording.pause();
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user