TeamTalk 5 C-API DLL  Version 5.11A
Client Event Handling

This section explains how to handle events generated by the client instance. More...

Classes

struct  TTMessage
 A struct containing the properties of an event. More...
 

Typedefs

typedef enum ClientEvent ClientEvent
 TeamTalk client event messages. More...
 
typedef enum TTType TTType
 
typedef struct TTMessage TTMessage
 A struct containing the properties of an event. More...
 

Enumerations

enum  ClientEvent {
  CLIENTEVENT_NONE = 0 , CLIENTEVENT_CON_SUCCESS = CLIENTEVENT_NONE + 10 , CLIENTEVENT_CON_FAILED = CLIENTEVENT_NONE + 20 , CLIENTEVENT_CON_LOST = CLIENTEVENT_NONE + 30 ,
  CLIENTEVENT_CON_MAX_PAYLOAD_UPDATED = CLIENTEVENT_NONE + 40 , CLIENTEVENT_CMD_PROCESSING = CLIENTEVENT_NONE + 200 , CLIENTEVENT_CMD_ERROR = CLIENTEVENT_NONE + 210 , CLIENTEVENT_CMD_SUCCESS = CLIENTEVENT_NONE + 220 ,
  CLIENTEVENT_CMD_MYSELF_LOGGEDIN = CLIENTEVENT_NONE + 230 , CLIENTEVENT_CMD_MYSELF_LOGGEDOUT = CLIENTEVENT_NONE + 240 , CLIENTEVENT_CMD_MYSELF_KICKED = CLIENTEVENT_NONE + 250 , CLIENTEVENT_CMD_USER_LOGGEDIN = CLIENTEVENT_NONE + 260 ,
  CLIENTEVENT_CMD_USER_LOGGEDOUT = CLIENTEVENT_NONE + 270 , CLIENTEVENT_CMD_USER_UPDATE = CLIENTEVENT_NONE + 280 , CLIENTEVENT_CMD_USER_JOINED = CLIENTEVENT_NONE + 290 , CLIENTEVENT_CMD_USER_LEFT = CLIENTEVENT_NONE + 300 ,
  CLIENTEVENT_CMD_USER_TEXTMSG = CLIENTEVENT_NONE + 310 , CLIENTEVENT_CMD_CHANNEL_NEW = CLIENTEVENT_NONE + 320 , CLIENTEVENT_CMD_CHANNEL_UPDATE = CLIENTEVENT_NONE + 330 , CLIENTEVENT_CMD_CHANNEL_REMOVE = CLIENTEVENT_NONE + 340 ,
  CLIENTEVENT_CMD_SERVER_UPDATE = CLIENTEVENT_NONE + 350 , CLIENTEVENT_CMD_SERVERSTATISTICS = CLIENTEVENT_NONE + 360 , CLIENTEVENT_CMD_FILE_NEW = CLIENTEVENT_NONE + 370 , CLIENTEVENT_CMD_FILE_REMOVE = CLIENTEVENT_NONE + 380 ,
  CLIENTEVENT_CMD_USERACCOUNT = CLIENTEVENT_NONE + 390 , CLIENTEVENT_CMD_BANNEDUSER = CLIENTEVENT_NONE + 400 , CLIENTEVENT_USER_STATECHANGE = CLIENTEVENT_NONE + 500 , CLIENTEVENT_USER_VIDEOCAPTURE = CLIENTEVENT_NONE + 510 ,
  CLIENTEVENT_USER_MEDIAFILE_VIDEO = CLIENTEVENT_NONE + 520 , CLIENTEVENT_USER_DESKTOPWINDOW = CLIENTEVENT_NONE + 530 , CLIENTEVENT_USER_DESKTOPCURSOR = CLIENTEVENT_NONE + 540 , CLIENTEVENT_USER_DESKTOPINPUT = CLIENTEVENT_NONE + 550 ,
  CLIENTEVENT_USER_RECORD_MEDIAFILE = CLIENTEVENT_NONE + 560 , CLIENTEVENT_USER_AUDIOBLOCK = CLIENTEVENT_NONE + 570 , CLIENTEVENT_INTERNAL_ERROR = CLIENTEVENT_NONE + 1000 , CLIENTEVENT_VOICE_ACTIVATION = CLIENTEVENT_NONE + 1010 ,
  CLIENTEVENT_HOTKEY = CLIENTEVENT_NONE + 1020 , CLIENTEVENT_HOTKEY_TEST = CLIENTEVENT_NONE + 1030 , CLIENTEVENT_FILETRANSFER = CLIENTEVENT_NONE + 1040 , CLIENTEVENT_DESKTOPWINDOW_TRANSFER = CLIENTEVENT_NONE + 1050 ,
  CLIENTEVENT_STREAM_MEDIAFILE = CLIENTEVENT_NONE + 1060 , CLIENTEVENT_LOCAL_MEDIAFILE = CLIENTEVENT_NONE + 1070 , CLIENTEVENT_AUDIOINPUT = CLIENTEVENT_NONE + 1080 , CLIENTEVENT_USER_FIRSTVOICESTREAMPACKET = CLIENTEVENT_NONE + 1090
}
 TeamTalk client event messages. More...
 
