-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathguacamole.d.ts
2819 lines (2553 loc) · 112 KB
/
guacamole.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
declare module '@ashishpatel/guacamole-common-js' {
/**
* Dynamic on-screen keyboard. Given the layout object for an on-screen
* keyboard, this object will construct a clickable on-screen keyboard with its
* own key events.
*/
class OnScreenKeyboard {
constructor(layout: OnScreenKeyboard.Layout);
/**
* The number of mousemove events to require before re-enabling mouse
* event handling after receiving a touch event.
*
* @type {Number}
*/
touchMouseThreshold: number;
/**
* Fired whenever the user presses a key on this Guacamole.OnScreenKeyboard.
*
* @event
* @param {Number} keysym The keysym of the key being pressed.
*/
onkeydown(keysym: number): void;
/**
* Fired whenever the user releases a key on this Guacamole.OnScreenKeyboard.
*
* @event
* @param {Number} keysym The keysym of the key being released.
*/
onkeyup(keysym: number): void;
/**
* The keyboard layout provided at time of construction.
*
* @type {Guacamole.OnScreenKeyboard.Layout}
*/
layout: OnScreenKeyboard.Layout;
/**
* Returns the element containing the entire on-screen keyboard.
* @returns {Element} The element containing the entire on-screen keyboard.
*/
getElement(): any;
/**
* Resizes all elements within this Guacamole.OnScreenKeyboard such that
* the width is close to but does not exceed the specified width. The
* height of the keyboard is determined based on the width.
*
* @param {Number} width The width to resize this Guacamole.OnScreenKeyboard
* to, in pixels.
*/
resize(width: number): void;
/**
* Resets the state of this keyboard, releasing all keys, and firing keyup
* events for each released key.
*/
reset(): void;
}
namespace OnScreenKeyboard {
class Layout {
/**
* @constructor
* @param {Guacamole.OnScreenKeyboard.Layout|Object} template
* The object whose identically-named properties will be used to initialize
* the properties of this layout.
*/
constructor(template: any);
/**
* The language of keyboard layout, such as "en_US". This property is for
* informational purposes only, but it is recommend to conform to the
* [language code]_[country code] format.
*
* @type {String}
*/
language: string;
/**
* The type of keyboard layout, such as "qwerty". This property is for
* informational purposes only, and does not conform to any standard.
*
* @type {String}
*/
type: string;
/**
* Map of key name to corresponding keysym, title, or key object. If only
* the keysym or title is provided, the key object will be created
* implicitly. In all cases, the name property of the key object will be
* taken from the name given in the mapping.
*
* @type {Object.<String, Number|String|Guacamole.OnScreenKeyboard.Key|Guacamole.OnScreenKeyboard.Key[]>}
*/
keys: any;
/**
* Arbitrarily nested, arbitrarily grouped key names. The contents of the
* layout will be traversed to produce an identically-nested grouping of
* keys in the DOM tree. All strings will be transformed into their
* corresponding sets of keys, while all objects and arrays will be
* transformed into named groups and anonymous groups respectively. Any
* numbers present will be transformed into gaps of that size, scaled
* according to the same units as each key.
*
* @type {Object}
*/
layout: any;
/**
* The width of the entire keyboard, in arbitrary units. The width of each
* key is relative to this width, as both width values are assumed to be in
* the same units. The conversion factor between these units and pixels is
* derived later via a call to resize() on the Guacamole.OnScreenKeyboard.
*
* @type {Number}
*/
width: number;
/**
* The width of each key, in arbitrary units, relative to other keys in
* this layout. The true pixel size of each key will be determined by the
* overall size of the keyboard. If not defined here, the width of each
* key will default to 1.
*
* @type {Object.<String, Number>}
*/
keyWidths: any;
}
/**
* Represents a single key, or a single possible behavior of a key. Each key
* on the on-screen keyboard must have at least one associated
* Guacamole.OnScreenKeyboard.Key, whether that key is explicitly defined or
* implied, and may have multiple Guacamole.OnScreenKeyboard.Key if behavior
* depends on modifier states.
*/
class Key {
constructor(template: any, name: string);
/**
* The unique name identifying this key within the keyboard layout.
*
* @type {String}
*/
name: string;
/**
* The human-readable title that will be displayed to the user within the
* key. If not provided, this will be derived from the key name.
*
* @type {String}
*/
title: string;
/**
* The name of the modifier set when the key is pressed and cleared when
* this key is released, if any. The names of modifiers are distinct from
* the names of keys; both the "RightShift" and "LeftShift" keys may set
* the "shift" modifier, for example. By default, the key will affect no
* modifiers.
*
* @type {String}
*/
modifier: string;
/**
* An array containing the names of each modifier required for this key to
* have an effect. For example, a lowercase letter may require nothing,
* while an uppercase letter would require "shift", assuming the Shift key
* is named "shift" within the layout. By default, the key will require
* no modifiers.
*
* @type {String[]}
*/
requires: string[];
}
}
/**
* Guacamole protocol client. Given a {@link Guacamole.Tunnel},
* automatically handles incoming and outgoing Guacamole instructions via the
* provided tunnel, updating its display using one or more canvas elements.
*/
class Client {
/**
* @param {Guacamole.Tunnel} tunnel The tunnel to use to send and receive
* Guacamole instructions.
*/
constructor(tunnel: Tunnel);
/**
* Produces an opaque representation of Guacamole.Client state which can be
* later imported through a call to importState(). This object is
* effectively an independent, compressed snapshot of protocol and display
* state. Invoking this function implicitly flushes the display.
*
* @param {function} callback
* Callback which should be invoked once the state object is ready. The
* state object will be passed to the callback as the sole parameter.
* This callback may be invoked immediately, or later as the display
* finishes rendering and becomes ready.
*/
exportState(callback: any): void;
/**
* Restores Guacamole.Client protocol and display state based on an opaque
* object from a prior call to exportState(). The Guacamole.Client instance
* used to that state need not be the same as this instance.
*
* @param {Object} state
* An opaque representation of Guacamole.Client state from a prior call
* to exportState().
*
* @param {function} [callback]
* The function to invoke when state has finished being imported. This
* may happen immediately, or later as images within the provided state
* object are loaded.
*/
importState(state: any, callback: any): void;
/**
* Returns the underlying display of this Guacamole.Client. The display
* contains an Element which can be added to the DOM, causing the
* display to become visible.
*
* @return {Guacamole.Display} The underlying display of this
* Guacamole.Client.
*/
getDisplay(): Display;
/**
* Sends a disconnect instruction to the server and closes the tunnel.
*/
disconnect(): void;
/**
* Connects the underlying tunnel of this Guacamole.Client, passing the
* given arbitrary data to the tunnel during the connection process.
*
* @param data Arbitrary connection data to be sent to the underlying
* tunnel during the connection process.
* @throws {Guacamole.Status} If an error occurs during connection.
*/
connect(data: any): void;
/**
* Sends a mouse event having the properties provided by the given mouse
* state.
*
* @param {Guacamole.Mouse.State} mouseState The state of the mouse to send
* in the mouse event.
*/
sendMouseState(mouseState: Mouse.State): void;
/**
* Sends a key event having the given properties as if the user
* pressed or released a key.
*
* @param {Boolean} pressed Whether the key is pressed (true) or released
* (false).
* @param {Number} keysym The keysym of the key being pressed or released.
*/
sendKeyEvent(pressed: number, keysym: number): void;
/**
* Sends the current size of the screen.
*
* @param {Number} width The width of the screen.
* @param {Number} height The height of the screen.
*/
sendSize(width: number, height: number): void;
/**
* Sets the clipboard of the remote client to the given text data.
*
* @deprecated Use createClipboardStream() instead.
* @param {String} data The data to send as the clipboard contents.
*/
setClipboard(data: string): void;
/**
* Allocates an available stream index and creates a new
* Guacamole.OutputStream using that index, associating the resulting
* stream with this Guacamole.Client. Note that this stream will not yet
* exist as far as the other end of the Guacamole connection is concerned.
* Streams exist within the Guacamole protocol only when referenced by an
* instruction which creates the stream, such as a "clipboard", "file", or
* "pipe" instruction.
*
* @returns {Guacamole.OutputStream}
* A new Guacamole.OutputStream with a newly-allocated index and
* associated with this Guacamole.Client.
*/
createOutputStream(): OutputStream;
/**
* Opens a new audio stream for writing, where audio data having the give
* mimetype will be sent along the returned stream. The instruction
* necessary to create this stream will automatically be sent.
*
* @param {String} mimetype
* The mimetype of the audio data that will be sent along the returned
* stream.
*
* @return {Guacamole.OutputStream}
* The created audio stream.
*/
createAudioStream(mimetype: string): OutputStream;
/**
* Opens a new file for writing, having the given index, mimetype and
* filename. The instruction necessary to create this stream will
* automatically be sent.
*
* @param {String} mimetype The mimetype of the file being sent.
* @param {String} filename The filename of the file being sent.
* @return {Guacamole.OutputStream} The created file stream.
*/
createFileStream(mimetype: string, filename: string): OutputStream;
/**
* Opens a new pipe for writing, having the given name and mimetype. The
* instruction necessary to create this stream will automatically be sent.
*
* @param {String} mimetype The mimetype of the data being sent.
* @param {String} name The name of the pipe.
* @return {Guacamole.OutputStream} The created file stream.
*/
createPipeStream(mimetype: string, name: string): OutputStream;
/**
* Opens a new clipboard object for writing, having the given mimetype. The
* instruction necessary to create this stream will automatically be sent.
*
* @param {String} mimetype The mimetype of the data being sent.
* @param {String} name The name of the pipe.
* @return {Guacamole.OutputStream} The created file stream.
*/
createClipboardStream(mimetype: string): OutputStream;
/**
* Creates a new output stream associated with the given object and having
* the given mimetype and name. The legality of a mimetype and name is
* dictated by the object itself. The instruction necessary to create this
* stream will automatically be sent.
*
* @param {Number} index
* The index of the object for which the output stream is being
* created.
*
* @param {String} mimetype
* The mimetype of the data which will be sent to the output stream.
*
* @param {String} name
* The defined name of an output stream within the given object.
*
* @returns {Guacamole.OutputStream}
* An output stream which will write blobs to the named output stream
* of the given object.
*/
createObjectOutputStream(index: number, mimetype: string, name: string): OutputStream;
/**
* Requests read access to the input stream having the given name. If
* successful, a new input stream will be created.
*
* @param {Number} index
* The index of the object from which the input stream is being
* requested.
*
* @param {String} name
* The name of the input stream to request.
*/
requestObjectInputStream(index: number, name: string): void;
/**
* Acknowledge receipt of a blob on the stream with the given index.
*
* @param {Number} index The index of the stream associated with the
* received blob.
* @param {String} message A human-readable message describing the error
* or status.
* @param {Number} code The error code, if any, or 0 for success.
*/
sendAck(index: number, message: string, code: number): void;
/**
* Given the index of a file, writes a blob of data to that file.
*
* @param {Number} index The index of the file to write to.
* @param {String} data Base64-encoded data to write to the file.
*/
sendBlob(index: number, data: string): void;
/**
* Marks a currently-open stream as complete. The other end of the
* Guacamole connection will be notified via an "end" instruction that the
* stream is closed, and the index will be made available for reuse in
* future streams.
*
* @param {Number} index
* The index of the stream to end.
*/
endStream(index: number): void;
/**
* Fired whenever the state of this Guacamole.Client changes.
*
* @event
* @param {Number} state The new state of the client.
*/
onstatechange(state: number): void;
/**
* Fired when the remote client sends a name update.
*
* @event
* @param {String} name The new name of this client.
*/
onname(name: string): void;
/**
* Fired when an error is reported by the remote client, and the connection
* is being closed.
*
* @event
* @param {Guacamole.Status} status A status object which describes the
* error.
*/
onerror(status: Status): void;
/**
* Fired when a audio stream is created. The stream provided to this event
* handler will contain its own event handlers for received data.
*
* @event
* @param {Guacamole.InputStream} stream
* The stream that will receive audio data from the server.
*
* @param {String} mimetype
* The mimetype of the audio data which will be received.
*
* @return {Guacamole.AudioPlayer}
* An object which implements the Guacamole.AudioPlayer interface and
* has been initialized to play the data in the provided stream, or null
* if the built-in audio players of the Guacamole client should be
* used.
*/
onaudio(stream: InputStream, mimetype: string): AudioPlayer;
/**
* Fired when a video stream is created. The stream provided to this event
* handler will contain its own event handlers for received data.
*
* @event
* @param {Guacamole.InputStream} stream
* The stream that will receive video data from the server.
*
* @param {Guacamole.Display.VisibleLayer} layer
* The destination layer on which the received video data should be
* played. It is the responsibility of the Guacamole.VideoPlayer
* implementation to play the received data within this layer.
*
* @param {String} mimetype
* The mimetype of the video data which will be received.
*
* @return {Guacamole.VideoPlayer}
* An object which implements the Guacamole.VideoPlayer interface and
* has been initialied to play the data in the provided stream, or null
* if the built-in video players of the Guacamole client should be
* used.
*/
onvideo(stream: InputStream, layer: Display.VisibleLayer, mimetype: string): VideoPlayer;
/**
* Fired when the clipboard of the remote client is changing.
*
* @event
* @param {Guacamole.InputStream} stream The stream that will receive
* clipboard data from the server.
* @param {String} mimetype The mimetype of the data which will be received.
*/
onclipboard(stream: InputStream, mimetype: string): void;
/**
* Fired when a file stream is created. The stream provided to this event
* handler will contain its own event handlers for received data.
*
* @event
* @param {Guacamole.InputStream} stream The stream that will receive data
* from the server.
* @param {String} mimetype The mimetype of the file received.
* @param {String} filename The name of the file received.
*/
onfile(stream: InputStream, mimetype: string, filename: string): void;
/**
* Fired when a filesystem object is created. The object provided to this
* event handler will contain its own event handlers and functions for
* requesting and handling data.
*
* @event
* @param {Guacamole.Object} object
* The created filesystem object.
*
* @param {String} name
* The name of the filesystem.
*/
onfilesystem(object: Object, name: string): void;
/**
* Fired when a pipe stream is created. The stream provided to this event
* handler will contain its own event handlers for received data;
*
* @event
* @param {Guacamole.InputStream} stream The stream that will receive data
* from the server.
* @param {String} mimetype The mimetype of the data which will be received.
* @param {String} name The name of the pipe.
*/
onpipe(stream: InputStream, mimetype: string, name: string): void;
/**
* Fired whenever a sync instruction is received from the server, indicating
* that the server is finished processing any input from the client and
* has sent any results.
*
* @event
* @param {Number} timestamp The timestamp associated with the sync
* instruction.
*/
onsync(timestamp: number): void;
}
/**
* Core object providing abstract communication for Guacamole. This object
* is a null implementation whose functions do nothing. Guacamole applications
* should use {@link Guacamole.HTTPTunnel} instead, or implement their own tunnel based
* on this one.
*
* @constructor
* @see Guacamole.HTTPTunnel
*/
class Tunnel {
static INTERNAL_DATA_OPCODE: string;
static State: any;
uuid: string;
/**
* The current state of this tunnel.
*
* @type {Number}
*/
state: number;
/**
* The maximum amount of time to wait for data to be received, in
* milliseconds. If data is not received within this amount of time,
* the tunnel is closed with an error. The default value is 15000.
*
* @type {Number}
*/
receiveTimeout: number;
/**
* Connect to the tunnel with the given optional data. This data is
* typically used for authentication. The format of data accepted is
* up to the tunnel implementation.
*
* @param {String} data The data to send to the tunnel when connecting.
*/
connect(data: string): void;
/**
* Disconnect from the tunnel.
*/
disconnect(): void;
/**
* Fired whenever an error is encountered by the tunnel.
*
* @event
* @param {Guacamole.Status} status A status object which describes the
* error.
*/
onerror(error: Status): void;
/**
* Fired whenever the state of the tunnel changes.
*
* @event
* @param {Number} state The new state of the client.
*/
onstatechange(state: number): void;
/**
* Fired once for every complete Guacamole instruction received, in order.
*
* @event
* @param {String} opcode The Guacamole instruction opcode.
* @param {Array} parameters The parameters provided for the instruction,
* if any.
*/
oninstruction(opcode: string, parameters: any): void;
/**
* Send the given message through the tunnel to the service on the other
* side. All messages are guaranteed to be received in the order sent.
*
* @param {...*} elements
* The elements of the message to send to the service on the other side
* of the tunnel.
*/
sendMessage(elements: any): void;
/**
* Changes the stored numeric state of this tunnel, firing the onstatechange
* event if the new state is different and a handler has been defined.
*
* @private
* @param {Number} state
* The new state of this tunnel.
*/
setState(state: number): void;
}
/**
* Guacamole Tunnel implemented over WebSocket via XMLHttpRequest.
*/
class WebSocketTunnel extends Tunnel {
/**
* @param {String} tunnelURL The URL of the WebSocket tunneling service.
*/
constructor(tunnelURL: string);
}
class SocketIOTunnel extends Tunnel {
constructor(url: string, connectionOptions: any, eventChannel: string);
/**
* Return the socketio socket
*/
getSocket(): any;
}
/**
* Guacamole Tunnel which cycles between all specified tunnels until
* no tunnels are left. Another tunnel is used if an error occurs but
* no instructions have been received. If an instruction has been
* received, or no tunnels remain, the error is passed directly out
* through the onerror handler (if defined).
*/
class ChainedTunnel extends Tunnel {
/**
* @param {...*} tunnelChain
* The tunnels to use, in order of priority.
*/
constructor(tunnelChain: any);
}
/**
* Guacamole Tunnel implemented over HTTP via XMLHttpRequest.
*/
class HTTPTunnel extends Tunnel {
/**
* @param {String} tunnelURL
* The URL of the HTTP tunneling service.
*
* @param {Boolean} [crossDomain=false]
* Whether tunnel requests will be cross-domain, and thus must use CORS
* mechanisms and headers. By default, it is assumed that tunnel requests
* will be made to the same domain.
*
* @param {Object} [extraTunnelHeaders={}]
* Key value pairs containing the header names and values of any additional
* headers to be sent in tunnel requests. By default, no extra headers will
* be added.
*/
constructor(tunnelURL: string, crossDomain: boolean, extraTunnelHeaders: any);
}
/**
* Guacamole Tunnel which replays a Guacamole protocol dump from a static file
* received via HTTP. Instructions within the file are parsed and handled as
* quickly as possible, while the file is being downloaded.
*/
class StaticHTTPTunnel extends Tunnel {
/**
* @param {String} url
* The URL of a Guacamole protocol dump.
*
* @param {Boolean} [crossDomain=false]
* Whether tunnel requests will be cross-domain, and thus must use CORS
* mechanisms and headers. By default, it is assumed that tunnel requests
* will be made to the same domain.
*
* @param {Object} [extraTunnelHeaders={}]
* Key value pairs containing the header names and values of any additional
* headers to be sent in tunnel requests. By default, no extra headers will
* be added.
*/
constructor(url: string, crossDomain: boolean, extraTunnelHeaders: any);
}
/**
* Abstract audio player which accepts, queues and plays back arbitrary audio
* data. It is up to implementations of this class to provide some means of
* handling a provided Guacamole.InputStream. Data received along the provided
* stream is to be played back immediately.
*/
class AudioPlayer {
sync(): void;
/**
* Determines whether the given mimetype is supported by any built-in
* implementation of Guacamole.AudioPlayer, and thus will be properly handled
* by Guacamole.AudioPlayer.getInstance().
*
* @param {String} mimetype
* The mimetype to check.
*
* @returns {Boolean}
* true if the given mimetype is supported by any built-in
* Guacamole.AudioPlayer, false otherwise.
*/
static isSupportedType(mimetype: string): boolean;
/**
* Returns a list of all mimetypes supported by any built-in
* Guacamole.AudioPlayer, in rough order of priority. Beware that only the core
* mimetypes themselves will be listed. Any mimetype parameters, even required
* ones, will not be included in the list. For example, "audio/L8" is a
* supported raw audio mimetype that is supported, but it is invalid without
* additional parameters. Something like "audio/L8;rate=44100" would be valid,
* however (see https://tools.ietf.org/html/rfc4856).
*
* @returns {String[]}
* A list of all mimetypes supported by any built-in Guacamole.AudioPlayer,
* excluding any parameters.
*/
static getSupportedTypes(): string[];
/**
* Returns an instance of Guacamole.AudioPlayer providing support for the given
* audio format. If support for the given audio format is not available, null
* is returned.
*
* @param {Guacamole.InputStream} stream
* The Guacamole.InputStream to read audio data from.
*
* @param {String} mimetype
* The mimetype of the audio data in the provided stream.
*
* @return {Guacamole.AudioPlayer}
* A Guacamole.AudioPlayer instance supporting the given mimetype and
* reading from the given stream, or null if support for the given mimetype
* is absent.
*/
static getInstance(stream: InputStream, mimetype: string): AudioPlayer;
}
/**
* Implementation of Guacamole.AudioPlayer providing support for raw PCM format
* audio. This player relies only on the Web Audio API and does not require any
* browser-level support for its audio formats.
*/
class RawAudioPlayer extends AudioPlayer {
/**
* @augments Guacamole.AudioPlayer
* @param {Guacamole.InputStream} stream
* The Guacamole.InputStream to read audio data from.
*
* @param {String} mimetype
* The mimetype of the audio data in the provided stream, which must be a
* "audio/L8" or "audio/L16" mimetype with necessary parameters, such as:
* "audio/L16;rate=44100,channels=2".
*/
constructor(stream: InputStream, mimetype: string);
/** @override */
sync(): void;
/**
* Determines whether the given mimetype is supported by
* Guacamole.RawAudioPlayer.
*
* @param {String} mimetype
* The mimetype to check.
*
* @returns {Boolean}
* true if the given mimetype is supported by Guacamole.RawAudioPlayer,
* false otherwise.
*/
static isSupportedType(mimetype: string): boolean;
/**
* Returns a list of all mimetypes supported by Guacamole.RawAudioPlayer. Only
* the core mimetypes themselves will be listed. Any mimetype parameters, even
* required ones, will not be included in the list. For example, "audio/L8" is
* a raw audio mimetype that may be supported, but it is invalid without
* additional parameters. Something like "audio/L8;rate=44100" would be valid,
* however (see https://tools.ietf.org/html/rfc4856).
*
* @returns {String[]}
* A list of all mimetypes supported by Guacamole.RawAudioPlayer, excluding
* any parameters. If the necessary JavaScript APIs for playing raw audio
* are absent, this list will be empty.
*/
static getSupportedTypes(): string[];
}
/**
* Abstract audio recorder which streams arbitrary audio data to an underlying
* Guacamole.OutputStream. It is up to implementations of this class to provide
* some means of handling this Guacamole.OutputStream. Data produced by the
* recorder is to be sent along the provided stream immediately.
*/
class AudioRecorder {
/**
* Callback which is invoked when the audio recording process has stopped
* and the underlying Guacamole stream has been closed normally. Audio will
* only resume recording if a new Guacamole.AudioRecorder is started. This
* Guacamole.AudioRecorder instance MAY NOT be reused.
*
* @event
*/
onclose(): void;
/**
* Callback which is invoked when the audio recording process cannot
* continue due to an error, if it has started at all. The underlying
* Guacamole stream is automatically closed. Future attempts to record
* audio should not be made, and this Guacamole.AudioRecorder instance
* MAY NOT be reused.
*
* @event
*/
onerror(): void;
/**
* Determines whether the given mimetype is supported by any built-in
* implementation of Guacamole.AudioRecorder, and thus will be properly handled
* by Guacamole.AudioRecorder.getInstance().
*
* @param {String} mimetype
* The mimetype to check.
*
* @returns {Boolean}
* true if the given mimetype is supported by any built-in
* Guacamole.AudioRecorder, false otherwise.
*/
static isSupportedType(mimetype: string): boolean;
/**
* Returns a list of all mimetypes supported by any built-in
* Guacamole.AudioRecorder, in rough order of priority. Beware that only the
* core mimetypes themselves will be listed. Any mimetype parameters, even
* required ones, will not be included in the list. For example, "audio/L8" is
* a supported raw audio mimetype that is supported, but it is invalid without
* additional parameters. Something like "audio/L8;rate=44100" would be valid,
* however (see https://tools.ietf.org/html/rfc4856).
*
* @returns {String[]}
* A list of all mimetypes supported by any built-in
* Guacamole.AudioRecorder, excluding any parameters.
*/
static getSupportedTypes(): string[];
/**
* Returns an instance of Guacamole.AudioRecorder providing support for the
* given audio format. If support for the given audio format is not available,
* null is returned.
*
* @param {Guacamole.OutputStream} stream
* The Guacamole.OutputStream to send audio data through.
*
* @param {String} mimetype
* The mimetype of the audio data to be sent along the provided stream.
*
* @return {Guacamole.AudioRecorder}
* A Guacamole.AudioRecorder instance supporting the given mimetype and
* writing to the given stream, or null if support for the given mimetype
* is absent.
*/
static getInstance(stream: OutputStream, mimetype: string);
}
/**
* Implementation of Guacamole.AudioRecorder providing support for raw PCM
* format audio. This recorder relies only on the Web Audio API and does not
* require any browser-level support for its audio formats.
*
* @constructor
* @augments Guacamole.AudioRecorder
* @param {Guacamole.OutputStream} stream
* The Guacamole.OutputStream to write audio data to.
*
* @param {String} mimetype
* The mimetype of the audio data to send along the provided stream, which
* must be a "audio/L8" or "audio/L16" mimetype with necessary parameters,
* such as: "audio/L16;rate=44100,channels=2".
*/
class RawAudioRecorder extends AudioRecorder {
/**
* @augments Guacamole.AudioRecorder
* @param {Guacamole.OutputStream} stream
* The Guacamole.OutputStream to write audio data to.
*
* @param {String} mimetype
* The mimetype of the audio data to send along the provided stream, which
* must be a "audio/L8" or "audio/L16" mimetype with necessary parameters,
* such as: "audio/L16;rate=44100,channels=2".
*/
constructor(stream: AudioRecorder, mimetype: string);
/**
* Determines whether the given mimetype is supported by
* Guacamole.RawAudioRecorder.
*
* @param {String} mimetype
* The mimetype to check.
*
* @returns {Boolean}
* true if the given mimetype is supported by Guacamole.RawAudioRecorder,
* false otherwise.
*/
static isSupportedType(mimetype: string): boolean;
/**
* Returns a list of all mimetypes supported by Guacamole.RawAudioRecorder. Only
* the core mimetypes themselves will be listed. Any mimetype parameters, even
* required ones, will not be included in the list. For example, "audio/L8" is
* a raw audio mimetype that may be supported, but it is invalid without
* additional parameters. Something like "audio/L8;rate=44100" would be valid,
* however (see https://tools.ietf.org/html/rfc4856).
*
* @returns {String[]}
* A list of all mimetypes supported by Guacamole.RawAudioRecorder,
* excluding any parameters. If the necessary JavaScript APIs for recording
* raw audio are absent, this list will be empty.
*/
static getSupportedTypes(): string[];
}
/**
* Provides cross-browser and cross-keyboard keyboard for a specific element.
* Browser and keyboard layout variation is abstracted away, providing events
* which represent keys as their corresponding X11 keysym.
*/
class Keyboard {
/**
* @param {Element} element The Element to use to provide keyboard events.
*/
constructor(element: any);
/**
* Fired whenever the user presses a key with the element associated
* with this Guacamole.Keyboard in focus.
*
* @event
* @param {Number} keysym The keysym of the key being pressed.
* @return {Boolean} true if the key event should be allowed through to the
* browser, false otherwise.
*/
onkeydown(keysym: number): boolean;
/**
* Fired whenever the user releases a key with the element associated
* with this Guacamole.Keyboard in focus.
*
* @event
* @param {Number} keysym The keysym of the key being released.
*/
onkeyup(keysym: number): void;
/**
* Marks a key as pressed, firing the keydown event if registered. Key
* repeat for the pressed key will start after a delay if that key is
* not a modifier. The return value of this function depends on the
* return value of the keydown event handler, if any.
*
* @param {Number} keysym The keysym of the key to press.
* @return {Boolean} true if event should NOT be canceled, false otherwise.