new SessionRecording(source)
A recording of a Guacamole session. Given a Guacamole.Tunnel or Blob,
the Guacamole.SessionRecording automatically parses Guacamole instructions
within the recording source as it plays back the recording. Playback of the
recording may be controlled through function calls to the
Guacamole.SessionRecording, even while the recording has not yet finished
being created or downloaded. Parsing of the contents of the recording will
begin immediately and automatically after this constructor is invoked.
Parameters:
Name | Type | Description |
---|---|---|
source |
Blob | Guacamole.Tunnel | The Blob from which the instructions of the recording should be read. |
Methods
abort()
Aborts the loading process, stopping further processing of the
provided data. If the underlying recording source is a Guacamole tunnel,
it will be disconnected.
cancel()
Cancels the current seek operation, setting the current frame of the
recording to wherever the seek operation was able to reach prior to
being cancelled. If a callback was provided to seek(), that callback
is invoked. If a seek operation is not currently underway, this
function has no effect.
connect(dataopt)
Connects the underlying tunnel, beginning download of the Guacamole
session. Playback of the Guacamole session cannot occur until at least
one frame worth of instructions has been downloaded. If the underlying
recording source is a Blob, this function has no effect.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
data |
string |
<optional> |
The data to send to the tunnel when connecting. |
disconnect()
Disconnects the underlying tunnel, stopping further download of the
Guacamole session. If the underlying recording source is a Blob, this
function has no effect.
getDisplay() → (non-null) {Guacamole.Display}
Returns the underlying display of the Guacamole.Client used by this
Guacamole.SessionRecording for playback. The display contains an Element
which can be added to the DOM, causing the display (and thus playback of
the recording) to become visible.
Returns:
The underlying display of the Guacamole.Client used by this
Guacamole.SessionRecording for playback.
- Type
- Guacamole.Display
getDuration() → (non-null) {number}
Returns the duration of this recording, in milliseconds. If the
recording is still being downloaded, this value will gradually increase.
Returns:
The duration of this recording, in milliseconds.
- Type
- number
getPosition() → (non-null) {number}
Returns the current playback position within the recording, in
milliseconds, where zero is the start of the recording.
Returns:
The current playback position within the recording, in milliseconds.
- Type
- number
isPlaying() → (non-null) {boolean}
Returns whether playback is currently in progress.
Returns:
true if playback is currently in progress, false otherwise.
- Type
- boolean
pause()
Pauses playback of the recording, if playback is currently in progress.
If playback is not in progress, this function has no effect. If a seek
operation is in progress, the seek is aborted. Playback is initially
paused when a Guacamole.SessionRecording is created, and must be
explicitly started through a call to play().
play()
Begins continuous playback of the recording downloaded thus far.
Playback of the recording will continue until pause() is invoked or
until no further frames exist. Playback is initially paused when a
Guacamole.SessionRecording is created, and must be explicitly started
through a call to this function. If playback is already in progress,
this function has no effect. If a seek operation is in progress,
playback resumes at the current position, and the seek is aborted as if
completed.
seek(positionnon-null, callbackopt)
Seeks to the given position within the recording. If the recording is
currently being played back, playback will continue after the seek is
performed. If the recording is currently paused, playback will be
paused after the seek is performed. If a seek operation is already in
progress, that seek is first aborted. The seek operation will proceed
asynchronously.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
position |
number | The position within the recording to seek to, in milliseconds. | |
callback |
function |
<optional> |
The callback to invoke once the seek operation has completed. |
Events
onabort
Fired when further loading of this recording has been explicitly
aborted through a call to abort().
onerror
Fired when an error occurs which prevents the recording from being
played back.
Parameters:
Name | Type | Description |
---|---|---|
message |
string | A human-readable message describing the error that occurred. |
onload
Fired when loading of this recording has completed and all frames
are available.
onpause
Fired whenever playback of the recording has been paused. This may
happen when playback is explicitly paused with a call to pause(), or
when playback is implicitly paused due to reaching the end of the
recording.
onplay
Fired whenever playback of the recording has started.
onprogress
Fired when new frames have become available while the recording is
being downloaded.
Parameters:
Name | Type | Description |
---|---|---|
duration |
number | The new duration of the recording, in milliseconds. |
parsedSize |
number | The number of bytes that have been loaded/parsed. |
onseek
Fired whenever the playback position within the recording changes.
Parameters:
Name | Type | Description |
---|---|---|
position |
number | The new position within the recording, in milliseconds. |
current |
number | The number of frames that have been seeked through. If not seeking through multiple frames due to a call to seek(), this will be 1. |
total |
number | The number of frames that are being seeked through in the current seek operation. If not seeking through multiple frames due to a call to seek(), this will be 1. |