enum  TTType {
  __NONE = 0 , __AUDIOCODEC = 1 , __BANNEDUSER = 2 , __VIDEOFORMAT = 3 ,
  __OPUSCODEC = 4 , __CHANNEL = 5 , __CLIENTSTATISTICS = 6 , __REMOTEFILE = 7 ,
  __FILETRANSFER = 8 , __MEDIAFILESTATUS = 9 , __SERVERPROPERTIES = 10 , __SERVERSTATISTICS = 11 ,
  __SOUNDDEVICE = 12 , __SPEEXCODEC = 13 , __TEXTMESSAGE = 14 , __WEBMVP8CODEC = 15 ,
  __TTMESSAGE = 16 , __USER = 17 , __USERACCOUNT = 18 , __USERSTATISTICS = 19 ,
  __VIDEOCAPTUREDEVICE = 20 , __VIDEOCODEC = 21 , __AUDIOCONFIG = 22 , __SPEEXVBRCODEC = 23 ,
  __VIDEOFRAME = 24 , __AUDIOBLOCK = 25 , __AUDIOFORMAT = 26 , __MEDIAFILEINFO = 27 ,
  __CLIENTERRORMSG = 28 , __TTBOOL = 29 , __INT32 = 30 , __DESKTOPINPUT = 31 ,
  __SPEEXDSP = 32 , __STREAMTYPE = 33 , __AUDIOPREPROCESSORTYPE = 34 , __AUDIOPREPROCESSOR = 35 ,
  __TTAUDIOPREPROCESSOR = 36 , __MEDIAFILEPLAYBACK = 37 , __CLIENTKEEPALIVE = 38 , __UINT32 = 39 ,
  __AUDIOINPUTPROGRESS = 40 , __JITTERCONFIG = 41 , __WEBRTCAUDIOPREPROCESSOR = 42 , __ENCRYPTIONCONTEXT = 43
}
 

Detailed Description

This section explains how to handle events generated by the client instance.

When events occur in the client instance, like e.g. if a new user joins a channel, the client instance queues a TTMessage which the user application must retrieve using TT_GetMessage(). The message queue for events is limited to 1 MB. If the queue grows above the maximum size then event handling is suspended and will not be resumed until the queue size is again below the maximum size. The event INTERR_TTMESSAGE_QUEUE_OVERFLOW will be posted to the message queue if an overflow has taken place.

If TT_InitTeamTalk is used with a HWND then the events are sent to the user application with WinAPI's PostMessage(...) function and is retrieved through GetMessage(...).

Note that when an event occurs the TeamTalk client instance doesn't wait for the user application to process the event. So if e.g. a user sends a text-message and immediately after disconnects from the server, then the User, who sent the message, cannot be retrieved using TT_GetUser() since the user is no longer available when the user application starts processing the new text-message event. This is, of course, annoying when designing the user application, but the reason for this design choice it that the client instance is a realtime component which cannot wait for the UI to process data, since audio playback and recording would then be halted.

The section Client Programming Guide gives a good idea of how events are processed in a user application.

Typedef Documentation

◆ ClientEvent

typedef enum ClientEvent ClientEvent

TeamTalk client event messages.

Events are retrieved using TT_GetMessage().

◆ TTType

typedef enum TTType TTType

◆ TTMessage

typedef struct TTMessage TTMessage

A struct containing the properties of an event.

The event can be retrieved by called TT_GetMessage. This struct is only required on non-Windows systems.

