This page explains the programmability of the Gong applets
which gives flexibility to the use of Gong.
Most people do not need to understand this when they
want to use Gong.
The information is primarily for programmers
who want to use the Gong programmability but it is also
useful if you are interested to know how it works.
The programmability of the Gong applets is provided by
a Gong applet scripting interface, which facilitate
communications between the Gong/NanoGong
applet and the HTML page containing the applet. The interface
can be controlled by any Web client scripting language such as
JavaScript and VBScript.
Various examples using the Gong Scripting API are available
in the
Gong real-time control page
and the
NanoGong page.
All the examples in these pages use JavaScript as the
scripting language
although it can be easily changed to VBScript.
The functions provided in the interface are listed below:
String sendGongRequest(String xmlString)
Make a request to the Gong/NanoGong applet using an XML string
containing the request name and parameters.
String sendGongRequest(String name, String param)
Make a named request to the Gong/NanoGong applet with one parameter.
Make a named request to the Gong/NanoGong applet with four parameters.
Currently there are 23 types of request which
can be sent to a Gong/NanoGong applet. Each of the requests has its own
parameter set. These parameters can be sent to the Gong applet
as part of the XML string or in the parameter arguments when sent
as a named request.
The list of requests is shown below with their description and
availability in the Gong and NanoGong applets.
The following tables describe the specification of the requests
when using the functions.
Request Name
Specification
PlayMedia
Using Named Request Form
Parameter 1
Media type (always 'audio' for the current version)
Parameter 2
Start time in milliseconds (optional)
Parameter 3
End time in milliseconds (optional)
Parameter 4
-
Return Value
Start time in milliseconds;End time in milliseconds
Using XML Form
XML Input
audio[Start time in milliseconds][End time in milliseconds]
XML Output
Start time in millisecondsEnd time in milliseconds
RecordMedia
Using Named Request Form
Parameter 1
Media type (always 'audio' for the current version)
Parameter 2
Permitted duration in milliseconds (optional)
Parameter 3
-
Parameter 4
-
Return Value
Permitted duration in milliseconds
Using XML Form
XML Input
audio[Permitted duration in milliseconds]
XML Output
Permitted duration in milliseconds
PauseMedia
Using Named Request Form
Parameter 1
Media type (always 'audio' for the current version)
Parameter 2
-
Parameter 3
-
Parameter 4
-
Return Value
The current media time in milliseconds
Using XML Form
XML Input
audio
XML Output
StopMedia
Using Named Request Form
Parameter 1
Media type (always 'audio' for the current version)
Parameter 2
-
Parameter 3
-
Parameter 4
-
Return Value
The media duration in milliseconds
Using XML Form
XML Input
audio
XML Output
The media duration in milliseconds
SetMediaTime
Using Named Request Form
Parameter 1
Media type (always 'audio' for the current version)
Parameter 2
The media time in milliseconds
Parameter 3
-
Parameter 4
-
Return Value
-
Using XML Form
XML Input
audio
XML Output
GetMediaTime
Using Named Request Form
Parameter 1
Media type (always 'audio' for the current version)
Parameter 2
-
Parameter 3
-
Parameter 4
-
Return Value
The media time in milliseconds
Using XML Form
XML Input
audio
XML Output
SetMediaRate
Using Named Request Form
Parameter 1
Media type (always 'audio' for the current version)
Parameter 2
The media rate between 0.5 to 1.5 with normal rate at 1.0
Parameter 3
-
Parameter 4
-
Return Value
-
Using XML Form
XML Input
audioThe media rate between 0.5 to 1.5 with normal rate
at 1.0
XML Output
GetMediaRate
Using Named Request Form
Parameter 1
Media type (always 'audio' for the current version)
Parameter 2
-
Parameter 3
-
Parameter 4
-
Return Value
The media rate between 0.5 to 1.5 with normal rate at 1.0
Using XML Form
XML Input
audio
XML Output
The media rate between 0.5 to 1.5 with normal rate
at 1.0
GetMediaStatus
Using Named Request Form
Parameter 1
Media type (always 'audio' for the current version)
Parameter 2
-
Parameter 3
-
Parameter 4
-
Return Value
The media status in one of these values:
playing, recording, paused, stopping, stopped, closing and closed
Using XML Form
XML Input
audio
XML Output
The media status in one of these values:
playing, recording, paused, stopping, stopped,
closing and closed
GetAudioLevel
Using Named Request Form
Parameter 1
Empty string
Parameter 2
-
Parameter 3
-
Parameter 4
-
Return Value
The audio level in the range of 0 to 1
Using XML Form
XML Input
XML Output
The audio level in the range of 0 to 1
MoveToPrevMessage
Using Named Request Form
Parameter 1
Empty string
Parameter 2
-
Parameter 3
-
Parameter 4
-
Return Value
The message id of the message after moving
Using XML Form
XML Input
XML Output
The message id of the message after moving
MoveToNextMessage
Using Named Request Form
Parameter 1
Empty string
Parameter 2
-
Parameter 3
-
Parameter 4
-
Return Value
The message id of the message after moving
Using XML Form
XML Input
XML Output
The message id of the message after moving
SelectMessage
Using Named Request Form
Parameter 1
The message id of the message to be selected
Parameter 2
-
Parameter 3
-
Parameter 4
-
Return Value
-
Using XML Form
XML Input
The message id of the message to be
selected
XML Output
GetCurrentMessageId
Using Named Request Form
Parameter 1
Empty string
Parameter 2
-
Parameter 3
-
Parameter 4
-
Return Value
The message id of the current message
Using XML Form
XML Input
XML Output
The message id of the current message
SearchMessage
Using Named Request Form
Parameter 1
The search text
Parameter 2
The search options with the following field in a single line semi-colon delimited string:
Case-sensitive search, can be true or false;
Search for whole words only, can be true or false;
Use regular expression, can be true or false;
Search author, can be true or false;
Search subject, can be true or false;
Search content, can be true or false
Parameter 3
-
Parameter 4
-
Return Value
The message in XML representation
Using XML Form
XML Input
The search textCase-sensitive search,
can be true or falseSearch for whole words only,
can be true or falseUse regular expression,
can be true or falseSearch author,
can be true or falseSearch subject,
can be true or falseSearch text content,
can be true or false
XML Output
The message id of the message
GetMessage
Using Named Request Form
Parameter 1
The message id of the message
Parameter 2
-
Parameter 3
-
Parameter 4
-
Return Value
The message in XML representation
Using XML Form
XML Input
The message id of the message
XML Output
The message in XML representation
GetMessageContent
Using Named Request Form
Parameter 1
The message id of the message
Parameter 2
The content type of the message: text/plain or text/html
Parameter 3
-
Parameter 4
-
Return Value
The message content in the requested type
Using XML Form
XML Input
The message id of the messageThe content type of the message:
text/plain or text/html
XML Output
The message content in requested type
PostMessage
Using Named Request Form
Parameter 1
The message id of the parent message (0 if there is no parent message)
Parameter 2
The author name (required only if the user is a guest)
Parameter 3
The subject of the message
Parameter 4
The content of the message
Return Value
The message id of newly created message
Using XML Form
XML Input
The message id of the parent message
(0 if there is no parent message)[The author name]The subject of the messageThe content of the message
XML Output
The message id of newly created message
SaveMessage
Using Named Request Form
Parameter 1
The file type: wav/adpcm or flv/pcm
Parameter 2
The filename
Parameter 3
The path of the saved file
Parameter 4
-
Return Value
The full path of the saved voice file
Using XML Form
XML Input
The file type: wav/adpcm or flv/pcmThe filenameThe path of the saved file