pytox.ToxAV Class

PyTox wraps libtoxav API with the object pytox.ToxAV, all the toxav API methods are in this class.

class pytox.ToxAV

ToxAV object

answer(call_index, call_type)

Answer incomming call.

See also

call()

call(friend_id, call_type, seconds)

Call a friend with friend_id, with seconds ringing timeout. Returns the index call_index of the call.

call_type can be one of following value:

control_type description
ToxAV.TypeAudio audio only call
ToxAV.TypeVideo audio and video call
cancel(call_index)

Cancel outgoing request.

capability_supported(capability)

Query if certain capability is supported.

capability can be one of following value:

control_type description
ToxAV.AudioEncoding audio encoding
ToxAV.AudioDecoding audio decoding
ToxAV.VideoEncoding video encoding
ToxAV.VideoEncoding video decoding
change_settings(call_index, csettings)

Notify peer that we are changing call settings. settings is adictionary of new settings like the one returned by get_peer_csettings

get_call_state(call_index)

Get current call state

The state returned can be one of following value:

state
ToxAV.CallNonExistent
ToxAV.CallInviting
ToxAV.CallStarting
ToxAV.CallActive
ToxAV.CallHold
ToxAV.CallHanged_up
get_peer_csettings(call_index, peer_num)

Get peer transmission type. It can either be audio or video. peer_num is always 0 for now.

get_peer_id(call_index, peer_num)

Get friend_number of peer participating in conversation. peer_num is always 0 for now.

get_tox()

Get the Tox object associated with this ToxAV instance.

hangup(call_index)

Hangup active call.

kill_transmission(call_index)

Call this at the end of the transmission.

on_audio_data(call_index, size, data)

Receive decoded audio packet. Default implementation does nothing.

on_cancel(call_index)

on_cancel handler. Default implementation does nothing.

on_end(call_index)

on_end handler. Default implementation does nothing.

on_invite(call_index)

on_invite handler. Default implementation does nothing.

on_peer_cs_change(call_index)

on_peer_cs_change handler. Default implementation does nothing.

on_peer_timeout(call_index)

on_peer_timeout handler. Default implementation does nothing.

on_reject(call_index)

on_reject handler. Default implementation does nothing.

on_request_timeout(call_index)

on_request_timeout handler. Default implementation does nothing.

on_ringing(call_index)

on_ringing handler. Default implementation does nothing.

on_self_cs_change(call_index)

on_self_cs_change handler. Default implementation does nothing.

on_start(call_index)

on_start handler. Default implementation does nothing.

on_video_data(call_index, width, height, data)

Receive decoded video packet. Default implementation does nothing.

prepare_transmission(call_index, support_video)

Must be call before any RTP transmission occurs. support_video is either True or False.

reject(call_index)

Reject incomming call.

send_audio(call_index, frame_size, data)

Encode and send video packet. data should be a str or buffercontaining singal channel 16 bit signed PCM audio data.

send_video(call_index, data)

Encode and send video packet. data should be a str or buffercontaining a image in RGB888 format.

stop_call(call_index)

Terminate transmission. Note that transmission will be terminated without informing remote peer.

Previous topic

pytox.Tox Class