Section Client Event Handling explains event handling in the local client instance.

See also
TT_GetMessage

Enumeration Type Documentation

◆ ClientEvent

TeamTalk client event messages.

Events are retrieved using TT_GetMessage().

Enumerator
CLIENTEVENT_NONE 
CLIENTEVENT_CON_SUCCESS 

Connected successfully to the server.

This event is posted if TT_Connect() was successful.

TT_DoLogin can now be called in order to logon to the server.

Attribute values in TTMessage:

CLIENTEVENT_CON_FAILED 

Failed to connect to server.

This event is posted if TT_Connect fails. Ensure to call TT_Disconnect before calling TT_Connect again.

Attribute values in TTMessage:

CLIENTEVENT_CON_LOST 

Connection to server has been lost.

The server is not responding to requests from the local client instance and the connection has been dropped.

TT_GetClientStatistics can be used to check when data was last received from the server.

Ensure to call TT_Disconnect before calling TT_Connect again.

Attribute values in TTMessage:

CLIENTEVENT_CON_MAX_PAYLOAD_UPDATED 

The maximum size of the payload put into UDP packets has been updated.

Attribute values in TTMessage:

CLIENTEVENT_CMD_PROCESSING 

A command issued by TT_Do* methods is being processed.

Read section Client/Server Command Processing on how to use command processing in the user application.

Attribute values in TTMessage:

CLIENTEVENT_CMD_ERROR 

The server rejected a command issued by the local client instance.

To figure out which command failed use the command ID returned by the TT_Do* command. Section Client/Server Command Processing explains how to use command ID.

Attribute values in TTMessage:

CLIENTEVENT_CMD_SUCCESS 

The server successfully processed a command issued by the local client instance.

To figure out which command succeeded use the command ID returned by the TT_Do* command. Section Client/Server Command Processing explains how to use command ID.

Attribute values in TTMessage:

CLIENTEVENT_CMD_MYSELF_LOGGEDIN 

The client instance successfully logged on to server.

The call to TT_DoLogin was successful and all channels on the server will be posted in the event CLIENTEVENT_CMD_CHANNEL_NEW immediately following this event. If USERRIGHT_VIEW_ALL_USERS is enabled the client instance will also receive the events CLIENTEVENT_CMD_USER_LOGGEDIN and CLIENTEVENT_CMD_USER_JOINED for every user on the server.

Attribute values in TTMessage:

CLIENTEVENT_CMD_MYSELF_LOGGEDOUT 

The client instance logged out of the server.

A response to TT_DoLogout.

Attribute values in TTMessage:

CLIENTEVENT_CMD_MYSELF_KICKED 

The client instance was kicked from a channel.

Attribute values in TTMessage:

CLIENTEVENT_CMD_USER_LOGGEDIN 

A new user logged on to the server.

Attribute values in TTMessage:

See also
TT_DoLogin
TT_GetUser To retrieve user.
CLIENTEVENT_CMD_USER_LOGGEDOUT
CLIENTEVENT_CMD_USER_LOGGEDOUT 

A client logged out of the server.

This event is called when a user logs out with TT_DoLogout or disconnects with TT_Disconnect.

Attribute values in TTMessage:

See also
TT_DoLogout
TT_Disconnect
CLIENTEVENT_CMD_USER_LOGGEDIN
CLIENTEVENT_CMD_USER_UPDATE 

User changed properties.

Attribute values in TTMessage:

See also
TT_GetUser To retrieve user.
CLIENTEVENT_CMD_USER_JOINED 

A user has joined a channel.

Attribute values in TTMessage:

See also
TT_GetUser To retrieve user.
CLIENTEVENT_CMD_USER_LEFT 

User has left a channel.

Attribute values in TTMessage:

CLIENTEVENT_CMD_USER_TEXTMSG 

A user has sent a text-message.

Attribute values in TTMessage:

See also
TT_GetUser To retrieve user.
TT_DoTextMessage() to send text message.
CLIENTEVENT_CMD_CHANNEL_NEW 

A new channel has been created.

Attribute values in TTMessage:

See also
TT_GetChannel To retrieve channel.
CLIENTEVENT_CMD_CHANNEL_UPDATE 

A channel's properties has been updated.

Attribute values in TTMessage:

See also
TT_GetChannel To retrieve channel.
CLIENTEVENT_CMD_CHANNEL_REMOVE 

A channel has been removed.

Note that calling the TT_GetChannel with the channel ID will fail because the channel is no longer there.

Attribute values in TTMessage:

CLIENTEVENT_CMD_SERVER_UPDATE 

Server has updated its settings (server name, MOTD, etc.)

Get new settings in serverproperties of TTMessage.

Attribute values in TTMessage:

CLIENTEVENT_CMD_SERVERSTATISTICS 

Server statistics available.

This is a response to TT_DoServerStatistics()

Attribute values in TTMessage:

CLIENTEVENT_CMD_FILE_NEW 

A new file is added to a channel.

Use TT_GetChannelFile() to get information about the file.

Attribute values in TTMessage:

See also
TT_GetChannelFile To retrieve file.
CLIENTEVENT_CMD_FILE_REMOVE 

A file has been removed from a channel.

Attribute values in TTMessage:

CLIENTEVENT_CMD_USERACCOUNT 

A user account has been received from the server.

This message is posted as a result of TT_DoListUserAccounts()

Attribute values in TTMessage:

CLIENTEVENT_CMD_BANNEDUSER 

A banned user has been received from the server.

This message is posted as a result of TT_DoListBans()

Attribute values in TTMessage:

CLIENTEVENT_USER_STATECHANGE 

A user state has changed.

The uUserState has changed for a user due to playback of an incoming stream.

The user state changes if:

Attribute values in TTMessage:

See also
TT_SetUserStoppedTalkingDelay
CLIENTEVENT_USER_VIDEOCAPTURE 

A new video frame from a video capture device was received from a user.

Use TT_AcquireUserVideoCaptureFrame to display the video frame.

Attribute values in TTMessage:

CLIENTEVENT_USER_MEDIAFILE_VIDEO 

A new video frame from a video media file was received from a user.

Use TT_AcquireUserMediaVideoFrame() to display the video frame.

Attribute values in TTMessage:

CLIENTEVENT_USER_DESKTOPWINDOW 

A new or updated desktop window has been received from a user.

Use TT_AcquireUserDesktopWindow() to retrieve the bitmap of the desktop window.

Attribute values in TTMessage:

CLIENTEVENT_USER_DESKTOPCURSOR 

A user has sent the position of the mouse cursor.

Use TT_SendDesktopCursorPosition() to send the position of the mouse cursor.

Attribute values in TTMessage:

CLIENTEVENT_USER_DESKTOPINPUT 

Desktop input (mouse or keyboard input) has been received from a user.

Desktop input is used in combination with a shared desktop window, see Desktop Sharing.

This event is generated if a remote user has called TT_SendDesktopInput(). In order for the local client instance to receive desktop input it must have enabled the subscription SUBSCRIBE_DESKTOPINPUT.

Due to different keyboard layout it might be a good idea to look into the key-translation function TT_DesktopInput_KeyTranslate().

See Receive Desktop Input for more information on receiving desktop input.

Attribute values in TTMessage:

CLIENTEVENT_USER_RECORD_MEDIAFILE 

A media file recording has changed status.

TT_SetUserMediaStorageDir makes the client instance store all audio from a user to a specified folder. Every time an audio file is being processed this event is posted.

Attribute values in TTMessage:

CLIENTEVENT_USER_AUDIOBLOCK 

A new audio block can be extracted.

The AudioBlock can either be of STREAMTYPE_VOICE, STREAMTYPE_LOCALMEDIAPLAYBACK_AUDIO or STREAMTYPE_MEDIAFILE_AUDIO.

This event is only generated if TT_EnableAudioBlockEvent() is first called.

Call TT_AcquireUserAudioBlock() to extract the AudioBlock.

Attribute values in TTMessage:

CLIENTEVENT_INTERNAL_ERROR 

An internal error occurred in the client instance.

This can e.g. happen if a new user joins a channel and a sound output device fails to start a new audio stream.

For at list of internal error messages check out ClientError with errors prefixed INTERR_*

Attribute values in TTMessage:

CLIENTEVENT_VOICE_ACTIVATION 

Voice activation has triggered transmission.

Attribute values in TTMessage:

See also
TT_GetSoundInputLevel()
TT_SetVoiceActivationLevel()
CLIENT_SNDINPUT_VOICEACTIVATION
TT_EnableTransmission
CLIENTEVENT_HOTKEY 

A hotkey has been acticated or deactivated.

Attribute values in TTMessage:

See also
TT_HotKey_Register
TT_HotKey_Unregister
CLIENTEVENT_HOTKEY_TEST 

A button was pressed or released on the user's keyboard or mouse.

When TT_HotKey_InstallTestHook is called a hook is installed in Windows which intercepts all keyboard and mouse presses. Every time a key or mouse is pressed or released this event is posted.

Use TT_HotKey_GetKeyString to get a key description of the pressed key.

Attribute values in TTMessage:

CLIENTEVENT_FILETRANSFER 

A file transfer is processing.

Use TT_GetFileTransferInfo to get information about the file transfer. Ensure to check if the file transfer is completed, because the file transfer instance will be removed from the client instance when the user application reads the FileTransfer object and it has completed the transfer.

Attribute values in TTMessage:

See also
TT_GetFileTransferInfo To retrieve FileTransfer.
CLIENTEVENT_DESKTOPWINDOW_TRANSFER 

Used for tracking when a desktop window has been transmitted to the server.

When the transmission has completed the flag CLIENT_TX_DESKTOP will be cleared from the local client instance.

Attribute values in TTMessage:

CLIENTEVENT_STREAM_MEDIAFILE 

Media file being streamed to a channel is processing.

This event is called as a result of TT_StartStreamingMediaFileToChannel() to monitor progress of streaming.

Attribute values in TTMessage:

CLIENTEVENT_LOCAL_MEDIAFILE 

Media file played locally is processing.

This event is called as a result of TT_InitLocalPlayback() to monitor progress of playback.

Attribute values in TTMessage:

CLIENTEVENT_AUDIOINPUT 

Progress is audio being injected as STREAMTYPE_VOICE.

nStreamID of AudioInputProgress is the stream ID provided in the AudioBlock when calling TT_InsertAudioBlock().

When uElapsedMSec and uQueueMSec of AudioInputProgress are zero then the stream ID (session) has ended. An audio input session has ended when an empty AudioBlock has been inserted using TT_InsertAudioBlock().

Attribute values in TTMessage:

CLIENTEVENT_USER_FIRSTVOICESTREAMPACKET 

The first voice packet of a new voice stream has been received.

This time of this event may differ significantly from the start of the voice playout that is notified via CLIENTEVENT_USER_STATECHANGE due to jitter buffering.

The time between CLIENTEVENT_USER_FIRSTVOICESTREAMPACKET and CLIENTEVENT_USER_STATECHANGE is the fixed jitter delay configuration plus the currently active adaptive jitter buffering in the nActiveAdaptiveDelayMSec member of the User struct

Attribute values in TTMessage:

See also
TT_SetUserJitterControl

Definition at line 3145 of file TeamTalk.h.

◆ TTType

enum TTType
Enumerator
__NONE 
__AUDIOCODEC 
__BANNEDUSER 
__VIDEOFORMAT 
__OPUSCODEC 
__CHANNEL 
__CLIENTSTATISTICS 
__REMOTEFILE 
__FILETRANSFER 
__MEDIAFILESTATUS 
__SERVERPROPERTIES 
__SERVERSTATISTICS 
__SOUNDDEVICE 
__SPEEXCODEC 
__TEXTMESSAGE 
__WEBMVP8CODEC 
__TTMESSAGE 
__USER 
__USERACCOUNT 
__USERSTATISTICS 
__VIDEOCAPTUREDEVICE 
__VIDEOCODEC 
__AUDIOCONFIG 
__SPEEXVBRCODEC 
__VIDEOFRAME 
__AUDIOBLOCK 
__AUDIOFORMAT 
__MEDIAFILEINFO 
__CLIENTERRORMSG 
__TTBOOL 
__INT32 
__DESKTOPINPUT 
__SPEEXDSP 
__STREAMTYPE 
__AUDIOPREPROCESSORTYPE 
__AUDIOPREPROCESSOR 
__TTAUDIOPREPROCESSOR 
__MEDIAFILEPLAYBACK 
__CLIENTKEEPALIVE 
__UINT32 
__AUDIOINPUTPROGRESS 
__JITTERCONFIG 
__WEBRTCAUDIOPREPROCESSOR 
__ENCRYPTIONCONTEXT 

Definition at line 3748 of file TeamTalk.h.