From 74ea5fd1fb03f2e5b4ada6fb407efb22b6b1ebb1 Mon Sep 17 00:00:00 2001 From: kuogi Date: Thu, 1 Aug 2024 15:57:27 +0000 Subject: [PATCH] Update index files --- map.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/map.json b/map.json index 409869a..57af15e 100644 --- a/map.json +++ b/map.json @@ -1 +1 @@ -{"/NTgCalls/Advanced Methods/Get State.xml": "\n

Get State

\n \n

Example

\n \n from ntgcalls import NTgCalls\n ...\n\n app = NTgCalls()\n ...\n\n state = app.get_state(\n -1001185324811,\n )\n \n \n

Details

\n \n get_state() -> ntgcalls.MediaState\n \n \n \n
\n \n PARAMETERS\n \n \n \n \n
\n \n RAISES\n \n \n \n \n
\n
","/NTgCalls/Advanced Methods/ntg_calls.xml": "\n

ntg_calls

\n \n This function returns a list of ntg_call_struct instances,\n each containing information about an active group call associated with the channel or group.\n You should provide a buffer as an array of ntg_call_struct\n elements with a size matching the value returned by ntg_calls_count.\n The function populates this list with data for active group calls and returns the number of group calls retrieved.\n \n

Example

\n \n #include <stdint.h>\n #include \"ntgcalls.h\"\n\n int main() {\n uint32_t uid = ntg_init();\n ...\n int size = ... ; // Get the size of the call list\n ntg_call_struct buffer[size];\n ntg_async_struct future;\n // Initialize the async struct\n int result = ntg_calls(uid, buffer, size, &future);\n // Wait for the async operation to complete\n for (int i = 0; i < result; i++) {\n printf(\"Group Call %d:\\n\", i + 1);\n printf(\" Chat ID: %lld\\n\", buffer[i].chatId);\n printf(\" Status: %d\\n\", buffer[i].status);\n }\n ... // Your Code Here\n return 0;\n }\n \n \n

Details

\n \n int ntg_calls()\n \n \n \n
\n \n PARAMETERS\n \n \n\n ntg_call_struct* buffer\n The buffer that will hold the retrieved group call information.\n\n \n \n \n \n
\n \n ERROR CODES\n \n \n \n
\n ASYNC ERROR CODES\n \n \n \n \n
\n
\n
","/NTgCalls/Advanced Methods/ntg_calls_count.xml": "\n

ntg_calls_count

\n \n This function returns the number of active group calls that NTgCalls is connected to.\n \n

Example

\n \n #include <stdint.h>\n #include \"ntgcalls.h\"\n\n int main() {\n uint32_t uid = ntg_init();\n ...\n int64_t chatID = ...; // Obtain the chat ID\n int count = 0;\n ntg_async_struct future;\n // Initialize the async struct\n int result = ntg_calls_count(uid, &count, &future);\n // Wait for the async operation to complete\n printf(\"Number of active group calls: %d\\n\", count);\n ... // Your Code Here\n return 0;\n }\n \n \n

Details

\n \n int ntg_calls_count()\n \n \n Returns the number of active group calls.\n
\n \n PARAMETERS\n \n \n int* count\n The number of active group calls.\n \n \n \n
\n \n ERROR CODES\n \n \n \n
\n ASYNC ERROR CODES\n \n \n \n
\n
\n
","/NTgCalls/Advanced Methods/ntg_cpu_usage.xml": "\n

ntg_cpu_usage

\n \n

Example

\n \n #include <stdint.h>\n #include \"ntgcalls.h\"\n\n int main() {\n uint32_t uid = ntg_init();\n ...\n double buffer;\n ntg_async_struct future;\n // Initialize the async struct\n int64_t usage = ntg_cpu_usage(uid, &buffer, &future);\n // Wait for the async operation to complete and use\n return 0;\n }\n \n \n

Details

\n \n int ntg_cpu_usage()\n \n \n \n
\n \n PARAMETERS\n \n \n double* cpuUsage\n \n \n \n \n
\n
","/NTgCalls/Advanced Methods/ntg_get_protocol.xml": "\n

ntg_get_protocol

\n \n

Example

\n \n #include <stdint.h>\n #include \"ntgcalls.h\"\n\n int main() {\n uint32_t uid = ntg_init();\n ...\n int64_t chatID = ...; // Obtain the chat ID\n ntg_protocol_struct buffer;\n int result = ntg_get_protocol(uid, chatID, &buffer);\n ...\n return 0;\n }\n \n \n

Details

\n \n int ntg_get_protocol()\n \n \n \n
\n \n PARAMETERS\n \n \n \n\n ntg_protocol_struct* protocol\n \n \n \n
\n \n ERROR CODES\n \n \n \n \n
\n
","/NTgCalls/Advanced Methods/ntg_get_state.xml": "\n

ntg_get_state

\n \n

Example

\n \n #include <stdint.h>\n #include \"ntgcalls.h\"\n\n int main() {\n uint32_t uid = ntg_init();\n ...\n int64_t chatID = ...; // Obtain the chat ID\n ntg_media_state_struct buffer;\n ntg_async_struct future;\n // Initialize the async struct\n int result = ntg_get_state(uid, chatID, &buffer, &future);\n // Wait for the async operation to complete and use\n // the buffer for EditGroupCallParticipant\n ...\n return 0;\n }\n \n \n

Details

\n \n int ntg_get_state()\n \n \n \n
\n \n PARAMETERS\n \n \n \n\n ntg_media_state_struct* mediaState\n \n\n \n \n \n
\n \n ERROR CODES\n \n \n \n
\n ASYNC ERROR CODES\n \n \n \n
\n
\n
","/NTgCalls/Advanced Methods/ntg_send_signaling_data.xml": "\n

ntg_send_signaling_data

\n \n

Example

\n \n #include <stdint.h>\n #include \"ntgcalls.h\"\n\n int main() {\n uint32_t uid = ntg_init();\n ...\n int64_t chatID = ...; // Obtain the chat ID\n uint8_t* buffer = ...; // Obtain the signaling data\n int size = ...; // Obtain the size of the signaling data\n ntg_async_struct future;\n // Initialize the async struct\n int result = ntg_send_signaling_data(uid, chatID, buffer, size, &future);\n // Wait for the async operation to complete\n return 0;\n }\n \n \n

Details

\n \n int ntg_send_signaling_data()\n \n \n \n
\n \n PARAMETERS\n \n \n \n\n uint8_t* data\n \n int size\n Size of the data\n \n \n \n
\n \n ERROR CODES\n \n \n \n
\n ASYNC ERROR CODES\n \n \n \n
\n
\n
","/NTgCalls/Available Enums/ConnectionState.xml": "\n

ConnectionState

\n
\n \n class ConnectionState\n \n \n \n
\n ENUMERATION MEMBERS\n \n CONNECTING = 1\n \n CONNECTED = 2\n \n TIMEOUT = 4\n \n FAILED = 8\n \n CLOSED = 12\n \n \n
\n
","/NTgCalls/Available Enums/InputMode.xml": "\n

InputMode

\n
\n \n class ntgcalls.InputMode\n \n \n \n
\n ENUMERATION MEMBERS\n \n FILE = 1\n \n\n SHELL = 2\n \n\n FFMPEG = 4\n \n\n NO_LATENCY = 8\n \n \n
\n
","/NTgCalls/Available Enums/StreamStatus.xml": "\n

StreamStatus

\n
\n \n class ntgcalls.StreamStatus\n \n \n \n
\n ENUMERATION MEMBERS\n \n PLAYING = 0\n \n\n PAUSED = 1\n \n\n IDLING = 2\n \n \n
\n
","/NTgCalls/Available Enums/StreamType.xml": "\n

StreamType

\n
\n \n class ntgcalls.StreamType\n \n \n \n
\n ENUMERATION MEMBERS\n \n AUDIO = 0\n \n\n VIDEO = 1\n \n \n
\n
","/NTgCalls/Available Enums/ntg_connection_state_enum.xml": "\n

ntg_connection_state_enum

\n
\n \n typedef enum ntg_connection_state_enum\n \n \n \n
\n ENUMERATION MEMBERS\n \n NTG_STATE_CONNECTING = 1\n \n\n NTG_STATE_CONNECTED = 2\n \n\n NTG_STATE_TIMEOUT = 4\n \n\n NTG_STATE_FAILED = 8\n \n\n NTG_STATE_CLOSED = 12\n \n \n
\n
","/NTgCalls/Available Enums/ntg_input_mode_enum.xml": "\n

ntg_input_mode_enum

\n
\n \n typedef enum ntg_input_mode_enum\n \n \n \n
\n ENUMERATION MEMBERS\n \n NTG_FILE = 0\n \n\n NTG_SHELL = 1\n \n\n NTG_FFMPEG = 2\n \n\n NTG_NO_LATENCY = 3\n \n \n
\n
","/NTgCalls/Available Enums/ntg_log_level_enum.xml": "\n

ntg_log_level_enum

\n
\n \n typedef enum ntg_log_level_enum\n \n \n \n
\n ENUMERATION MEMBERS\n \n NTG_LOG_DEBUG = 1\n \n\n NTG_LOG_INFO = 2\n \n\n NTG_LOG_WARNING = 4\n \n\n NTG_LOG_ERROR = 8\n \n\n NTG_LOG_UNKNOWN = -1\n \n \n
\n
","/NTgCalls/Available Enums/ntg_log_source_enum.xml": "\n

ntg_log_source_enum

\n
\n \n typedef enum ntg_log_source_enum\n \n \n \n
\n ENUMERATION MEMBERS\n \n NTG_LOG_WEBRTC = 1\n \n\n NTG_LOG_SELF = 2\n \n \n
\n
","/NTgCalls/Available Enums/ntg_stream_status_enum.xml": "\n

ntg_stream_status_enum

\n
\n \n typedef enum ntg_stream_status_enum\n \n \n \n
\n ENUMERATION MEMBERS\n \n NTG_PLAYING = 1\n \n\n NTG_PAUSED = 2\n \n\n NTG_IDLING = 4\n \n \n
\n
","/NTgCalls/Available Enums/ntg_stream_type_enum.xml": "\n

ntg_stream_type_enum

\n
\n \n typedef enum ntg_stream_type_enum\n \n \n \n
\n ENUMERATION MEMBERS\n \n NTG_STREAM_AUDIO = 0\n \n\n NTG_STREAM_VIDEO = 1\n \n \n
\n
","/NTgCalls/Available Structs/ntg_audio_description_struct.xml": "\n

ntg_audio_description_struct

\n
\n \n typedef struct ntg_audio_description_struct\n \n \n \n
\n PARAMETERS\n \n \n \n\n uint32_t sampleRate\n \n\n uint8_t bitsPerSample\n \n\n uint8_t channelCount\n \n \n
\n
","/NTgCalls/Available Structs/ntg_auth_params_struct.xml": "\n

ntg_auth_params_struct

\n
\n \n typedef struct ntg_auth_params_struct\n \n \n \n
\n PROPERTIES\n \n uint8_t* g_a_or_b\n \n int sizeGAB\n Size of the parameter for key exchange\n int64_t key_fingerprint\n \n \n
\n
","/NTgCalls/Available Structs/ntg_call_struct.xml": "\n

ntg_call_struct

\n
\n \n typedef struct ntg_call_struct\n \n \n \n
\n PROPERTIES\n \n int64_t chatID\n \n\n ntg_stream_status_enum status\n \n \n
\n
","/NTgCalls/Available Structs/ntg_dh_config_struct.xml": "\n

ntg_dh_config_struct

\n
\n \n typedef struct ntg_dh_config_struct\n \n \n \n
\n PROPERTIES\n \n int32_t g\n \n uint8_t* p\n \n int sizeP\n Size of the parameter for key exchange\n uint8_t* random\n \n int sizeRandom\n Size of the random number\n \n
\n
","/NTgCalls/Available Structs/ntg_log_message_struct.xml": "\n

ntg_log_message_struct

\n
\n \n typedef struct ntg_log_message_struct\n \n \n \n
\n PROPERTIES\n \n ntg_log_level_enum level\n \n ntg_log_source_enum source\n \n char* file\n \n uint32_t line\n \n char* message\n \n \n
\n
","/NTgCalls/Available Structs/ntg_media_description_struct.xml": "\n

ntg_media_description_struct

\n
\n \n typedef struct ntg_media_description_struct\n \n \n \n
\n PARAMETERS\n \n ntg_audio_description_struct* audio\n \n\n ntg_video_description_struct* video\n \n \n
\n
","/NTgCalls/Available Structs/ntg_media_state_struct.xml": "\n

ntg_media_state_struct

\n
\n \n typedef struct ntg_media_state_struct\n \n \n \n
\n PROPERTIES\n \n bool muted\n \n\n bool videoPaused\n \n\n bool videoStopped\n \n \n
\n
","/NTgCalls/Available Structs/ntg_protocol_struct.xml": "\n

ntg_protocol_struct

\n
\n \n typedef struct ntg_protocol_struct\n \n \n \n
\n PROPERTIES\n int32_t minLayer\n \n int32_t maxLayer\n \n bool udpP2P\n \n bool udpReflector\n \n char** libraryVersions\n \n int libraryVersionsSize\n Size of the libraryVersions array.\n
\n
","/NTgCalls/Available Structs/ntg_rtc_server_struct.xml": "\n

ntg_rtc_server_struct

\n
\n \n typedef struct ntg_rtc_server_struct\n \n \n \n
\n PROPERTIES\n \n uint64_t id\n \n char* ipv4\n \n char* ipv6\n \n char* username\n \n char* password\n \n int port\n \n bool turn\n \n bool stun\n \n bool tcp\n \n uint8_t* peerTag\n \n int sizePeerTag\n Size of the peer tag\n \n
\n
","/NTgCalls/Available Structs/ntg_video_description_struct.xml": "\n

ntg_video_description_struct

\n
\n \n typedef struct ntg_video_description_struct\n \n \n \n
\n PARAMETERS\n \n \n \n\n uint16_t width\n \n\n uint16_t height\n \n\n uint8_t fps\n \n \n
\n
","/NTgCalls/Available Types/AudioDescription.xml": "\n

AudioDescription

\n
\n \n class ntgcalls.types.AudioDescription\n \n \n \n
\n PARAMETERS\n \n \n\n \n\n sample_rate: int\n \n\n bits_per_sample: int\n \n\n channel_count: int\n \n \n
\n
","/NTgCalls/Available Types/AuthParams.xml": "\n

AuthParams

\n
\n \n class ntgcalls.AuthParams\n \n \n \n
\n PROPERTIES\n \n g_a_or_b: bytes\n \n key_fingerprint: int\n \n \n
\n
","/NTgCalls/Available Types/DhConfig.xml": "\n

DhConfig

\n
\n \n class ntgcalls.DhConfig\n \n \n \n
\n PARAMETERS\n \n g: int\n \n p: bytes\n \n random: bytes\n \n \n
\n
","/NTgCalls/Available Types/MediaDescription.xml": "\n

MediaDescription

\n
\n \n class ntgcalls.types.MediaDescription\n \n \n \n
\n PARAMETERS\n \n audio: Optional[ntgcalls.AudioDescription]\n \n\n video: Optional[ntgcalls.VideoDescription]\n \n \n
\n
","/NTgCalls/Available Types/MediaState.xml": "\n

MediaState

\n
\n \n class ntgcalls.MediaState\n \n \n \n
\n PROPERTIES\n \n muted -> bool\n \n\n video_paused -> bool\n \n\n video_stopped -> bool\n \n \n
\n
","/NTgCalls/Available Types/Protocol.xml": "\n

Protocol

\n
\n \n typedef enum Protocol\n \n \n \n
\n PROPERTIES\n \n min_layer: int\n \n max_layer: int\n \n udp_p2p: bool\n \n udp_reflector: bool\n \n library_versions: list[str]\n \n \n
\n
","/NTgCalls/Available Types/RTCServer.xml": "\n

RTCServer

\n
\n \n class ntgcalls.RTCServer\n \n \n \n
\n PROPERTIES\n \n id: int\n \n ipv4: str\n \n ipv6: str\n \n username: Optional[str]\n \n password: Optional[str]\n \n port: int\n \n turn: bool\n \n stun: bool\n \n tcp: bool\n \n peer_tag: Optional[bytes]\n \n \n
\n
","/NTgCalls/Available Types/VideoDescription.xml": "\n

VideoDescription

\n
\n \n class ntgcalls.types.VideoDescription\n \n \n \n
\n PARAMETERS\n \n \n\n \n\n \n\n fps: int\n \n \n
\n
","/NTgCalls/Basic Methods/Connect P2P.xml": "\n \n

Connect P2P

\n \n

Example

\n \n from ntgcalls import NTgCalls\n ...\n\n app = NTgCalls()\n rtc_servers = ... # Obtain the RTC servers\n dh_config = ... # Obtain the DH configuration\n versions = ... # Obtain the library versions\n p2p_allowed = ... # Obtain whether P2P is allowed\n await app.connect_p2p(\n -1001185324811,\n rtc_servers,\n versions,\n p2p_allowed\n )\n \n \n

Details

\n \n async NTgCalls.connect_p2p()\n \n \n \n
\n \n PARAMETERS\n \n \n rtc_servers: list[RTCServer]\n \n versions: list[str]\n \n p2p_allowed: bool\n \n \n \n
\n \n RAISES\n \n \n \n exception ntgcalls.SignalingError\n \n exception ntgcalls.SignalingUnsupported\n \n \n \n
\n
","/NTgCalls/Basic Methods/Connect.xml": "\n

Connect

\n \n

Example

\n \n from ntgcalls import NTgCalls\n ...\n\n app = NTgCalls()\n ...\n tg_params = ...\n\n await app.connect(\n -1001185324811,\n tg_params,\n )\n \n \n

Details

\n \n async NTgCalls.connect()\n \n \n \n
\n \n PARAMETERS\n \n \n params: str\n \n \n \n
\n \n RAISES\n \n exception ntgcalls.ConnectionError\n \n \n This error occurs when attempting to execute an action on a non-existent Group Call.\n \n \n \n \n exception ntgcalls.InvalidParams\n This error occurs when attempting to send invalid Transports.\n \n \n
\n
","/NTgCalls/Basic Methods/Create Call.xml": "\n

Create Call

\n \n

Example

\n \n from ntgcalls import NTgCalls\n ...\n\n app = NTgCalls()\n\n params = await app.create_call(\n -1001185324811,\n MediaDescription(\n AudioDescription(\n input_mode=InputMode.File,\n input=\"audio.pcm\",\n sample_rate=96000,\n bits_per_sample=16,\n channel_count=2,\n ),\n )\n )\n \n \n

Details

\n \n async NTgCalls.create_call() -> str\n \n \n \n
\n \n PARAMETERS\n \n \n \n \n \n
\n \n RAISES\n \n exception ntgcalls.ConnectionError\n You are attempting to init an already existent Group Call.\n \n \n \n
\n
","/NTgCalls/Basic Methods/Create P2P Call.xml": "\n \n

Create P2P Call

\n \n

Example

\n \n from ntgcalls import NTgCalls\n ...\n app = NTgCalls()\n dh_config = ... # Obtain the DH configuration\n g_a_hash = ... # Parameter for key exchange (Only when is incoming call)\n params = await app.create_p2p_call(\n -1001185324811,\n config,\n g_a_hash,\n MediaDescription(\n AudioDescription(\n input_mode=InputMode.File,\n input=\"audio.pcm\",\n sample_rate=96000,\n bits_per_sample=16,\n channel_count=2,\n ),\n )\n )\n \n \n

Details

\n \n async NTgCalls.create_p2p_call() -> bytes\n \n \n \n
\n \n PARAMETERS\n \n \n config: DhConfig\n \n g_a_hash: Optional[bytes]\n \n \n \n \n
\n \n RAISES\n \n \n \n \n \n
\n
","/NTgCalls/Basic Methods/Exchange Keys.xml": "\n \n

Exchange Keys

\n \n

Example

\n \n from ntgcalls import NTgCalls\n ...\n\n app = NTgCalls()\n g_a_or_b = ... # Obtain the parameter for key exchange\n fingerprint = ... # Obtain the fingerprint (Optional for outgoing calls)\n params = await app.exchange_keys(\n -1001185324811,\n g_a_or_b,\n fingerprint\n )\n \n \n

Details

\n \n async NTgCalls.exchange_keys() -> AuthParams\n \n \n \n
\n \n PARAMETERS\n \n \n g_a_or_b: bytes\n \n fingerprint: int\n \n \n \n
\n \n RAISES\n \n \n \n exception ntgcalls.InvalidParams\n \n \n \n
\n
","/NTgCalls/Basic Methods/Stop.xml": "\n

Stop

\n \n

Example

\n \n from ntgcalls import NTgCalls\n ...\n\n app = NTgCalls()\n ...\n\n await app.stop(\n -1001185324811,\n )\n \n \n

Details

\n \n async NTgCalls.stop()\n \n \n \n
\n \n PARAMETERS\n \n \n \n \n
\n \n RAISES\n \n \n \n \n
\n
","/NTgCalls/Basic Methods/ntg_connect.xml": "\n

ntg_connect

\n \n

Example

\n \n #include <stdint.h>\n #include \"ntgcalls.h\"\n\n int main() {\n uint32_t uid = ntg_init();\n ...\n int64_t chatID = ...; // Obtain the chat ID\n char* params = ...; // Obtain connection parameters\n ntg_async_struct future;\n // Initialize the async struct\n int result = ntg_connect(uid, chatID, params, &future);\n // Wait for the async operation to complete\n ...\n return 0;\n }\n \n \n

Details

\n \n int ntg_connect()\n \n \n \n
\n \n PARAMETERS\n \n \n \n\n char* params\n \n \n \n \n
\n \n ERROR CODES\n \n \n \n
\n ASYNC ERROR CODES\n \n \n\n #NTG_RTMP_NEEDED -300\n This error occurs when attempting to join a group call that requires an RTMP transport.\n\n \n\n #NTG_CONNECTION_FAILED -302\n The connection to WebRTC failed.\n \n
\n
\n
","/NTgCalls/Basic Methods/ntg_connect_p2p.xml": "\n \n

ntg_connect_p2p

\n \n

Example

\n \n #include <stdint.h>\n #include \"ntgcalls.h\"\n\n int main() {\n uint32_t uid = ntg_init();\n ...\n int64_t chatID = ...; // Obtain the chat ID\n ntg_rtc_server_struct* rtcServers = ...; // Obtain the RTC servers\n int rtcServersCount = ...; // Obtain the count of RTC servers\n char** libraryVersions = ...; // Obtain the library versions\n int libraryVersionCount = ...; // Obtain the count of library versions\n bool p2pAllowed = ...; // Obtain whether P2P is allowed\n ntg_async_struct future;\n // Initialize the async struct\n int result = ntg_connect_p2p(\n uid,\n chatID,\n rtcServers,\n rtcServersCount,\n libraryVersions,\n libraryVersionCount,\n p2pAllowed,\n &future\n );\n // Wait for the async operation to complete\n }\n \n \n

Details

\n \n int ntg_connect_p2p()\n \n \n \n
\n \n PARAMETERS\n \n \n \n ntg_rtc_server_struct* servers\n \n int serversSize\n Count of list of endpoints\n char** versions\n \n int versionsSize\n Size of the versions array.\n bool p2pAllowed\n \n \n \n \n
\n \n ERROR CODES\n \n \n \n
\n ASYNC ERROR CODES\n \n \n \n \n #NTG_SIGNALING_ERROR -104\n \n #NTG_SIGNALING_UNSUPPORTED -105\n \n \n \n
\n
\n
","/NTgCalls/Basic Methods/ntg_create.xml": "\n

ntg_get_params

\n \n

Example

\n \n #include <stdint.h>\n #include \"ntgcalls.h\"\n\n int main() {\n uint32_t uid = ntg_init();\n ...\n int64_t chatID = ...; // Obtain the chat ID\n ntg_media_description_struct desc = {\n // Fill in media description fields\n };\n char buffer[512];\n ntg_async_struct future;\n // Initialize the async struct\n int result = ntg_create(uid, chatID, desc, buffer, sizeof(buffer));\n // Wait for the async operation to complete and\n // use 'buffer' for JoinGroupCall\n return 0;\n }\n \n \n

Details

\n \n int ntg_get_params()\n \n \n \n
\n \n PARAMETERS\n \n \n \n \n\n char* buffer\n \n \n A string buffer to store the connection parameters retrieved from WebRTC.\n These parameters can be used for JoinGroupCall.\n \n \n\n \n \n \n \n
\n \n ERROR CODES\n \n \n \n
\n ASYNC ERROR CODES\n \n \n \n \n \n \n
\n
\n
","/NTgCalls/Basic Methods/ntg_create_p2p.xml": "\n \n

ntg_create_p2p

\n \n

Example

\n \n #include <stdint.h>\n #include \"ntgcalls.h\"\n\n int main() {\n uint32_t uid = ntg_init();\n ...\n int64_t chatID = ...; // Obtain the chat ID\n ntg_dh_config_struct dhConfig = ...; // Obtain the DH configuration\n uint8_t* g_a_hash = ...; // Parameter for key exchange (Only when is incoming call)\n int sizeG_A_Hash = ...; // Size of the parameter for key exchange (Only when is incoming call)\n ntg_media_description_struct desc = {\n // Fill in media description fields\n };\n uint8_t* buffer[32];\n ntg_async_struct future;\n // Initialize the async struct\n int result = ntg_create_p2p(\n uid,\n chatID,\n &dhConfig,\n g_a_hash,\n sizeG_A_Hash,\n desc,\n buffer,\n sizeof(buffer),\n &future\n );\n // Wait for the async operation to complete and\n // use 'buffer' for PhoneRequestCall or AcceptCall with Protocol\n return 0;\n }\n \n \n

Details

\n \n int ntg_create_p2p()\n \n \n \n
\n \n PARAMETERS\n \n \n \n ntg_dh_config_struct* dhConfig\n \n uint8_t* g_a_hash\n \n int sizeGAHash\n Size of the parameter for key exchange (Only when is incoming call)\n \n uint8_t* buffer\n Buffer to store the result\n int sizeBuffer\n Size of the buffer\n \n \n \n
\n \n ERROR CODES\n \n \n \n
\n ASYNC ERROR CODES\n \n \n \n \n \n
\n
\n
","/NTgCalls/Basic Methods/ntg_exchange_keys.xml": "\n \n

ntg_exchange_keys

\n \n

Example

\n \n #include <stdint.h>\n #include \"ntgcalls.h\"\n\n int main() {\n uint32_t uid = ntg_init();\n ...\n int64_t chatID = ...; // Obtain the chat ID\n uint8_t* g_a_or_b = ...; // Obtain the parameter for key exchange\n int sizeGAOrB = ...; // Obtain the size of the parameter for key exchange\n int64_t fingerprint = ...; // Obtain the fingerprint\n ntg_auth_params_struct buffer;\n ntg_async_struct future;\n // Initialize the async struct\n int result = ntg_exchange_keys(uid, chatID, g_a_or_b, sizeGAOrB, fingerprint, &buffer, &future);\n // Wait for the async operation to complete\n }\n \n \n

Details

\n \n int ntg_exchange_keys()\n \n \n \n
\n \n PARAMETERS\n \n \n \n uint8_t* g_a_or_b\n \n int sizeGAOrB\n Size of the parameter for key exchange\n int64_t fingerprint\n \n ntg_auth_params_struct* authParams\n \n \n \n \n
\n \n ERROR CODES\n \n \n \n
\n ASYNC ERROR CODES\n \n \n \n \n #NTG_MISSING_FINGERPRINT -103\n \n \n
\n
\n
","/NTgCalls/Basic Methods/ntg_stop.xml": "\n

ntg_stop

\n \n

Example

\n \n #include <stdint.h>\n #include \"ntgcalls.h\"\n\n int main() {\n uint32_t uid = ntg_init();\n ...\n int64_t chatID = ...; // Obtain the chat ID\n char* params = ...; // Obtain connection parameters\n ntg_async_struct future;\n // Initialize the async struct\n int result = ntg_stop(uid, chatID);\n // Wait for the async operation to complete\n return 0;\n }\n \n \n

Details

\n \n int ntg_stop()\n \n \n \n
\n \n PARAMETERS\n \n \n \n \n \n \n
\n \n ERROR CODES\n \n \n \n
\n ASYNC ERROR CODES\n \n \n \n
\n
\n
","/NTgCalls/Build Guide.xml": "\n

Introduction

\n \n Being a modern library, NTgCalls requires CMake 3.27+ to be built on your system,\n on Linux is required at least CLang 18+ and libx11-dev.\n We recommend using the latest versions of both CMake and CLang.\n \n \n Before building NTgCalls, check for pre-compiled shared libs on GitHub Releases or\n Python Bindings from PyPI.\n Building from source may be necessary if pre-compiled packages are not available.\n \n \n

Installing Prerequisites

\n \n Below, we will guide you through the step-by-step process of installing the prerequisites\n required to compile NTgCalls on your operating system.\n \n \n

Linux

\n \n \n \n Update the system's package list:
\n First, make sure you have an updated list of packages:\n
\n \n $ sudo apt update\n \n
\n \n \n Build Essential, libx11-dev, Clang 18 and etc:
\n This section provides instructions on how to install four specific packages: libx11-dev,\n build-essential, curl and Clang version 18. Use the following command:\n
\n \n \n x86_64\n ARM64\n \n \n $ sudo apt install libx11-dev build-essential curl\n \n \n $ wget https://apt.llvm.org/llvm.sh\n $ sudo bash llvm.sh 18\n $ sudo apt install libx11-dev build-essential curl\n \n \n
\n
\n

Windows

\n \n \n \n Install Microsoft Visual Studio 2019:
\n Install Microsoft Visual Studio 2019 with the C++ workload. You can download it from the official website.\n
\n
\n \n \n Download CMake Installer:
\n Download the CMake installer for Windows from the official website.\n
\n
\n \n \n Run Installer:
\n Run the downloaded CMake installer and follow the installation wizard instructions.\n Make sure to select the option to add CMake to the system PATH during installation.\n
\n
\n
\n

macOS

\n \n \n \n Install Xcode Command Line Tools:
\n If you don't have Xcode installed, you can install the Command Line Tools separately. Open a terminal and run the following command:\n
\n \n \n $ xcode-select --install\n \n \n
\n \n \n Install CMake:
\n Open a terminal and run the following command to install CMake:\n
\n \n \n $ brew install cmake\n \n \n
\n
\n
\n \n

Cloning and Building

\n \n In this section, you'll learn how to clone the NTgCalls repository and build the library from source.\n \n \n

Cloning the Repo

\n \n To begin building NTgCalls from source, you need to clone the GitHub repository. Follow these steps to clone the repo:\n \n \n \n \n Change to the Directory Where You Want to Clone the Repo:
\n Navigate to the directory where you want to store the NTgCalls source code. You can use the `cd` command to change directories.\n
\n \n $ cd /path/to/your/directory\n \n
\n \n \n Clone the NTgCalls Repository:
\n Use the following command to clone the NTgCalls GitHub repository:\n
\n \n $ git clone https://github.com/pytgcalls/ntgcalls.git --recursive\n \n
\n
\n

Compilation

\n \n Now that you have successfully installed all the required prerequisites for NTgCalls,\n it's time to build the library.\n Follow these steps to compile NTgCalls on your system.\n \n \n It's essential to have Python 3.8+ installed on your server.\n \n \n

Building Shared Library

\n \n For developers looking to use NTgCalls with C and C++, we provide C Bindings.\n Follow these steps to compile NTgCalls with C Bindings in either Release or Debug mode:\n \n \n \n \n Change Directory:
\n Navigate to the root directory of the NTgCalls project:\n
\n \n $ cd /path/to/ntgcalls\n \n
\n \n \n Generate Library:
\n Run the following command to generate the libraries:\n
\n \n \n Debug\n Release\n \n \n # Shared\n $ python3 setup.py build_lib --debug\n # Static\n $ python3 setup.py build_lib --debug --static\n \n \n # Shared\n $ python3 setup.py build_lib\n # Static\n $ python3 setup.py build_lib --static\n \n \n
\n
\n
\n

Building Python Bindings

\n \n NTgCalls offers Python Bindings, facilitating seamless integration with Python.\n Follow these steps to compile NTgCalls with Python Bindings:\n \n \n \n \n Change Directory:
\n Navigate to the root directory of the NTgCalls project:\n
\n \n $ cd /path/to/ntgcalls\n \n
\n \n \n Install Python Bindings:
\n Run the following command to install the Python Bindings:\n
\n \n $ pip3 install . -U\n \n
\n
\n
\n
\n
","/NTgCalls/Callback Registration.xml": "\n

Callback Registration

\n \n Callbacks registration allows you to specify custom functions to be executed when specific\n events occur or conditions are met within your application.\n These events might include changes in call status, media state updates, or other critical moments in\n the NTgCalls library's operation.\n \n \n When registering callbacks, keep in mind that each registration replaces the previously set callback.\n \n \n

\n \n ntg_on_stream_end()\n \n \n
\n \n PARAMETERS\n \n \n ntg_stream_callback callback\n The callback function to be executed when the stream ends.\n \n \n \n
\n

Example

\n \n #include \"ntgcalls.h\"\n ...\n void myStreamEndCallback(uint32_t uid, int64_t chatID, ntg_stream_type_enum type, void *data) {\n // Your callback logic here\n }\n ...\n int main() {\n uint32_t uid = ntg_init();\n ... // Your Code Here\n ntg_on_stream_end(uid, myStreamEndCallback, customData);\n ...\n return 0;\n }\n \n
\n \n
\n

\n \n ntg_on_upgrade()\n \n \n
\n \n PARAMETERS\n \n \n ntg_upgrade_callback callback\n The callback function to be executed when the stream needs to update MTProto stream parameters.\n \n \n \n
\n

Example

\n \n #include \"ntgcalls.h\"\n ...\n void myOnUpgradeCallback(uint32_t uid, int64_t chatID, ntg_media_state_struct mediaState, void *data) {\n // Your callback logic here\n }\n ...\n int main() {\n uint32_t uid = ntg_init();\n ... // Your Code Here\n ntg_on_upgrade(uid, myOnUpgradeCallback, customData);\n ...\n return 0;\n }\n \n
\n \n
\n

\n \n ntg_on_connection_change()\n \n \n
\n \n PARAMETERS\n \n \n ntg_connection_callback callback\n The callback function to be executed when the connection state changes.\n \n \n \n
\n

Example

\n \n #include \"ntgcalls.h\"\n ...\n void myOnConnectionChangeCallback(uint32_t uid, int64_t chatID, ntg_connection_state_enum state, void *data) {\n // Your callback logic here\n }\n ...\n int main() {\n uint32_t uid = ntg_init();\n ... // Your Code Here\n ntg_on_connection_change(uid, myOnConnectionChangeCallback, customData);\n ...\n return 0;\n }\n \n
\n \n
\n

\n \n ntg_on_signaling_data()\n \n \n
\n \n PARAMETERS\n \n \n ntg_signaling_callback callback\n The callback function to be executed when signaling data is received.\n \n \n \n
\n

Example

\n \n #include \"ntgcalls.h\"\n ...\n void myOnSignalingDataCallback(uint32_t uid, int64_t chatID, const char *data, size_t size, void *customData) {\n // Your callback logic here\n }\n ...\n int main() {\n uint32_t uid = ntg_init();\n ... // Your Code Here\n ntg_on_signaling_data(uid, myOnSignalingDataCallback, customData);\n ...\n return 0;\n }\n \n
\n \n
\n

\n \n ntg_register_logger()\n \n \n
\n \n PARAMETERS\n \n ntg_log_message_callback callback\n \n \n \n
\n

Example

\n \n #include <stdint.h>\n #include \"ntgcalls.h\"\n\n void logger(ntg_log_message_struct* message) {\n printf(\"Log message: %s\\n\", message->message);\n }\n\n int main() {\n ntg_register_logger(logger);\n ...\n return 0;\n }\n \n
\n
\n
","/NTgCalls/Callbacks.xml": "\n

Callbacks

\n \n Callbacks allows you to define custom behavior or actions that should be triggered in response to specific\n events or conditions within your application.\n These events could include call-related occurrences, state changes, or other interactions with the NTgCalls library.\n \n
\n \n NTgCalls.on_stream_end()\n \n \n

Example

\n \n ...\n app = NTgCalls()\n ...\n def handler(chat_id: int, update: StreamType):\n print(chat_id, update)\n ...\n app.on_stream_end(handler)\n \n
\n
\n

\n \n NTgCalls.on_upgrade()\n \n \n

Example

\n \n ...\n app = NTgCalls()\n ...\n def handler(chat_id: int, update: MediaState):\n print(chat_id, update)\n ...\n app.on_upgrade(handler)\n \n
\n
\n

\n \n NTgCalls.on_connection_change()\n \n \n

Example

\n \n ...\n app = NTgCalls()\n ...\n def handler(chat_id: int, state: ConnectionState):\n print(chat_id, state)\n ...\n app.on_connection_change(handler)\n \n
\n
\n

\n \n NTgCalls.on_signaling()\n \n \n

Example

\n \n ...\n app = NTgCalls()\n ...\n def handler(chat_id: int, payload: bytes):\n print(chat_id, payload)\n ...\n app.on_signaling(handler)\n \n
\n
\n
","/NTgCalls/Client.xml": "\n

NTgCalls Client

\n \n Welcome to the API Reference section, where you'll find comprehensive information about the NTgCalls API.\n This is your gateway to in-depth details about the main Client class, its methods, types,\n all of which play a crucial role in utilizing NTgCalls effectively.\n \n

Example

\n \n from ntgcalls import NTgCalls\n\n app = NTgCalls()\n print(app.ping())\n \n \n

Details

\n \n \n class ntgcalls.NTgCalls\n \n \n The NTgCalls Client is your primary interface for seamless interaction with Group Calls.\n
\n \n STATIC METHODS\n \n async calls() -> dict[int, ntgcalls.StreamStatus]\n \n\n async cpu_usage() -> float\n \n\n ping() -> str\n Return \"pong\" message when calling this method\n\n get_protocol() -> ntgcalls.Protocol\n \n \n \n
\n
\n
","/NTgCalls/Getting Started.xml": "\n

Getting Started

\n \n This section provides documentation for the NTgCalls C API, which allows you to use NTgCalls in various programming languages,\n including C, C++, Go, Rust, Deno, and more.\n Below, you will find detailed information about the initialization and cleanup functions.\n \n \n

Initialization

\n \n To get started with NTgCalls in your application, you need to initialize the library using the ntg_init function.\n This function sets up the necessary resources and prepares NTgCalls for use.\n \n \n Make sure to call ntg_init before using any other NTgCalls functions.\n \n \n

Example

\n \n #include \"ntgcalls.h\"\n\n int main() {\n uint32_t uid = ntg_init();\n\n ... // Your Code Here\n return 0;\n }\n \n
\n\n

Cleanup

\n \n To clean up and release the resources used by NTgCalls, you should call the ntg_destroy function.\n This function deallocates memory and performs necessary cleanup operations.\n \n \n Always call ntg_destroy when you are done using NTgCalls to prevent memory leaks and resource issues.\n \n \n

Example

\n \n #include \"ntgcalls.h\"\n\n int main() {\n uint32_t uid = ntg_init();\n ... // Your Code Here\n\n int result = ntg_destroy(uid);\n if (result != 0) {\n printf(\"NTgCalls cleanup failed.\\n\");\n return 1;\n }\n return 0;\n }\n \n
\n\n \n

Library Version

\n \n You can retrieve the version of the NTgCalls library currently in use using the ntg_get_version function.\n This function returns a string containing the version number.\n \n \n

Example

\n \n #include \"ntgcalls.h\"\n #include <stdio.h>\n\n int main() {\n char version[8];\n ntg_get_version(version, sizeof(version));\n printf(\"NTgCalls Version: %s\\n\", version);\n return 0;\n }\n \n \n
\n

Details

\n \n int ntg_get_version()\n \n \n Retrieve library version\n
\n \n PARAMETERS\n \n char* buffer\n A character buffer to store the version string.\n\n \n \n \n
\n \n ERROR CODES\n \n \n \n \n
\n
\n
","/NTgCalls/Quick Start.xml": "\n

Quick Start

\n \n Welcome to this section, which is primarily intended for developers who are moderately experienced or\n seeking to perform a porting in their language using C bindings. If you are new to Python development,\n we strongly recommend using Py-TgCalls.\n However, if you fall into the aforementioned categories,\n you can find an example of usage with the various porting below.\n \n

Community and Official Libraries

\n \n In the following section, we present a comprehensive catalog of libraries,\n thoughtfully crafted by the community and officially endorsed,\n all of which leverage the robust capabilities of NTgCalls.\n \n
\n \n \n \n

Enjoy the API

\n \n What we've just seen are simplified ports of NTgCalls. However, now let's delve deeper!\n In the upcoming pages, we'll explore NTgCalls in a step-by-step manner,\n covering how it functions, how to install it, and more.\n\n Are you feeling eager to continue?\n You can take a shortcut to the Call Methods\n section and return later to delve into more details.\n \n
","/NTgCalls/Stream Methods/Change Stream.xml": "\n

Change Stream

\n \n

Example

\n \n from ntgcalls import NTgCalls\n ...\n\n app = NTgCalls()\n\n await app.change_stream(\n -1001185324811,\n MediaDescription(\n AudioDescription(\n input_mode=InputMode.File,\n input=\"foxes.pcm\",\n sample_rate=96000,\n bits_per_sample=16,\n channel_count=2,\n ),\n )\n )\n \n \n

Details

\n \n async NTgCalls.change_stream()\n \n \n \n
\n \n PARAMETERS\n \n \n \n \n \n
\n \n RAISES\n \n \n \n \n \n
\n
","/NTgCalls/Stream Methods/Mute.xml": "\n

Mute

\n \n

Example

\n \n from ntgcalls import NTgCalls\n ...\n\n app = NTgCalls()\n ...\n\n await app.mute(\n -1001185324811,\n )\n \n \n

Details

\n \n async NTgCalls.mute() -> bool\n \n \n \n
\n \n PARAMETERS\n \n \n \n \n
\n \n RAISES\n \n \n \n \n
\n
","/NTgCalls/Stream Methods/Pause.xml": "\n

Pause

\n \n

Example

\n \n from ntgcalls import NTgCalls\n ...\n\n app = NTgCalls()\n ...\n\n await app.pause(\n -1001185324811,\n )\n \n \n

Details

\n \n async NTgCalls.pause() -> bool\n \n \n \n
\n \n PARAMETERS\n \n \n \n \n
\n \n RAISES\n \n \n \n \n
\n
","/NTgCalls/Stream Methods/Resume.xml": "\n

Resume

\n \n

Example

\n \n from ntgcalls import NTgCalls\n ...\n\n app = NTgCalls()\n ...\n\n await app.resume(\n -1001185324811,\n )\n \n \n

Details

\n \n async NTgCalls.resume() -> bool\n \n \n \n
\n \n PARAMETERS\n \n \n \n \n
\n \n RAISES\n \n \n \n \n
\n
","/NTgCalls/Stream Methods/Time.xml": "\n

Time

\n \n

Example

\n \n from ntgcalls import NTgCalls\n ...\n\n app = NTgCalls(client)\n\n print(\n await app.time(\n -1001185324811,\n )\n )\n \n \n

Details

\n \n async NTgCalls.time() -> int\n \n \n \n
\n \n PARAMETERS\n \n \n \n \n
\n \n RAISES\n \n \n \n \n
\n
","/NTgCalls/Stream Methods/UnMute.xml": "\n

UnMute

\n \n

Example

\n \n from ntgcalls import NTgCalls\n ...\n\n app = NTgCalls()\n ...\n\n await app.unmute(\n -1001185324811,\n )\n \n \n

Details

\n \n async NTgCalls.unmute() -> bool\n \n \n \n
\n \n PARAMETERS\n \n \n \n \n
\n \n RAISES\n \n \n \n \n
\n
","/NTgCalls/Stream Methods/ntg_change_stream.xml": "\n

ntg_change_stream

\n \n

Example

\n \n #include <stdint.h>\n #include \"ntgcalls.h\"\n\n int main() {\n uint32_t uid = ntg_init();\n ...\n int64_t chatID = ...; // Obtain the chat ID\n ntg_media_description_struct desc = {\n // Fill in updated media description fields\n };\n ntg_async_struct future;\n // Initialize the async struct\n int result = ntg_change_stream(uid, chatID, desc, &future);\n // Wait for the async operation to complete\n return 0;\n }\n \n \n

Details

\n \n int ntg_change_stream()\n \n \n \n
\n \n PARAMETERS\n \n \n \n \n \n \n \n
\n \n ERROR CODES\n \n \n \n
\n ASYNC ERROR CODES\n \n \n\n \n \n
\n
\n
","/NTgCalls/Stream Methods/ntg_mute.xml": "\n

ntg_mute

\n \n

Example

\n \n #include <stdint.h>\n #include \"ntgcalls.h\"\n\n int main() {\n uint32_t uid = ntg_init();\n ...\n int64_t chatID = ...; // Obtain the chat ID\n ntg_async_struct future;\n // Initialize the async struct\n int errCode = ntg_mute(uid, chatID, &future);\n // Wait for the async operation to complete\n if (future.errorCode == 0) {\n printf(\"Audio muted.\\n\");\n } else if (future.errorCode == 1) {\n printf(\"Audio was already muted.\\n\");\n } else {\n printf(\"Failed to mute audio (Error code: %d).\\n\", future.errorCode);\n return 1;\n }\n ... // Your Code Here\n return 0;\n }\n \n \n

Details

\n \n int ntg_mute()\n \n \n \n
\n \n PARAMETERS\n \n \n \n \n \n \n
\n \n ERROR CODES\n \n \n \n
\n ASYNC ERROR CODES\n \n \n \n
\n
\n
","/NTgCalls/Stream Methods/ntg_pause.xml": "\n

ntg_pause

\n \n

Example

\n \n #include <stdint.h>\n #include \"ntgcalls.h\"\n\n int main() {\n uint32_t uid = ntg_init();\n ...\n int64_t chatID = ...; // Obtain the chat ID\n ntg_async_struct future;\n // Initialize the async struct\n int errCode = ntg_pause(uid, chatID);\n // Wait for the async operation to complete\n if (future.errorCode == 0) {\n printf(\"Audio paused.\\n\");\n } else if (future.errorCode == 1) {\n printf(\"Audio was already paused.\\n\");\n } else {\n printf(\"Failed to pause audio (Error code: %d).\\n\", result);\n return 1;\n }\n ... // Your Code Here\n return 0;\n }\n \n \n

Details

\n \n int ntg_pause()\n \n \n \n
\n \n PARAMETERS\n \n \n \n \n \n \n
\n \n ERROR CODES\n \n \n \n
\n ASYNC ERROR CODES\n \n \n \n
\n
\n
","/NTgCalls/Stream Methods/ntg_resume.xml": "\n

ntg_resume

\n \n

Example

\n \n #include <stdint.h>\n #include \"ntgcalls.h\"\n\n int main() {\n uint32_t uid = ntg_init();\n ...\n int64_t chatID = ...; // Obtain the chat ID\n ntg_async_struct future;\n // Initialize the async struct\n int errCode = ntg_resume(uid, chatID, &future);\n // Wait for the async operation to complete\n if (future.errorCode == 0) {\n printf(\"Audio resumed.\\n\");\n } else if (future.errorCode == 1) {\n printf(\"Audio was already resumed.\\n\");\n } else {\n printf(\"Failed to resume audio (Error code: %d).\\n\", result);\n return 1;\n }\n ... // Your Code Here\n return 0;\n }\n \n \n

Details

\n \n int ntg_resume()\n \n \n \n
\n \n PARAMETERS\n \n \n \n \n \n \n
\n \n ERROR CODES\n \n \n \n
\n ASYNC ERROR CODES\n \n \n \n
\n
\n
","/NTgCalls/Stream Methods/ntg_time.xml": "\n

ntg_time

\n \n

Example

\n \n #include <stdint.h>\n #include \"ntgcalls.h\"\n\n int main() {\n uint32_t uid = ntg_init();\n ...\n int64_t chatID = ...; // Obtain the chat ID\n int64_t time = 0;\n ntg_async_struct future;\n // Initialize the async struct\n int64_t result = ntg_time(uid, chatID, &time, &future);\n // Wait for the async operation to complete\n return 0;\n }\n \n \n

Details

\n \n int64_t ntg_time()\n \n \n \n
\n \n PARAMETERS\n \n \n \n int64_t* time\n The playback time in seconds.\n \n \n \n
\n \n ERROR CODES\n \n \n \n
\n ASYNC ERROR CODES\n \n \n \n
\n
\n
","/NTgCalls/Stream Methods/ntg_unmute.xml": "\n

ntg_unmute

\n \n

Example

\n \n #include <stdint.h>\n #include \"ntgcalls.h\"\n\n int main() {\n uint32_t uid = ntg_init();\n ...\n int64_t chatID = ...; // Obtain the chat ID\n ntg_async_struct future;\n // Initialize the async struct\n int errCode = ntg_unmute(uid, chatID, &future);\n // Wait for the async operation to complete\n if (future.errorCode == 0) {\n printf(\"Audio unmuted.\\n\");\n } else if (future.errorCode == 1) {\n printf(\"Audio was already unmuted.\\n\");\n } else {\n printf(\"Failed to unmute audio (Error code: %d).\\n\", future.errorCode);\n return 1;\n }\n ... // Your Code Here\n return 0;\n }\n \n \n

Details

\n \n int ntg_unmute()\n \n \n \n
\n \n PARAMETERS\n \n \n \n \n \n \n
\n \n ERROR CODES\n \n \n \n
\n ASYNC ERROR CODES\n \n \n \n
\n
\n
","/NTgCalls/Using Async.xml": "\n

Using Async

\n \n NTgCalls starting from version 1.2.0 supports asynchronous calls to function using ntg_async_struct,\n which contains userData that can be used to pass data between the caller and the callback,\n promise that is called when the operation is completed, and error that is set\n when an error occurs, but by default it is set to #NTG_ASYNC_NOT_READY (-4) until\n the operation is completed.\n \n \n

Async Call in a Sync way

\n \n To make an async call in a sync way, you can use a mutex to wait for the operation to complete:\n \n \n #include <ntgcalls.h>\n #include <mutex>\n\n void onCallReady(void* data) {\n ((std::mutex*)data)->unlock();\n }\n\n void makeAsyncCall() {\n ntg_async_struct asyncData;\n std::mutex mtx;\n asyncData.userData = &mtx;\n asyncData.promise = onCallReady;\n mutex.lock();\n int error = ntg_pause(asyncData);\n if (error != 0) {\n // Handle error\n }\n mutex.lock();\n // Async operation completed\n if (asyncData.errorCode != 0) {\n // Handle Async error\n }\n }\n \n \n

Async Call with custom data

\n \n You can pass custom data to the async call by using the userData field:\n \n \n #include <ntgcalls.h>\n #include <mutex>\n #include <iostream>\n\n struct CustomData {\n std::mutex* mtx;\n int64_t chatID;\n };\n\n void onCallReady(void* data) {\n CustomData* customData = (CustomData*)data;\n customData->mtx->unlock();\n std::cout << \"Chat ID: \" << customData->chatID << std::endl;\n }\n\n void makeAsyncCall() {\n ntg_async_struct asyncData;\n std::mutex mtx;\n CustomData data;\n data.mtx = &mtx;\n data.chatID = 1234567890;\n asyncData.userData = &data;\n asyncData.promise = onCallReady;\n mutex.lock();\n int error = ntg_pause(asyncData);\n if (error != 0) {\n // Handle error\n }\n mutex.lock();\n // Async operation completed\n if (asyncData.errorCode != 0) {\n // Handle Async error\n }\n }\n \n
","/PyTgCalls/Advanced Methods/Change Volume Call.xml": "\n

Change Volume Call

\n \n This feature has some Telegram bugs; sometimes the volume is not applied on the Client side.\n \n This method changes the userbot\u2019s output volume using MTProto APIs.\n

Example

\n \n from pytgcalls import Client\n from pytgcalls import idle\n ...\n\n app = PyTgCalls(client)\n app.start()\n\n ... # Call API methods\n\n app.change_volume_call(\n -1001185324811,\n 175,\n )\n\n idle()\n \n \n

Details

\n \n PyTgCalls.change_volume_call()\n \n \n Change the stream\u2019s volume.\n
\n \n PARAMETERS\n \n \n\n volume: int\n New stream\u2019s volume\n \n \n
\n \n RAISES\n \n \n \n \n
\n
","/PyTgCalls/Advanced Methods/Get Participants.xml": "\n

Get Participants

\n This method returns the list of a group call\u2019s participants using MTProto APIs.\n

Example

\n \n from pytgcalls import Client\n from pytgcalls import idle\n ...\n\n app = PyTgCalls(client)\n app.start()\n\n ... # Call API methods\n\n app.get_participants(\n -1001185324811,\n )\n\n idle()\n \n \n

Details

\n \n PyTgCalls.get_participants() -> list[GroupCall]\n \n \n Get a list of participants from a group call\n
\n \n PARAMETERS\n \n \n \n \n
\n
","/PyTgCalls/Advanced Types/Call.xml": "\n

Call

\n
\n \n class pytgcalls.types.Call\n \n \n \n
\n PROPERTIES\n \n call_type -> Type\n The type of the call.\n\n status -> Status\n \n \n
\n
","/PyTgCalls/Advanced Types/CallConfig.xml": "\n

CallConfig

\n
\n \n class pytgcalls.types.CallConfig\n \n \n Configuration descriptor for a private call\n
\n PARAMETERS\n \n timeout: int\n Timeout for an answer from the user\n \n
\n
","/PyTgCalls/Advanced Types/ChatUpdate.xml": "\n

ChatUpdate

\n \n class pytgcalls.types.ChatUpdate\n \n \n Represents a chat update.\n
\n PROPERTIES\n \n \n status -> Status\n Status of the chat.\n action -> Any\n Action of the chat.\n \n
\n
","/PyTgCalls/Advanced Types/GroupCallConfig.xml": "\n

GroupCallConfig

\n
\n \n class pytgcalls.types.GroupCallConfig\n \n \n Configuration descriptor for a group call\n
\n PARAMETERS\n \n invite_hash: Optional[str]\n Unique identifier for a group call invite in t.me link form\n join_as: \n InputPeer to join as a channel or a profile\n auto_start: bool\n Start group call if not present, by default, is True\n \n
\n
","/PyTgCalls/Advanced Types/GroupCallParticipant.xml": "\n

GroupCallParticipant

\n
\n \n class pytgcalls.types.GroupCallParticipant\n \n \n Info about a group call participant\n
\n PROPERTIES\n \n user_id -> int\n Unique identifier of a participant.\n\n muted -> bool\n Whether the participant is muted.\n\n muted_by_admin -> bool\n Whether an admin has muted the participant.\n\n video -> bool\n Whether the participant is currently broadcasting a video stream.\n\n screen_sharing -> bool\n Whether the participant is currently screen sharing.\n\n video_camera -> bool\n Whether the participant is currently broadcasting a video camera.\n\n raised_hand -> bool\n Whether the participant has raised the hand.\n\n volume -> int\n Volume level of the participant.\n\n action -> Action\n Current action of the participant.\n \n
\n
","/PyTgCalls/Advanced Types/StreamAudioEnded.xml": "\n

StreamAudioEnded

\n
\n \n class pytgcalls.types.StreamAudioEnded\n \n \n The audio stream has ended.\n
\n PROPERTIES\n \n \n \n
\n
","/PyTgCalls/Advanced Types/StreamVideoEnded.xml": "\n

StreamVideoEnded

\n
\n \n class pytgcalls.types.StreamVideoEnded\n \n \n The video stream has ended.\n
\n PROPERTIES\n \n \n \n
\n
","/PyTgCalls/Advanced Types/UpdatedGroupCallParticipant.xml": "\n

UpdatedGroupCallParticipant

\n
\n \n class pytgcalls.types.UpdatedGroupCallParticipant\n \n \n A participant changed his status.\n
\n PROPERTIES\n \n \n \n \n
\n
","/PyTgCalls/Available Enums/AudioQuality.xml": "\n

AudioQuality

\n
\n \n class pytgcalls.types.AudioQuality\n \n \n Enumeration of audio quality settings for audio streams in telegram calls.\n
\n ENUMERATION MEMBERS\n \n STUDIO = (96000, 2)\n Represents studio-quality audio with a bitrate of 96000 and 2 channels.\n\n HIGH = (48000, 2)\n Represents high-quality audio with a bitrate of 48000 and 2 channels.\n\n MEDIUM = (36000, 1)\n Represents medium-quality audio with a bitrate of 36000 and 1 channel.\n\n LOW = (24000, 1)\n Represents low-quality audio with a bitrate of 24000 and 1 channel.\n \n
\n
","/PyTgCalls/Available Enums/Call Status.xml": "\n

Call Status

\n
\n \n class pytgcalls.types.Call.Status\n \n \n Enumeration for managing call statuses.\n
\n ENUMERATION MEMBERS\n \n PLAYING = 1\n Indicates that the call is playing.\n PAUSED = 2\n Indicates that the call is paused.\n IDLE = 4\n Indicates that the call is idle.\n \n
\n
","/PyTgCalls/Available Enums/Call Type.xml": "\n

Call Type

\n
\n \n class pytgcalls.types.Call.Type\n \n \n Enumeration for managing call types.\n
\n ENUMERATION MEMBERS\n \n GROUP = 1\n Group call type.\n PRIVATE = 2\n Private call type.\n \n
\n
","/PyTgCalls/Available Enums/ChatUpdate Status.xml": "\n

ChatUpdate Status

\n
\n \n class pytgcalls.types.ChatUpdate.Status\n \n \n Enumeration for managing chat update status in telegram calls.\n
\n ENUMERATION MEMBERS\n \n KICKED = 1\n Indicates that you was kicked.\n LEFT_GROUP = 2\n Indicates that you left the chat.\n CLOSED_VOICE_CHAT = 4\n Indicates that the voice chat was closed.\n INVITED_VOICE_CHAT = 8\n Indicates that you was invited to the voice chat.\n DISCARDED_CALL = 16\n Indicates that the call was discarded.\n INCOMING_CALL = 32\n Indicates that an incoming call is available.\n LEFT_CALL = KICKED | LEFT_GROUP | CLOSED_VOICE_CHAT | DISCARDED_CALL\n Indicates that you left the call.\n \n
\n
","/PyTgCalls/Available Enums/GroupCallParticipant Action.xml": "\n

GroupCallParticipant Action

\n
\n \n class pytgcalls.types.GroupCallParticipant.Action\n \n \n Enumeration of actions for group call participants.\n
\n ENUMERATION MEMBERS\n \n JOINED = 1\n Represents a participant joined in a group call.\n\n LEFT = 2\n Represents a participant left a group call.\n\n UPDATED = 4\n Represents a participant updated in a group call.\n \n
\n
","/PyTgCalls/Available Enums/MediaStream Flags.xml": "\n

MediaStream Flags

\n
\n \n class pytgcalls.types.MediaStream.Flags\n \n \n Enumeration for managing media stream requirements in telegram calls.\n
\n ENUMERATION MEMBERS\n \n AUTO_DETECT = 1\n Automatically detects the presence of the stream.\n\n IGNORE = 2\n Ignores the stream.\n\n REQUIRED = 4\n Indicates that the stream is mandatory.\n\n NO_LATENCY = 8\n Used to indicate that the stream should be sent with no latency.\n \n
\n
","/PyTgCalls/Available Enums/VideoQuality.xml": "\n

VideoQuality

\n
\n \n class pytgcalls.types.VideoQuality\n \n \n Enumeration of video quality settings for video streams in telegram calls.\n
\n ENUMERATION MEMBERS\n \n UHD_4K = (3840, 2160, 60)\n Represents ultra-high-definition 4K video with a resolution of 3840x2160 and 60 FPS.\n\n QHD_2K = (2560, 1440, 60)\n Represents quad high-definition 2K video with a resolution of 2560x1440 and 60 FPS.\n\n FHD_1080p = (1920, 1080, 60)\n Represents full high-definition 1080p video with a resolution of 1920x1080 and 60 FPS.\n\n HD_720p = (1280, 720, 30)\n Represents high-definition 720p video with a resolution of 1280x720 and 30 FPS.\n\n SD_480p = (854, 480, 30)\n Represents standard-definition 480p video with a resolution of 854x480 and 30 FPS.\n\n SD_360p = (640, 360, 30)\n Represents standard-definition 360p video with a resolution of 640x360 and 30 FPS.\n \n
\n
","/PyTgCalls/Basic Methods/Idle.xml": "\n

Idle

\n \n This function will run indefinitely in order to block the main script\n execution and prevent it from exiting while having client(s) that are still running in the background.\n\n PyTgCalls works by keeping your handlers in a pool of worker threads, which run\n concurrently outside the main thread. Calling idle() will ensure that the client(s) remain active, by\n preventing the main script from ending until you decide to quit.\n\n Once a signal is received (e.g.: from CTRL+C) the function will terminate and your main script will continue.\n \n

Example

\n \n from pytgcalls import Client\n from pytgcalls import idle\n ...\n\n app1 = PyTgCalls(client1)\n app2 = PyTgCalls(client2)\n app3 = PyTgCalls(client3)\n\n ... # Set handlers up\n\n app1.start()\n app2.start()\n app3.start()\n\n idle()\n \n \n

Details

\n \n pytgcalls.idle()\n \n \n Blocks the main script execution until a signal is received.\n \n
","/PyTgCalls/Basic Methods/Leave Call.xml": "\n

Leave Call

\n \n This method replaces the deprecated leave_group_call method.\n \n This method allows leaving and stopping a group call or a private call, or declining a private call.\n

Example

\n \n from pytgcalls import Client\n from pytgcalls import idle\n ...\n\n app = PyTgCalls(client)\n app.start()\n\n ... # Call API methods\n\n app.leave_call(\n -1001185324811,\n )\n\n idle()\n \n \n

Details

\n \n PyTgCalls.leave_call()\n \n \n Leave a group call or a private call.\n
\n \n PARAMETERS\n \n \n \n \n
\n \n RAISES\n \n \n \n \n
\n
","/PyTgCalls/Basic Methods/Play.xml": "\n \n

Play

\n \n This method replaces the deprecated join_group_call and change_stream methods.\n \n This method allows streaming audio or video to a group call or a private call.\n

Example

\n \n from pytgcalls import Client\n from pytgcalls import idle\n from pytgcalls.types import MediaStream\n ...\n\n app = PyTgCalls(client)\n app.start()\n\n ... # Call API methods\n\n app.play(\n -1001185324811,\n MediaStream(\n 'test.mp4',\n )\n )\n\n idle()\n \n \n

Details

\n \n PyTgCalls.play()\n \n \n Join in a group call or accept/request a private call to stream audio or video.\n
\n \n PARAMETERS\n \n \n \n config: Optional[Union[pytgcalls.types.CallConfig, pytgcalls.types.GroupCallConfig]]\n Additional configuration for the call.\n \n \n
\n \n RAISES\n \n \n \n \n exception pytgcalls.exceptions.CallDeclined\n The call was declined by the user.\n exception pytgcalls.exceptions.CallDiscarded\n The call was discarded by the user while connecting.\n \n exception pytgcalls.exceptions.AlreadyJoinedError\n You are attempting to join in a call you're already a part of.\n \n \n \n
\n
","/PyTgCalls/Basic Methods/Run.xml": "\n

Run

\n \n This is a convenience method that calls start(), idle() in sequence.\n It makes running a client less verbose, but it is not suitable in case you want to run more than one client in a single script,\n since the idle() part will block all the subsequent code after starting the client.\n \n

Example

\n \n from pytgcalls import Client\n from pytgcalls import idle\n ...\n app = Client(client)\n\n ... # Call API decorators / MtProto decorators\n\n app.run()\n \n \n

Details

\n \n PyTgCalls.run()\n \n \n Start the client, idle the main script and finally stop the client.\n
\n \n RAISES\n \n \n \n \n
\n
","/PyTgCalls/Basic Methods/Start.xml": "\n

Start

\n \n This method start and then initialize NTgCalls core.\n \n

Example

\n \n from pytgcalls import Client\n from pytgcalls import idle\n ...\n app = Client(client)\n\n ... # Call API decorators / MTProto decorators\n\n app.start()\n \n \n

Details

\n \n PyTgCalls.start()\n \n \n Start the client.\n
\n \n RAISES\n \n \n \n \n
\n
","/PyTgCalls/Calling Methods.xml": "\n

Calling Methods

\n \n At this point, we have successfully installed PyTgCalls and installed an MTProto client;\n we are now aiming towards the core of the library. It\u2019s time to start playing with the API!\n \n

Basic Usage

\n Making API method calls with PyTgCalls is very simple. Here\u2019s a basic example we are going to examine step by step:\n \n from pytgcalls import PyTgCalls\n from pytgcalls import idle\n from pytgcalls.types import MediaStream\n ...\n api_id = 12345\n api_hash = '0123456789abcdef0123456789abcdef'\n ...\n app = PyTgCalls(client)\n app.start()\n app.play(\n -1001185324811,\n MediaStream(\n 'http://docs.evostream.com/sample_content/assets/sintel1m720p.mp4',\n )\n )\n idle()\n \n

Basic step-by-step

\n \n \n Let\u2019s begin by importing the Client class, Stream type and idle function:\n \n \n Now let\u2019s import your MTProto Client:\n \n \n PyrogramMod\n Telethon\n Hydrogram\n \n \n from pyrogram import Client\n \n \n from telethon import TelegramClient\n \n \n from hydrogram import Client\n \n \n \n \n Set your api_id and api_hash taken from my.telegram.org:\n \n api_id = 12345\n api_hash = '0123456789abcdef0123456789abcdef'\n \n \n \n Initialize the MTProto client:\n \n \n PyrogramMod\n Telethon\n Hydrogram\n \n \n client = Client('test_session', api_id, api_hash)\n \n \n client = TelegramClient('test_session', api_id, api_hash)\n \n \n client = Client('test_session', api_id, api_hash)\n \n \n \n \n Initialize the PyTgCalls client:\n \n app = PyTgCalls(client)\n \n \n \n Start the PyTgCalls client:\n \n app.start()\n \n \n \n Now you can call any method you want:\n \n app.play(\n -1001185324811,\n MediaStream(\n 'http://docs.evostream.com/sample_content/assets/sintel1m720p.mp4',\n )\n )\n \n \n \n Lastly, call the idle function to keep your code running:\n \n idle()\n \n \n \n

Asynchronous Calls

\n In case you wish to run PyTgCalls asynchronously:\n \n import asyncio\n from pytgcalls import PyTgCalls\n from pytgcalls import idle\n from pytgcalls.types import MediaStream\n ...\n app = PyTgCalls(client)\n\n async def main():\n await app.start()\n await app.play(\n -1001185324811,\n MediaStream(\n 'http://docs.evostream.com/sample_content/assets/sintel1m720p.mp4',\n )\n )\n await idle()\n\n asyncio.get_event_loop().run_until_complete(main())\n \n

Asynchronous step-by-step

\n \n \n Import PyTgCalls, AsyncIO and create an instance:\n \n import asyncio\n from pytgcalls import PyTgCalls\n from pytgcalls import idle\n ...\n app = PyTgCalls(client)\n \n \n \n Async methods can\u2019t be executed at the top level, because they must be within an async-defined function;\n here, we define one, and we put our code inside it; method calls require the await keyword:\n \n async def main():\n await app.start()\n await app.play(\n -1001185324811,\n MediaStream(\n 'http://docs.evostream.com/sample_content/assets/sintel1m720p.mp4',\n )\n )\n await idle()\n \n \n \n Then, we tell asyncio to call main() in async mode\n asyncio.get_event_loop().run_until_complete(main())\n \n \n
","/PyTgCalls/Changelogs.xml": "\n

Changelogs

\n \n
\n \n \n

What's new?

\n \n Private Calls: Now you can make private calls by just using a single method for also group calls, by using play().\n Code Rework: The code has been reworked to improve performance, stability and to make it more readable.\n Async Support: NTgCalls now supports asynchronous methods for improved performance.\n Filters for Updates: Added filters for updates to allow for more granular control over updates, More Info.\n Improved Documentation: Updated documentation with more examples, new UI and comprehensive guidance.\n \n \n

Breaking Changes

\n \n \n Now methods like change_stream() and join_group_call() was removed, now you can use play() for both private, group calls and changing streams.\n \n \n # Change stream\n call_py.change_stream(\n -1001234567890,\n AudioPiped(\n 'input.mp4',\n ),\n )\n
\n # Join group call\n call_py.join_group_call(\n -1001234567890,\n AudioPiped(\n 'input.mp4',\n ),\n )\n
\n \n # Change stream\n call_py.play(\n -1001234567890,\n AudioPiped(\n 'input.mp4',\n ),\n )\n
\n # Join group call\n call_py.play(\n -1001234567890,\n AudioPiped(\n 'input.mp4',\n ),\n )\n
\n
\n
\n \n Now all listeners like on_stream_end() was unified in on_update() and with filters, for example:\n \n \n # On Closed Voice Chat\n @call_py.on_closed_voice_chat()\n async def on_closed_voice_chat(client: PyTgCalls, update: Update):\n print(update)\n
\n # On stream end\n @call_py.on_stream_end()\n async def on_stream_end(client: PyTgCalls, update: Update):\n print(update)\n
\n \n from pytgcalls import filters\n from pytgcalls.types import ChatUpdate\n ...\n # On Closed Voice Chat\n @call_py.on_update(filters.chat_update(ChatUpdate.Status.CLOSED_VOICE_CHAT))\n async def on_closed_voice_chat(client: PyTgCalls, update: Update):\n print(update)\n
\n # On stream end\n @call_py.on_update(filters.stream_end)\n async def on_stream_end(client: PyTgCalls, update: Update):\n print(update)\n
\n
\n
\n \n Reworked GroupCall type, now is Call and now is more powerful and easy to use.\n \n \n Removed JoinedGroupCallParticipant and LeftGroupCallParticipant classes, now you can see the action in GroupCallParticipant class.\n \n \n Removed all legacy types and input stream, now is a mandatory to use MediaStream for all streams.\n \n \n Now ping() from Client is not anymore a coroutine, now is a normal method.\n \n \n Removed get_active_call() and get_call(), now is a mandatory to use calls() from Client.\n \n \n Renamed leave_group_call to leave_call().\n \n \n Moved MediaStream flags under MediaStream.Flags instead of MediaStream.\n \n \n Now invite_hash, join_as and auto_start are part of GroupCallConfig instead of join_group_call.\n \n \n Renamed additional_ffmpeg_parameters to ffmpeg_parameters in MediaStream.\n \n \n For more info about breaking changes, check the Examples, if we missed something, please open an issue.\n \n
\n

Additional Notes

\n \n We're pleased to announce that now is available an unofficial porting of NTgCalls for Rust, for more info, check the repository.\n \n
\n \n
\n \n
\n \n \n

What's new?

\n \n Static Typing: PyTgCalls is now fully statically typed, ensuring that the types of each method and class are thoroughly checked.\n YtDlp Support: MediaStream now supports links from YouTube using YtDlp, for example: https://www.youtube.com/watch?v=iSbLHrrqmoM\n \n MediaStream Quality Support: MediaStream now accepts enhanced quality options for audio and video parameters. For audio, use pytgcalls.types.AudioQuality, and for video, use pytgcalls.types.VideoQuality.\n \n \n call_py.join_group_call(\n -1001234567890,\n MediaStream(\n 'input.mp4',\n AudioParameters.from_quality(AudioQuality.STUDIO),\n VideoParameters.from_quality(VideoQuality.FHD_1080p),\n ),\n )\n \n \n call_py.join_group_call(\n -1001234567890,\n MediaStream(\n 'input.mp4',\n AudioQuality.STUDIO,\n VideoQuality.FHD_1080p,\n ),\n )\n \n \n \n \n \n

Breaking Changes

\n \n Now all raw methods like AudioParameters, VideoParameters, AudioStream, VideoStream, and Stream are all under pytgcalls.types.raw instead of pytgcalls.types.\n The exception class pytgcalls.exceptions.TelegramServerError is now part of ntgcalls.TelegramServerError.\n \n

Additional Notes

\n \n We're pleased to announce that pre-compiled wheels optimized for ARM64 devices are now available.\n \n
\n \n
\n \n
\n \n \n

Here's how to join:

\n \n Visit the discussion page: PyTgCalls Contest\n Share these details: Your Repository Name, Brief Description of Your Bot, Link to Your Repository\n \n

Prizes and Recognition

\n \n Encourage upvotes by reposting this message in your channels.\n The bot with the highest upvotes earns a prestigious place in the PyTgCalls documentation.\n \n

Contest Rules

\n \n Make sure your repository goes beyond minor tweaks of a fork.\n Use the latest PyTgCalls version).\n Your repository should be public.\n \n Join the contest now and showcase your PyTgCalls-powered bot for a chance to be featured prominently on the PyTgCalls documentation! Good luck!\n
\n \n
\n \n
\n \n \n

What's new?

\n \n AutoStart of Group Calls: Now GroupCalls will be started automatically if they are not started, if you want to know how to disable it, read here.\n \n Unified Stream Design: Now you can do whatever you want, streaming audio, video, both, recording the stream etc. with just one class!.\n \n \n # Play audio and video from and MP4 file\n call_py.join_group_call(\n -1001234567890,\n AudioVideoPiped(\n 'input.mp4',\n ),\n )\n
\n # Stream audio only from an MP4 file\n call_py.join_group_call(\n -1001234567890,\n AudioPiped(\n 'input.mp4',\n ),\n )\n
\n # Stream screen\n call_py.join_group_call(\n -1001234567890,\n CaptureVideoDesktop(\n MediaDevices.get_screen_devices()[0],\n ),\n )\n
\n \n # Play audio and video from and MP4 file\n call_py.join_group_call(\n -1001234567890,\n MediaStream(\n 'input.mp4',\n ),\n )\n
\n # Stream audio only from an MP4 file\n call_py.join_group_call(\n -1001234567890,\n MediaStream(\n 'input.mp4',\n video_flags=MediaStream.IGNORE,\n ),\n )\n
\n # Stream screen\n call_py.join_group_call(\n -1001234567890,\n MediaStream(\n MediaDevices.get_screen_devices()[0],\n ),\n )\n
\n
\n
\n \n
\n

Deprecation Notice

\n \n As we said in the last post,\n now PyTgCalls 0.8.6 has reached the end of life,\n so this update is completely incompatible with this or previous versions.\n We have also deprecated most of the Stream Piped methods, here's the list:\n \n \n AudioImagePiped\n AudioPiped\n AudioVideoPiped\n CaptureAudioDevice\n CaptureAVDesktop\n CaptureAVDeviceDesktop\n CaptureVideoDesktop\n VideoPiped\n \n
\n \n
\n \n
\n \n \n

What's new?

\n \n NTgCalls Integration: The PyTgCalls core has been updated to use NTgCalls instead of TgCallsJS, making it more portable and eliminating overhead. Now, you only need to install ffmpeg on your machine, resulting in improved performance.\n Hydrogram Support: Official support for Hydrogram, a new mtproto client based on Pyrogram, providing new possibilities and enhancing the overall experience.\n New Documentation: Revamped documentation with improved clarity, comprehensive examples, and up-to-date guidance for developers.\n \n \n

Community Milestone

\n \n Thank You All: Celebrating over 100 thousand Downloads! The project has seen remarkable growth, averaging around 8,000 downloads per week since its launch. We appreciate the community's strong interest and support.\n \n

Deprecation Notice

\n \n End-of-Life (EOL) Dates: Due to changes in Pyrogram and significant time since the release of PyTgCalls 0.8.X, different versions are marked for end-of-life:\n \n \n 0.8.0, 0.8.1, 0.8.2, 0.8.3, 0.8.4, 0.8.5: Support ended due to outdated versions.\n 0.8.6: Support will continue until December 18 due to Pyrogram archiving.\n 0.9.X: Current Long-Term Support.\n 1.0.X: Latest version with high-support rate.\n \n
\n \n
\n \n
\n \n \n

What's new?

\n \n Time Tracking: Added the ability to determine the time of the currently playing audio/video. For more details, check Played Time.\n New Errors: Introduced two new errors, UnMuteNeeded and RTMPStreamNeeded.\n \n

Changes & Bug Fixes

\n \n End of Life for Python3.6: Support for Python 3.6 has reached the end of life and is no longer maintained.\n Security Fix: Addressed a security issue with the ID generation process to enhance overall security.\n Multi-Thread Removal: Removed Multi-Thread Py-TgCalls due to no bug fixes by Node.js for over 4 years.\n \n
\n \n
\n \n
\n \n \n \n As we know, Google is in charge of financing Python.\n Due to the recent events with the Node.js situation, PyPI ran for cover,\n thanks to the strong collaboration between Python and the Google Open Source Security Team they offered 4000 Titan Tokens for free available only in some regions of the world.\n PyPI to distribute these security tokens was based on a criterion, that is; any project in the top 1% of downloads in the previous 6 months is considered critical,\n at the moment only 3500 projects are considered out of 350 thousand are considered as such and py-tgcalls is considered a critical project.\n According to statistics last month, it was downloaded 684 thousand times.\n \n \n \n
\n \n
\n \n \n

Changes & Bug Fixes

\n \n WebRTC Retry Fixes: Addressed issues with WebRTC retry for more reliable connections.\n Asynchronous Method Invocation: All methods, such as join_group_call, now use asyncio future, waiting for responses from Node.js asynchronously.\n \n
\n \n
\n \n
\n \n \n

What's new?

\n \n \n Internal FFmpeg Conversion: Introduced internal FFmpeg conversion for AudioPiped, AudioVideoPiped, and AudioImagePiped for seamless multimedia handling.\n \n call_py.join_group_call(\n -1001234567890,\n AudioVideoPiped(\n 'input.webm',\n ),\n stream_type=StreamType().pulse_stream,\n )\n \n \n Remote Stream Support: Added support for remote streams for more diverse streaming options.\n Stream Image with Audio: Added the ability to stream images with audio using AudioImagePiped.\n GetParticipants and OnParticipantChange: New functionalities for handling participants in group calls.\n Browser Constants as Headers: Added browser constants as headers for FFmpeg.\n Python 3.10 Support: Added compatibility with Python 3.10.\n \n

Changes & Fixes

\n \n Proportion Video Support: Added support for all proportion video formats for a more versatile video experience.\n Communication Fix: Addressed stderr overflow by adding a reader for improved Node.js communication.\n WebRTC Connection Retry: Added automatic retry if WebRTC connection fails for more reliable connections.\n Lighter Buffer Reader: Optimized the Buffer Reader for lighter resource usage.\n Multiple Ping Requests: Now supports multiple ping requests for improved responsiveness.\n \n
\n \n
\n \n
\n \n \n

What's new?

\n \n Custom Exceptions: Added custom exceptions for more robust error handling.\n Platform Support: Added support for Windows, macOS, and Linux Arm64.\n \n

Changes & Fixes

\n \n PyTgCalls Re-Base: Code cleanup and fixes for a more streamlined and efficient codebase.\n Fully Async: The library is now fully asynchronous for improved performance.\n Communication Update: Removed the internal socket server for Node.js communication between Python, replaced with stdin and stdout.\n CustomAPI Renewed: CustomAPI upgraded to version 2.1 with new features and improvements.\n RawUpdate Enhancement: RawUpdate renewed with PyTgCalls Object Update for better handling of updates.\n Method Name Change: .run() is now .start() and no longer blocks code execution.\n Logging Update: Now logs are directed to Python Logging for improved logging capabilities.\n Voice Call Handling: If the stream is deleted, the userbot will exit the voice call by printing an error in RawUpdate.\n \n \n
\n \n
\n \n
\n \n \n

What's new?

\n \n Multi-core support: PyTgCalls now supports multiple cores for enhanced performance.\n Remote version check: Added the ability to check for the latest version available on GitHub remotely.\n \n

Changes & Fixes

\n \n CustomAPI 2.0: Upgraded to CustomAPI version 2.0 with new features and improvements.\n Security Fix: Addressed a security vulnerability for a more secure experience.\n Function execution without Node.js Core waiting: Users can now call functions without waiting for the Node.js Core.\n \n
\n \n
\n \n
\n \n \n

Changes & Fixes

\n \n Fixed PyPi builds: Fixed an issue where PyTgCalls compiled without the JavaScript core\n Improved join_group_call error: The join_group_call error is now more descriptive\n \n \n
\n
\n
","/PyTgCalls/Client.xml": "\n

PyTgCalls Client

\n \n You now are in the API Reference section. Here you can find detailed information about PyTgCalls API:\n the main Client class, all available methods, types, attributes and decorators detailed descriptions can be found starting from this page.\n\n This page is about the Client class, which exposes high-level methods for easy access to the API.\n \n

Example

\n \n from pytgcalls import PyTgCalls\n\n app = PyTgCalls(client)\n app.start()\n \n \n

Details

\n \n \n class pytgcalls.PyTgCalls\n \n \n PyTgCalls Client, the main tool for interacting with Telegram Calls.\n
\n \n PARAMETERS\n \n app: Union[pyrogram.Client, telethon.TelegramClient, hydrogram.Client]\n Pass the MTProto Client\n cache_duration: int\n Cache duration of a Full Chat query\n \n \n
\n \n STATIC METHODS\n \n async calls -> dict[str, Call]\n \n\n async group_calls -> dict[str, Call]\n Get all group calls\n\n async private_calls -> dict[str, Call]\n Get all private calls\n\n cache_peer -> \n Get current Telegram user\n\n ping -> int\n Ping of NTgCalls core\n\n async cpu_usage -> float\n Get the CPU usage of the current process\n \n \n
\n \n RAISES\n \n exception pytgcalls.exceptions.InvalidMTProtoClient\n You set an invalid MTProto client.\n \n \n
\n\n
\n
","/PyTgCalls/Custom Api.xml": "\n

Custom API

\n \n You now are in the API Reference section where you can find detailed information about the Custom API:\n the Front-end API class, all available methods, types, attributes and decorators detailed descriptions can be found starting from this page.\n\n This page is about the CustomAPI class, which exposes high-level methods for easy access to the API.\n \n

Example

\n \n from pytgcalls import CustomApi\n\n api = CustomApi()\n\n @api.on_update_custom_api()\n async def custom_api_request(request: dict):\n print(request)\n return {\n 'response': 'FOXES',\n }\n api.start()\n \n \n

Details

\n \n \n class pytgcalls.CustomApi\n \n \n CustomApi, the main means host the local http api server.\n
\n \n PARAMETERS\n \n port: int\n CustomApi port of the http server\n \n \n
\n \n METHODS\n \n start()\n This method starts the internal http webserver, this is helpful if you need an API interface to PyTgCalls.\n \n \n
\n
\n
","/PyTgCalls/Decorators.xml": "\n

Decorators

\n \n While still being methods bound to the PyTgCalls class,\n decorators hold a special significance that justifies a dedicated page.\n\n Decorators allow you to register callback functions for handling updates in a much easier and cleaner way.\n All you need to do is add the decorators on top of your functions.\n \n \n from pytgcalls import PyTgCalls\n from pytgcalls.types import Update\n from pytgcalls import filters as call_filters\n ...\n client = # Here Your MTProto Client\n app = PyTgCalls(client)\n\n @app.on_update(call_filters.stream_end)\n async def handler(client: PyTgCalls, update: Update):\n print(update)\n\n app.run()\n \n \n

PyTgCalls Decorators

\n
\n \n @PyTgCalls.on_update()\n \n \n Decorator for handling all incoming updates.\n When any update is received, this decorator will be triggered.\n \n PARAMETERS\n \n filters: Optional[Filters]\n \n

Example

\n \n from pytgcalls.types import Update\n ...\n app = PyTgCalls(client)\n ...\n @app.on_update()\n async def handler(client: PyTgCalls, update: Update):\n print(chat_id)\n ...\n app.run()\n \n
\n
\n
\n

CustomApi Decorators

\n @CustomApi.on_update_custom_api()\n \n Decorator for handling incoming HTTP events.\n RAISES\n \n exception pytgcalls.exceptions.TooManyCustomApiDecorators\n You have set too many decorators.\n \n

Example

\n \n ...\n webserver = CustomApi(client)\n ...\n @webserver.on_update_custom_api()\n async def handler(request: dict):\n print(update)\n ... # Add Your Code here, switch or etc.\n return {\n 'result': 'OK',\n }\n webserver.start()\n idle()\n \n
\n
","/PyTgCalls/Examples.xml": "\n

Examples

\n \n This page contains example scripts to demonstrate how PyTgCalls looks like.\n\n Every script is working right away (assuming you correctly set up your credentials), meaning you can simply copy-paste them\n and run. The only things you have to modify are session names and target chats, where applicable.\n\n The examples listed below can be treated as building blocks for your own applications and are designed to be simple enough\n to give you a basic idea.\n \n \n \n \n Example\n Description\n \n \n additional_ffmpeg_parameters\n Append parameters to ffmpeg\n \n \n capture_mic\n Capture microphone\n \n \n custom_api\n Use custom API server to bind PHP or other API to PyTgCalls\n \n \n fifo_conversion\n Play a stream from fifo\n \n \n p2p_example\n Play a stream from a private call using PyTgCalls\n \n \n piped_audio_calls\n Play audio using ffmpeg for live conversion (with integrated ffmpeg)\n \n \n piped_image_calls\n Play audio and image using ffmpeg for live conversion (with integrated ffmpeg)\n \n \n raw_streaming\n Play PCM16L and RAW_VIDEO from disk\n \n \n remote_piped_play\n Play a stream from a remote link using ffmpeg for live conversion (with integrated ffmpeg)\n \n \n remote_stream_with_header\n Play a stream from a remote link using ffmpeg for live conversion (with integrated ffmpeg) with additional headers\n \n \n screen_sharing\n Screen sharing\n \n \n screen_sharing_mic\n Screen sharing with microphone\n \n \n simple_calls\n A simple example about using PyTgCalls with High Level Methods\n \n \n telethon_example\n A simple example about using PyTgCalls with Telethon\n \n \n video_calls\n Play audio and video using ffmpeg for live conversion (with integrated ffmpeg)\n \n \n youtube_dl\n Example usage of PyTgCalls with YoutubeDL\n \n
\n
","/PyTgCalls/Filters.xml": "\n

Filters

\n \n Filters are objects that can be used to filter the content of incoming updates.\n Read more about how filters work.\n \n

Details

\n \n pytgcalls.filters.create()\n \n \n Easily create a custom filter.\n\n Custom filters give you extra control over which updates are allowed or not to be processed by your handlers.\n \n
\n PARAMETERS\n \n func: callable\n \n \n A function that accepts three positional arguments (filter, client, update) and returns a boolean: True if the update\n should be handled, False otherwise. The filter argument refers to the filter itself and can be used to access keyword\n arguments (read below). The client argument refers to the Client that received the update. The update argument type will\n vary depending on which Handler is coming from. Your function body can then access the incoming update attributes and decide\n whether to allow it or not.\n \n \n name: Optional[str]\n \n \n Your filter\u2019s name. Can be anything you like. Defaults to \"CustomFilter\".\n \n \n **kwargs: Optional[Any]\n \n \n Any additional keyword arguments you want to pass to your filter function.\n \n \n \n
\n
\n pytgcalls.filters.me()\n \n \n Filter updates for yourself.\n \n \n
\n pytgcalls.filters.stream_end()\n \n \n Filter updates for when a stream ends.\n \n \n
\n pytgcalls.filters.chat()\n \n \n Filter updates coming from one or more chats.\n You can use set bound methods to manipulate the chats container.\n \n
\n PARAMETERS\n \n chats: Union[int, str, list]\n \n \n Pass one or more chat ids/usernames to filter chats. Defaults to None (no chats).\n \n \n \n
\n
\n pytgcalls.filters.chat_update()\n \n \n Filter specific type of chat updates.\n \n
\n PARAMETERS\n \n flags: ChatUpdate.Status\n \n \n Pass one or more flags to filter chat updates.\n \n \n \n
\n pytgcalls.filters.call_participant()\n \n \n Filter updates for when a call participant joins, leaves or is updated.\n \n
\n PARAMETERS\n \n flags: Optional[GroupCallParticipant.Action]\n \n \n Pass one or more flags to filter call participant updates.\n \n \n \n
\n
\n
","/PyTgCalls/Handling Updates.xml": "\n

Handling Updates

\n \n Calling API methods sequentially is cool, but what if, for example, the list of participants changes?\n This page covers updates and how to handle such events in PyTgCalls. Let\u2019s have a look at how they work.\n \n

Defining Updates

\n \n First of all, let's define what these updates are. As hinted earlier, updates are events that happen in PyTgCalls, such as\n joining a group call, changes in the participant list, stream ended etc. They are meant to notify you about a new\n specific state change. These updates are handled by registering one or more callback functions in your app\n using Decorators.\n\n Each handler deals with a specific event. When a matching update arrives from Telegram or NTgCalls, the registered callback\n function will be called back by the framework, and its body will execute.\n \n

Registering a Handler

\n \n To explain how handlers work, let's examine the one that will be in charge of handling StreamVideoEnded\n updates, which occur when a video stream ends. The same setup logic is shared with every type of handler, and you should not\n have troubles settings them up once you have learned from this section.\n \n

Using Decorators

\n The most elegant way to register a stream end handler is by using the on_stream_end() decorator:\n \n from pytgcalls import PyTgCalls, filters\n from pytgcalls.types import Update\n from pytgcalls.types import MediaStream\n ...\n app = PyTgCalls(client)\n\n @app.on_update(filters.stream_end)\n async def my_handler(client: PyTgCalls, update: Update):\n if isinstance(update, StreamVideoEnded):\n await pytgcalls.play(\n -1001185324811,\n stream=MediaStream(\n 'http://docs.evostream.com/sample_content/assets/sintel1m720p.mp4',\n )\n )\n\n app.run()\n \n \n The defined my_handler function, which accepts two arguments (client, update),\n will be executed whenever a new update arrives.\n \n \n You can mix def and async def handlers as much as you need,\n PyTgCalls will still work concurrently and efficiently regardless of what you choose.\n \n
","/PyTgCalls/Install Guide.xml": "\n

Install Guide

\n \n Being a modern Python library, PyTgCalls requires Python 3.8+ to be installed in your system.\n We recommend using the latest versions of both Python 3 and pip.\n \n \n Get Python 3 from the Python website or use your package manager.\n Get pip by following the instructions here.\n \n PyTgCalls only supports Python 3, starting from version 3.8.\n \n

Install PyTgCalls

\n The easiest way to install and upgrade PyTgCalls to its latest stable version is by using pip:\n \n $ pip3 install -U py-tgcalls\n \n

Bleeding Edge

\n \n PyTgCalls is always evolving: although new releases on PyPI are only published when a significant number of changes are added,\n this doesn\u2019t mean you can\u2019t try new features right now!\n\n In case you\u2019d like to try out the latest PyTgCalls\u2019 features, the GitHub repo is constantly updated with new changes;\n you can install the development version straight from the master branch using this command (note \u201cmaster.zip\u201d in the link):\n \n \n $ pip3 install -U git+https://github.com/pytgcalls/pytgcalls\n \n

Verifying

\n To verify that PyTgCalls is correctly installed, open a Python shell and import it. If no errors show up you are good to go.\n \n >>> import pytgcalls\n >>> pytgcalls.__version__\n ''\n \n
","/PyTgCalls/Media Devices.xml": "\n

Media Devices

\n \n This class offers methods to access information regarding media devices available on your system.\n This functionality proves valuable when you intend to stream content from either your screen or microphone.\n \n

Example

\n \n from pytgcalls import Client\n from pytgcalls import idle\n from pytgcalls.media_devices import MediaDevices\n ...\n\n app = PyTgCalls(client)\n app.start()\n\n ... # Call API methods\n\n app.play(\n -1001185324811,\n MediaStream(\n MediaDevices.get_audio_devices()[0],\n )\n )\n\n idle()\n \n \n

Details

\n \n \n class pytgcalls.MediaDevices\n \n \n MediaDevices, the main tool for retrieving media devices list.\n
\n \n METHODS\n \n get_audio_devices() -> list[pytgcalls.DeviceInfo]\n Retrieve a list of available audio input devices.\n\n get_screen_devices() -> list[pytgcalls.ScreenInfo]\n Retrieve a list of available screen devices\n \n \n
\n
\n
","/PyTgCalls/Quick Start.xml": "\n

Quick Start

\n The next few steps serve as a quick start for all new Pythoneers that want to see PyTgCalls in action as quickly as possible. Let\u2019s go!\n

Get PyTgCalls Real Fast

\n \n Install PyTgCalls with pip3 install -U py-tgcalls.\n \n Choose your MTProto client between PyrogramMod (ex Pyrogram),\n Telethon or Hydrogram.\n \n Get your own Telegram API key from my.telegram.org\n \n Open your favorite text editor and use the following:\n \n from pytgcalls import PyTgCalls\n from pytgcalls import idle\n from pytgcalls.types import MediaStream\n ...\n chat_id = -1001185324811\n app = PyTgCalls(client)\n app.start()\n app.play(\n chat_id,\n MediaStream(\n 'http://docs.evostream.com/sample_content/assets/sintel1m720p.mp4',\n )\n )\n idle()\n \n \n Replace client and chat_id values with your own.\n Save the file as main.py.\n Watch PyTgCalls playing the audio file.\n Join our community.\n \n

Enjoy the API

\n \n That was just a brief overview that barely scratched the surface!\n In the following few pages of the introduction,\n we\u2019ll have a much more in-depth look at what we have just done.\n\n Are you feeling eager to continue?\n You can take a shortcut to Call Methods and return later to learn more details.\n \n
","/PyTgCalls/Stream Descriptors/AudioParameters.xml": "\n

AudioParameters

\n
\n \n class pytgcalls.types.raw.AudioParameters\n \n \n \n
\n PARAMETERS\n \n bitrate: int\n \n\n channels: int\n \n \n
\n STATIC METHODS\n \n from_quality(quality: pytgcalls.types.AudioQuality)\n \n \n \n This method was deprecated on PyTgCalls 1.2.X, use directly\n pytgcalls.types.AudioQuality in MediaStream instead\n \n \n Create an AudioParameters instance from an AudioQuality enumeration.\n \n \n
\n
","/PyTgCalls/Stream Descriptors/AudioStream.xml": "\n

AudioStream

\n \n This class replaces the deprecated pytgcalls.types.raw.InputAudioStream.\n \n \n class pytgcalls.types.raw.AudioStream\n \n \n The raw audio stream (PCM16L) descriptor\n
\n PARAMETERS\n \n \n\n path: str\n The audio file path or shell command (PCM16L format only).\n\n parameters: pytgcalls.types.raw.AudioParameters\n \n \n
\n
","/PyTgCalls/Stream Descriptors/MediaStream.xml": "\n

MediaStream

\n
\n \n class pytgcalls.types.MediaStream\n \n \n The media stream piped descriptor.\n
\n PARAMETERS\n \n media_path: Union[str, ScreenInfo, DeviceInfo]\n The audio, video or media device path.\n\n \n \n\n audio_path: Optional[Union[str, DeviceInfo]]\n The audio or input audio device path.\n\n audio_flags: Optional[Flags]\n \n \n Flag used to control the handling of the audio stream in the media. It allows the system to decide whether to automatically detect, ignore, or require the audio stream.\n \n \n\n video_flags: Optional[Flags]\n \n \n Flag used to control the handling of the video stream in the media. It allows the system to decide whether to automatically detect, ignore, or require the video stream.\n \n \n\n \n ffmpeg_parameters: Optional[str]\n FFmpeg additional parameters.\n ytdlp_parameters: Optional[str]\n yt-dlp additional parameters.\n \n
\n
","/PyTgCalls/Stream Descriptors/Stream.xml": "\n

Stream

\n \n This class replaces the deprecated pytgcalls.types.InputStream.\n \n \n class pytgcalls.types.Stream\n \n \n Stream Descriptor.\n
\n PARAMETERS\n \n stream_audio: pytgcalls.types.raw.AudioStream\n Audio Stream Descriptor.\n\n stream_video: pytgcalls.types.raw.VideoStream\n Video Stream Descriptor.\n \n
\n
","/PyTgCalls/Stream Descriptors/VideoParameters.xml": "\n

VideoParameters

\n
\n \n class pytgcalls.types.raw.VideoParameters\n \n \n Stream\u2019s video parameters.\n
\n PARAMETERS\n \n \n\n frame_rate: int\n \n \n
\n STATIC METHODS\n \n from_quality(quality: pytgcalls.types.VideoQuality)\n \n \n \n This method was deprecated on PyTgCalls 1.2.X, use directly\n pytgcalls.types.VideoQuality in MediaStream instead\n \n \n Create an VideoParameters instance from an VideoQuality enumeration.\n \n \n
\n
","/PyTgCalls/Stream Descriptors/VideoStream.xml": "\n

VideoStream

\n \n This class replaces the deprecated pytgcalls.types.InputVideoStream.\n \n \n class pytgcalls.types.raw.VideoStream\n \n \n The raw video stream (YUV420P) descriptor\n
\n PARAMETERS\n \n \n\n path: str\n The video file path or shell command (YUV420P format only).\n\n parameters : pytgcalls.types.raw.VideoParameters\n \n \n
\n
","/PyTgCalls/Stream Methods/Mute Stream.xml": "\n

Mute Stream

\n This method allows muting the userbot via MTProto APIs.\n

Example

\n \n from pytgcalls import Client\n from pytgcalls import idle\n ...\n\n app = PyTgCalls(client)\n app.start()\n\n ... # Call API methods\n\n app.mute_stream(\n -1001185324811,\n )\n\n idle()\n \n \n

Details

\n \n PyTgCalls.mute_stream() -> bool\n \n \n Mute the userbot\n
\n \n PARAMETERS\n \n \n \n \n
\n \n RAISES\n \n \n \n \n
\n
","/PyTgCalls/Stream Methods/Pause Stream.xml": "\n

Pause Stream

\n This method allows pausing the streaming file.\n

Example

\n \n from pytgcalls import Client\n from pytgcalls import idle\n ...\n\n app = PyTgCalls(client)\n app.start()\n\n ... # Call API methods\n\n app.pause_stream(\n -1001185324811,\n )\n\n idle()\n \n \n

Details

\n \n PyTgCalls.pause_stream() -> bool\n \n \n Pause the stream\n
\n \n PARAMETERS\n \n \n \n \n
\n \n RAISES\n \n \n \n \n
\n
","/PyTgCalls/Stream Methods/Played Time.xml": "\n

Played Time

\n \n

Example

\n \n from pytgcalls import Client\n from pytgcalls import idle\n ...\n\n app = PyTgCalls(client)\n app.start()\n\n ... # Call API methods\n\n print(\n app.played_time(\n -1001185324811,\n )\n )\n\n idle()\n \n \n

Details

\n \n PyTgCalls.played_time() -> int\n \n \n \n
\n \n PARAMETERS\n \n \n \n \n
\n \n RAISES\n \n \n \n \n
\n
","/PyTgCalls/Stream Methods/Resume Stream.xml": "\n

Resume Stream

\n This method allows resuming the streaming file.\n

Example

\n \n from pytgcalls import Client\n from pytgcalls import idle\n ...\n\n app = PyTgCalls(client)\n app.start()\n\n ... # Call API methods\n\n app.resume_stream(\n -1001185324811,\n )\n\n idle()\n \n \n

Details

\n \n PyTgCalls.resume_stream() -> bool\n \n \n Resume the stream\n
\n \n PARAMETERS\n \n \n \n \n
\n \n RAISES\n \n \n \n \n
\n
","/PyTgCalls/Stream Methods/UnMute Stream.xml": "\n

UnMute Stream

\n This method allows unmuting the userbot via MTProto APIs\n

Example

\n \n from pytgcalls import Client\n from pytgcalls import idle\n ...\n\n app = PyTgCalls(client)\n app.start()\n\n ... # Call API methods\n\n app.unmute_stream(\n -1001185324811,\n )\n\n idle()\n \n \n

Details

\n \n PyTgCalls.unmute_stream() -> bool\n \n \n UnMute the userbot\n
\n \n PARAMETERS\n \n \n \n \n
\n \n RAISES\n \n \n \n \n
\n
","/PyTgCalls/Using Filters.xml": "\n

Using Filters

\n \n So far we\u2019ve seen how to register a decorator function that executes every time an update comes from the server,\n but there\u2019s much more than that to come.\n\n Here we\u2019ll discuss filters. Filters enable a fine-grain control over what kind of updates are allowed or\n not to be passed in your callback functions, based on their inner details.\n \n \n

Single Filters

\n Let\u2019s start right away with a simple example:\n \n \n \n This example will show you how to only handle updates that are an Incoming Call\n and ignore any other update. Filters are passed as the first argument of the decorator:\n \n from pytgcalls import filters\n from pytgcalls.types import ChatUpdate\n ...\n @pytgcalls.on_update(filters.chat_update(ChatUpdate.Status.INCOMING_CALL))\n def on_incoming_call(client, update):\n print(\"Incoming call!\", update)\n \n \n \n \n

Combining Filters

\n \n Filters can be used in a more advanced way by inverting and combining more filters together using bitwise operators ~, & and |:\n \n \n Use ~ to invert a filter (behaves like the not operator).\n \n \n Use & and | to combine filters together (behaves like the and and or operators).\n \n \n Here are some examples:\n \n \n \n This example will show you how to only handle updates that are left updates from a specific chat and ignore any other update:\n \n from pytgcalls import filters\n from pytgcalls.types import ChatUpdate\n ...\n @pytgcalls.on_update(~filters.chat_update(ChatUpdate.Status.LEFT_GROUP) & filters.chat(1234567890))\n def on_incoming_voice_call(client, update):\n print(\"Left chat!\", update)\n \n \n \n \n \n This example will show you how to only handle updates that are left updates or incoming call updates and from a specific chat:\n \n from pytgcalls import filters\n from pytgcalls.types import ChatUpdate\n ...\n @pytgcalls.on_update(filters.chat(1234567890) & (filters.chat_update(ChatUpdate.Status.LEFT_GROUP) | filters.chat_update(ChatUpdate.Status.INCOMING_CALL)))\n def on_incoming_voice_call(client, update):\n print(\"Incoming voice call or left chat!\", update)\n \n \n \n \n \n
"} +{"/NTgCalls/Advanced Methods/Get State.xml": "\n

Get State

\n \n

Example

\n \n from ntgcalls import NTgCalls\n ...\n\n app = NTgCalls()\n ...\n\n state = app.get_state(\n -1001185324811,\n )\n \n \n

Details

\n \n get_state() -> ntgcalls.MediaState\n \n \n \n
\n \n PARAMETERS\n \n \n \n \n
\n \n RAISES\n \n \n \n \n
\n
","/NTgCalls/Advanced Methods/ntg_calls.xml": "\n

ntg_calls

\n \n This function returns a list of ntg_call_struct instances,\n each containing information about an active group call associated with the channel or group.\n You should provide a buffer as an array of ntg_call_struct\n elements with a size matching the value returned by ntg_calls_count.\n The function populates this list with data for active group calls and returns the number of group calls retrieved.\n \n

Example

\n \n #include <stdint.h>\n #include \"ntgcalls.h\"\n\n int main() {\n uint32_t uid = ntg_init();\n ...\n int size = ... ; // Get the size of the call list\n ntg_call_struct buffer[size];\n ntg_async_struct future;\n // Initialize the async struct\n int result = ntg_calls(uid, buffer, size, &future);\n // Wait for the async operation to complete\n for (int i = 0; i < result; i++) {\n printf(\"Group Call %d:\\n\", i + 1);\n printf(\" Chat ID: %lld\\n\", buffer[i].chatId);\n printf(\" Status: %d\\n\", buffer[i].status);\n }\n ... // Your Code Here\n return 0;\n }\n \n \n

Details

\n \n int ntg_calls()\n \n \n \n
\n \n PARAMETERS\n \n \n\n ntg_call_struct* buffer\n The buffer that will hold the retrieved group call information.\n\n \n \n \n \n
\n \n ERROR CODES\n \n \n \n
\n ASYNC ERROR CODES\n \n \n \n \n
\n
\n
","/NTgCalls/Advanced Methods/ntg_calls_count.xml": "\n

ntg_calls_count

\n \n This function returns the number of active group calls that NTgCalls is connected to.\n \n

Example

\n \n #include <stdint.h>\n #include \"ntgcalls.h\"\n\n int main() {\n uint32_t uid = ntg_init();\n ...\n int64_t chatID = ...; // Obtain the chat ID\n int count = 0;\n ntg_async_struct future;\n // Initialize the async struct\n int result = ntg_calls_count(uid, &count, &future);\n // Wait for the async operation to complete\n printf(\"Number of active group calls: %d\\n\", count);\n ... // Your Code Here\n return 0;\n }\n \n \n

Details

\n \n int ntg_calls_count()\n \n \n Returns the number of active group calls.\n
\n \n PARAMETERS\n \n \n int* count\n The number of active group calls.\n \n \n \n
\n \n ERROR CODES\n \n \n \n
\n ASYNC ERROR CODES\n \n \n \n
\n
\n
","/NTgCalls/Advanced Methods/ntg_cpu_usage.xml": "\n

ntg_cpu_usage

\n \n

Example

\n \n #include <stdint.h>\n #include \"ntgcalls.h\"\n\n int main() {\n uint32_t uid = ntg_init();\n ...\n double buffer;\n ntg_async_struct future;\n // Initialize the async struct\n int64_t usage = ntg_cpu_usage(uid, &buffer, &future);\n // Wait for the async operation to complete and use\n return 0;\n }\n \n \n

Details

\n \n int ntg_cpu_usage()\n \n \n \n
\n \n PARAMETERS\n \n \n double* cpuUsage\n \n \n \n \n
\n
","/NTgCalls/Advanced Methods/ntg_get_protocol.xml": "\n

ntg_get_protocol

\n \n

Example

\n \n #include <stdint.h>\n #include \"ntgcalls.h\"\n\n int main() {\n uint32_t uid = ntg_init();\n ...\n int64_t chatID = ...; // Obtain the chat ID\n ntg_protocol_struct buffer;\n int result = ntg_get_protocol(uid, chatID, &buffer);\n ...\n return 0;\n }\n \n \n

Details

\n \n int ntg_get_protocol()\n \n \n \n
\n \n PARAMETERS\n \n \n \n\n ntg_protocol_struct* protocol\n \n \n \n
\n \n ERROR CODES\n \n \n \n \n
\n
","/NTgCalls/Advanced Methods/ntg_get_state.xml": "\n

ntg_get_state

\n \n

Example

\n \n #include <stdint.h>\n #include \"ntgcalls.h\"\n\n int main() {\n uint32_t uid = ntg_init();\n ...\n int64_t chatID = ...; // Obtain the chat ID\n ntg_media_state_struct buffer;\n ntg_async_struct future;\n // Initialize the async struct\n int result = ntg_get_state(uid, chatID, &buffer, &future);\n // Wait for the async operation to complete and use\n // the buffer for EditGroupCallParticipant\n ...\n return 0;\n }\n \n \n

Details

\n \n int ntg_get_state()\n \n \n \n
\n \n PARAMETERS\n \n \n \n\n ntg_media_state_struct* mediaState\n \n\n \n \n \n
\n \n ERROR CODES\n \n \n \n
\n ASYNC ERROR CODES\n \n \n \n
\n
\n
","/NTgCalls/Advanced Methods/ntg_send_signaling_data.xml": "\n

ntg_send_signaling_data

\n \n

Example

\n \n #include <stdint.h>\n #include \"ntgcalls.h\"\n\n int main() {\n uint32_t uid = ntg_init();\n ...\n int64_t chatID = ...; // Obtain the chat ID\n uint8_t* buffer = ...; // Obtain the signaling data\n int size = ...; // Obtain the size of the signaling data\n ntg_async_struct future;\n // Initialize the async struct\n int result = ntg_send_signaling_data(uid, chatID, buffer, size, &future);\n // Wait for the async operation to complete\n return 0;\n }\n \n \n

Details

\n \n int ntg_send_signaling_data()\n \n \n \n
\n \n PARAMETERS\n \n \n \n\n uint8_t* data\n \n int size\n Size of the data\n \n \n \n
\n \n ERROR CODES\n \n \n \n
\n ASYNC ERROR CODES\n \n \n \n
\n
\n
","/NTgCalls/Available Enums/ConnectionState.xml": "\n

ConnectionState

\n
\n \n class ConnectionState\n \n \n \n
\n ENUMERATION MEMBERS\n \n CONNECTING = 1\n \n CONNECTED = 2\n \n TIMEOUT = 4\n \n FAILED = 8\n \n CLOSED = 12\n \n \n
\n
","/NTgCalls/Available Enums/InputMode.xml": "\n

InputMode

\n
\n \n class ntgcalls.InputMode\n \n \n \n
\n ENUMERATION MEMBERS\n \n FILE = 1\n \n\n SHELL = 2\n \n\n FFMPEG = 4\n \n\n NO_LATENCY = 8\n \n \n
\n
","/NTgCalls/Available Enums/StreamStatus.xml": "\n

StreamStatus

\n
\n \n class ntgcalls.StreamStatus\n \n \n \n
\n ENUMERATION MEMBERS\n \n PLAYING = 0\n \n\n PAUSED = 1\n \n\n IDLING = 2\n \n \n
\n
","/NTgCalls/Available Enums/StreamType.xml": "\n

StreamType

\n
\n \n class ntgcalls.StreamType\n \n \n \n
\n ENUMERATION MEMBERS\n \n AUDIO = 0\n \n\n VIDEO = 1\n \n \n
\n
","/NTgCalls/Available Enums/ntg_connection_state_enum.xml": "\n

ntg_connection_state_enum

\n
\n \n typedef enum ntg_connection_state_enum\n \n \n \n
\n ENUMERATION MEMBERS\n \n NTG_STATE_CONNECTING = 1\n \n\n NTG_STATE_CONNECTED = 2\n \n\n NTG_STATE_TIMEOUT = 4\n \n\n NTG_STATE_FAILED = 8\n \n\n NTG_STATE_CLOSED = 12\n \n \n
\n
","/NTgCalls/Available Enums/ntg_input_mode_enum.xml": "\n

ntg_input_mode_enum

\n
\n \n typedef enum ntg_input_mode_enum\n \n \n \n
\n ENUMERATION MEMBERS\n \n NTG_FILE = 0\n \n\n NTG_SHELL = 1\n \n\n NTG_FFMPEG = 2\n \n\n NTG_NO_LATENCY = 3\n \n \n
\n
","/NTgCalls/Available Enums/ntg_log_level_enum.xml": "\n

ntg_log_level_enum

\n
\n \n typedef enum ntg_log_level_enum\n \n \n \n
\n ENUMERATION MEMBERS\n \n NTG_LOG_DEBUG = 1\n \n\n NTG_LOG_INFO = 2\n \n\n NTG_LOG_WARNING = 4\n \n\n NTG_LOG_ERROR = 8\n \n\n NTG_LOG_UNKNOWN = -1\n \n \n
\n
","/NTgCalls/Available Enums/ntg_log_source_enum.xml": "\n

ntg_log_source_enum

\n
\n \n typedef enum ntg_log_source_enum\n \n \n \n
\n ENUMERATION MEMBERS\n \n NTG_LOG_WEBRTC = 1\n \n\n NTG_LOG_SELF = 2\n \n \n
\n
","/NTgCalls/Available Enums/ntg_stream_status_enum.xml": "\n

ntg_stream_status_enum

\n
\n \n typedef enum ntg_stream_status_enum\n \n \n \n
\n ENUMERATION MEMBERS\n \n NTG_PLAYING = 1\n \n\n NTG_PAUSED = 2\n \n\n NTG_IDLING = 4\n \n \n
\n
","/NTgCalls/Available Enums/ntg_stream_type_enum.xml": "\n

ntg_stream_type_enum

\n
\n \n typedef enum ntg_stream_type_enum\n \n \n \n
\n ENUMERATION MEMBERS\n \n NTG_STREAM_AUDIO = 0\n \n\n NTG_STREAM_VIDEO = 1\n \n \n
\n
","/NTgCalls/Available Structs/ntg_audio_description_struct.xml": "\n

ntg_audio_description_struct

\n
\n \n typedef struct ntg_audio_description_struct\n \n \n \n
\n PARAMETERS\n \n \n \n\n uint32_t sampleRate\n \n\n uint8_t bitsPerSample\n \n\n uint8_t channelCount\n \n \n
\n
","/NTgCalls/Available Structs/ntg_auth_params_struct.xml": "\n

ntg_auth_params_struct

\n
\n \n typedef struct ntg_auth_params_struct\n \n \n \n
\n PROPERTIES\n \n uint8_t* g_a_or_b\n \n int sizeGAB\n Size of the parameter for key exchange\n int64_t key_fingerprint\n \n \n
\n
","/NTgCalls/Available Structs/ntg_call_struct.xml": "\n

ntg_call_struct

\n
\n \n typedef struct ntg_call_struct\n \n \n \n
\n PROPERTIES\n \n int64_t chatID\n \n\n ntg_stream_status_enum status\n \n \n
\n
","/NTgCalls/Available Structs/ntg_dh_config_struct.xml": "\n

ntg_dh_config_struct

\n
\n \n typedef struct ntg_dh_config_struct\n \n \n \n
\n PROPERTIES\n \n int32_t g\n \n uint8_t* p\n \n int sizeP\n Size of the parameter for key exchange\n uint8_t* random\n \n int sizeRandom\n Size of the random number\n \n
\n
","/NTgCalls/Available Structs/ntg_log_message_struct.xml": "\n

ntg_log_message_struct

\n
\n \n typedef struct ntg_log_message_struct\n \n \n \n
\n PROPERTIES\n \n ntg_log_level_enum level\n \n ntg_log_source_enum source\n \n char* file\n \n uint32_t line\n \n char* message\n \n \n
\n
","/NTgCalls/Available Structs/ntg_media_description_struct.xml": "\n

ntg_media_description_struct

\n
\n \n typedef struct ntg_media_description_struct\n \n \n \n
\n PARAMETERS\n \n ntg_audio_description_struct* audio\n \n\n ntg_video_description_struct* video\n \n \n
\n
","/NTgCalls/Available Structs/ntg_media_state_struct.xml": "\n

ntg_media_state_struct

\n
\n \n typedef struct ntg_media_state_struct\n \n \n \n
\n PROPERTIES\n \n bool muted\n \n\n bool videoPaused\n \n\n bool videoStopped\n \n \n
\n
","/NTgCalls/Available Structs/ntg_protocol_struct.xml": "\n

ntg_protocol_struct

\n
\n \n typedef struct ntg_protocol_struct\n \n \n \n
\n PROPERTIES\n int32_t minLayer\n \n int32_t maxLayer\n \n bool udpP2P\n \n bool udpReflector\n \n char** libraryVersions\n \n int libraryVersionsSize\n Size of the libraryVersions array.\n
\n
","/NTgCalls/Available Structs/ntg_rtc_server_struct.xml": "\n

ntg_rtc_server_struct

\n
\n \n typedef struct ntg_rtc_server_struct\n \n \n \n
\n PROPERTIES\n \n uint64_t id\n \n char* ipv4\n \n char* ipv6\n \n char* username\n \n char* password\n \n int port\n \n bool turn\n \n bool stun\n \n bool tcp\n \n uint8_t* peerTag\n \n int sizePeerTag\n Size of the peer tag\n \n
\n
","/NTgCalls/Available Structs/ntg_video_description_struct.xml": "\n

ntg_video_description_struct

\n
\n \n typedef struct ntg_video_description_struct\n \n \n \n
\n PARAMETERS\n \n \n \n\n uint16_t width\n \n\n uint16_t height\n \n\n uint8_t fps\n \n \n
\n
","/NTgCalls/Available Types/AudioDescription.xml": "\n

AudioDescription

\n
\n \n class ntgcalls.types.AudioDescription\n \n \n \n
\n PARAMETERS\n \n \n\n \n\n sample_rate: int\n \n\n bits_per_sample: int\n \n\n channel_count: int\n \n \n
\n
","/NTgCalls/Available Types/AuthParams.xml": "\n

AuthParams

\n
\n \n class ntgcalls.AuthParams\n \n \n \n
\n PROPERTIES\n \n g_a_or_b: bytes\n \n key_fingerprint: int\n \n \n
\n
","/NTgCalls/Available Types/DhConfig.xml": "\n

DhConfig

\n
\n \n class ntgcalls.DhConfig\n \n \n \n
\n PARAMETERS\n \n g: int\n \n p: bytes\n \n random: bytes\n \n \n
\n
","/NTgCalls/Available Types/MediaDescription.xml": "\n

MediaDescription

\n
\n \n class ntgcalls.types.MediaDescription\n \n \n \n
\n PARAMETERS\n \n audio: Optional[ntgcalls.AudioDescription]\n \n\n video: Optional[ntgcalls.VideoDescription]\n \n \n
\n
","/NTgCalls/Available Types/MediaState.xml": "\n

MediaState

\n
\n \n class ntgcalls.MediaState\n \n \n \n
\n PROPERTIES\n \n muted -> bool\n \n\n video_paused -> bool\n \n\n video_stopped -> bool\n \n \n
\n
","/NTgCalls/Available Types/Protocol.xml": "\n

Protocol

\n
\n \n typedef enum Protocol\n \n \n \n
\n PROPERTIES\n \n min_layer: int\n \n max_layer: int\n \n udp_p2p: bool\n \n udp_reflector: bool\n \n library_versions: list[str]\n \n \n
\n
","/NTgCalls/Available Types/RTCServer.xml": "\n

RTCServer

\n
\n \n class ntgcalls.RTCServer\n \n \n \n
\n PROPERTIES\n \n id: int\n \n ipv4: str\n \n ipv6: str\n \n username: Optional[str]\n \n password: Optional[str]\n \n port: int\n \n turn: bool\n \n stun: bool\n \n tcp: bool\n \n peer_tag: Optional[bytes]\n \n \n
\n
","/NTgCalls/Available Types/VideoDescription.xml": "\n

VideoDescription

\n
\n \n class ntgcalls.types.VideoDescription\n \n \n \n
\n PARAMETERS\n \n \n\n \n\n \n\n fps: int\n \n \n
\n
","/NTgCalls/Basic Methods/Connect P2P.xml": "\n \n

Connect P2P

\n \n

Example

\n \n from ntgcalls import NTgCalls\n ...\n\n app = NTgCalls()\n rtc_servers = ... # Obtain the RTC servers\n dh_config = ... # Obtain the DH configuration\n versions = ... # Obtain the library versions\n p2p_allowed = ... # Obtain whether P2P is allowed\n await app.connect_p2p(\n -1001185324811,\n rtc_servers,\n versions,\n p2p_allowed\n )\n \n \n

Details

\n \n async NTgCalls.connect_p2p()\n \n \n \n
\n \n PARAMETERS\n \n \n rtc_servers: list[RTCServer]\n \n versions: list[str]\n \n p2p_allowed: bool\n \n \n \n
\n \n RAISES\n \n \n \n exception ntgcalls.SignalingError\n \n exception ntgcalls.SignalingUnsupported\n \n \n \n
\n
","/NTgCalls/Basic Methods/Connect.xml": "\n

Connect

\n \n

Example

\n \n from ntgcalls import NTgCalls\n ...\n\n app = NTgCalls()\n ...\n tg_params = ...\n\n await app.connect(\n -1001185324811,\n tg_params,\n )\n \n \n

Details

\n \n async NTgCalls.connect()\n \n \n \n
\n \n PARAMETERS\n \n \n params: str\n \n \n \n
\n \n RAISES\n \n exception ntgcalls.ConnectionError\n \n \n This error occurs when attempting to execute an action on a non-existent Group Call.\n \n \n \n \n exception ntgcalls.InvalidParams\n This error occurs when attempting to send invalid Transports.\n \n \n
\n
","/NTgCalls/Basic Methods/Create Call.xml": "\n

Create Call

\n \n

Example

\n \n from ntgcalls import NTgCalls\n ...\n\n app = NTgCalls()\n\n params = await app.create_call(\n -1001185324811,\n MediaDescription(\n AudioDescription(\n input_mode=InputMode.File,\n input=\"audio.pcm\",\n sample_rate=96000,\n bits_per_sample=16,\n channel_count=2,\n ),\n )\n )\n \n \n

Details

\n \n async NTgCalls.create_call() -> str\n \n \n \n
\n \n PARAMETERS\n \n \n \n \n \n
\n \n RAISES\n \n exception ntgcalls.ConnectionError\n You are attempting to init an already existent Group Call.\n \n \n \n
\n
","/NTgCalls/Basic Methods/Create P2P Call.xml": "\n \n

Create P2P Call

\n \n

Example

\n \n from ntgcalls import NTgCalls\n ...\n app = NTgCalls()\n dh_config = ... # Obtain the DH configuration\n g_a_hash = ... # Parameter for key exchange (Only when is incoming call)\n params = await app.create_p2p_call(\n -1001185324811,\n config,\n g_a_hash,\n MediaDescription(\n AudioDescription(\n input_mode=InputMode.File,\n input=\"audio.pcm\",\n sample_rate=96000,\n bits_per_sample=16,\n channel_count=2,\n ),\n )\n )\n \n \n

Details

\n \n async NTgCalls.create_p2p_call() -> bytes\n \n \n \n
\n \n PARAMETERS\n \n \n config: DhConfig\n \n g_a_hash: Optional[bytes]\n \n \n \n \n
\n \n RAISES\n \n \n \n \n \n
\n
","/NTgCalls/Basic Methods/Exchange Keys.xml": "\n \n

Exchange Keys

\n \n

Example

\n \n from ntgcalls import NTgCalls\n ...\n\n app = NTgCalls()\n g_a_or_b = ... # Obtain the parameter for key exchange\n fingerprint = ... # Obtain the fingerprint (Optional for outgoing calls)\n params = await app.exchange_keys(\n -1001185324811,\n g_a_or_b,\n fingerprint\n )\n \n \n

Details

\n \n async NTgCalls.exchange_keys() -> AuthParams\n \n \n \n
\n \n PARAMETERS\n \n \n g_a_or_b: bytes\n \n fingerprint: int\n \n \n \n
\n \n RAISES\n \n \n \n exception ntgcalls.InvalidParams\n \n \n \n
\n
","/NTgCalls/Basic Methods/Stop.xml": "\n

Stop

\n \n

Example

\n \n from ntgcalls import NTgCalls\n ...\n\n app = NTgCalls()\n ...\n\n await app.stop(\n -1001185324811,\n )\n \n \n

Details

\n \n async NTgCalls.stop()\n \n \n \n
\n \n PARAMETERS\n \n \n \n \n
\n \n RAISES\n \n \n \n \n
\n
","/NTgCalls/Basic Methods/ntg_connect.xml": "\n

ntg_connect

\n \n

Example

\n \n #include <stdint.h>\n #include \"ntgcalls.h\"\n\n int main() {\n uint32_t uid = ntg_init();\n ...\n int64_t chatID = ...; // Obtain the chat ID\n char* params = ...; // Obtain connection parameters\n ntg_async_struct future;\n // Initialize the async struct\n int result = ntg_connect(uid, chatID, params, &future);\n // Wait for the async operation to complete\n ...\n return 0;\n }\n \n \n

Details

\n \n int ntg_connect()\n \n \n \n
\n \n PARAMETERS\n \n \n \n\n char* params\n \n \n \n \n
\n \n ERROR CODES\n \n \n \n
\n ASYNC ERROR CODES\n \n \n\n #NTG_RTMP_NEEDED -300\n This error occurs when attempting to join a group call that requires an RTMP transport.\n\n \n\n #NTG_CONNECTION_FAILED -302\n The connection to WebRTC failed.\n \n
\n
\n
","/NTgCalls/Basic Methods/ntg_connect_p2p.xml": "\n \n

ntg_connect_p2p

\n \n

Example

\n \n #include <stdint.h>\n #include \"ntgcalls.h\"\n\n int main() {\n uint32_t uid = ntg_init();\n ...\n int64_t chatID = ...; // Obtain the chat ID\n ntg_rtc_server_struct* rtcServers = ...; // Obtain the RTC servers\n int rtcServersCount = ...; // Obtain the count of RTC servers\n char** libraryVersions = ...; // Obtain the library versions\n int libraryVersionCount = ...; // Obtain the count of library versions\n bool p2pAllowed = ...; // Obtain whether P2P is allowed\n ntg_async_struct future;\n // Initialize the async struct\n int result = ntg_connect_p2p(\n uid,\n chatID,\n rtcServers,\n rtcServersCount,\n libraryVersions,\n libraryVersionCount,\n p2pAllowed,\n &future\n );\n // Wait for the async operation to complete\n }\n \n \n

Details

\n \n int ntg_connect_p2p()\n \n \n \n
\n \n PARAMETERS\n \n \n \n ntg_rtc_server_struct* servers\n \n int serversSize\n Count of list of endpoints\n char** versions\n \n int versionsSize\n Size of the versions array.\n bool p2pAllowed\n \n \n \n \n
\n \n ERROR CODES\n \n \n \n
\n ASYNC ERROR CODES\n \n \n \n \n #NTG_SIGNALING_ERROR -104\n \n #NTG_SIGNALING_UNSUPPORTED -105\n \n \n \n
\n
\n
","/NTgCalls/Basic Methods/ntg_create.xml": "\n

ntg_get_params

\n \n

Example

\n \n #include <stdint.h>\n #include \"ntgcalls.h\"\n\n int main() {\n uint32_t uid = ntg_init();\n ...\n int64_t chatID = ...; // Obtain the chat ID\n ntg_media_description_struct desc = {\n // Fill in media description fields\n };\n char buffer[512];\n ntg_async_struct future;\n // Initialize the async struct\n int result = ntg_create(uid, chatID, desc, buffer, sizeof(buffer));\n // Wait for the async operation to complete and\n // use 'buffer' for JoinGroupCall\n return 0;\n }\n \n \n

Details

\n \n int ntg_get_params()\n \n \n \n
\n \n PARAMETERS\n \n \n \n \n\n char* buffer\n \n \n A string buffer to store the connection parameters retrieved from WebRTC.\n These parameters can be used for JoinGroupCall.\n \n \n\n \n \n \n \n
\n \n ERROR CODES\n \n \n \n
\n ASYNC ERROR CODES\n \n \n \n \n \n \n
\n
\n
","/NTgCalls/Basic Methods/ntg_create_p2p.xml": "\n \n

ntg_create_p2p

\n \n

Example

\n \n #include <stdint.h>\n #include \"ntgcalls.h\"\n\n int main() {\n uint32_t uid = ntg_init();\n ...\n int64_t chatID = ...; // Obtain the chat ID\n ntg_dh_config_struct dhConfig = ...; // Obtain the DH configuration\n uint8_t* g_a_hash = ...; // Parameter for key exchange (Only when is incoming call)\n int sizeG_A_Hash = ...; // Size of the parameter for key exchange (Only when is incoming call)\n ntg_media_description_struct desc = {\n // Fill in media description fields\n };\n uint8_t* buffer[32];\n ntg_async_struct future;\n // Initialize the async struct\n int result = ntg_create_p2p(\n uid,\n chatID,\n &dhConfig,\n g_a_hash,\n sizeG_A_Hash,\n desc,\n buffer,\n sizeof(buffer),\n &future\n );\n // Wait for the async operation to complete and\n // use 'buffer' for PhoneRequestCall or AcceptCall with Protocol\n return 0;\n }\n \n \n

Details

\n \n int ntg_create_p2p()\n \n \n \n
\n \n PARAMETERS\n \n \n \n ntg_dh_config_struct* dhConfig\n \n uint8_t* g_a_hash\n \n int sizeGAHash\n Size of the parameter for key exchange (Only when is incoming call)\n \n uint8_t* buffer\n Buffer to store the result\n int sizeBuffer\n Size of the buffer\n \n \n \n
\n \n ERROR CODES\n \n \n \n
\n ASYNC ERROR CODES\n \n \n \n \n \n
\n
\n
","/NTgCalls/Basic Methods/ntg_exchange_keys.xml": "\n \n

ntg_exchange_keys

\n \n

Example

\n \n #include <stdint.h>\n #include \"ntgcalls.h\"\n\n int main() {\n uint32_t uid = ntg_init();\n ...\n int64_t chatID = ...; // Obtain the chat ID\n uint8_t* g_a_or_b = ...; // Obtain the parameter for key exchange\n int sizeGAOrB = ...; // Obtain the size of the parameter for key exchange\n int64_t fingerprint = ...; // Obtain the fingerprint\n ntg_auth_params_struct buffer;\n ntg_async_struct future;\n // Initialize the async struct\n int result = ntg_exchange_keys(uid, chatID, g_a_or_b, sizeGAOrB, fingerprint, &buffer, &future);\n // Wait for the async operation to complete\n }\n \n \n

Details

\n \n int ntg_exchange_keys()\n \n \n \n
\n \n PARAMETERS\n \n \n \n uint8_t* g_a_or_b\n \n int sizeGAOrB\n Size of the parameter for key exchange\n int64_t fingerprint\n \n ntg_auth_params_struct* authParams\n \n \n \n \n
\n \n ERROR CODES\n \n \n \n
\n ASYNC ERROR CODES\n \n \n \n \n #NTG_MISSING_FINGERPRINT -103\n \n \n
\n
\n
","/NTgCalls/Basic Methods/ntg_stop.xml": "\n

ntg_stop

\n \n

Example

\n \n #include <stdint.h>\n #include \"ntgcalls.h\"\n\n int main() {\n uint32_t uid = ntg_init();\n ...\n int64_t chatID = ...; // Obtain the chat ID\n char* params = ...; // Obtain connection parameters\n ntg_async_struct future;\n // Initialize the async struct\n int result = ntg_stop(uid, chatID);\n // Wait for the async operation to complete\n return 0;\n }\n \n \n

Details

\n \n int ntg_stop()\n \n \n \n
\n \n PARAMETERS\n \n \n \n \n \n \n
\n \n ERROR CODES\n \n \n \n
\n ASYNC ERROR CODES\n \n \n \n
\n
\n
","/NTgCalls/Build Guide.xml": "\n

Introduction

\n \n Being a modern library, NTgCalls requires CMake 3.27+ to be built on your system,\n on Linux is required at least CLang 18+ and libx11-dev.\n We recommend using the latest versions of both CMake and CLang.\n \n \n Before building NTgCalls, check for pre-compiled shared libs on GitHub Releases or\n Python Bindings from PyPI.\n Building from source may be necessary if pre-compiled packages are not available.\n \n \n

Installing Prerequisites

\n \n Below, we will guide you through the step-by-step process of installing the prerequisites\n required to compile NTgCalls on your operating system.\n \n \n

Linux

\n \n \n \n Update the system's package list:
\n First, make sure you have an updated list of packages:\n
\n \n $ sudo apt update\n \n
\n \n \n Build Essential, libx11-dev, Clang 18 and etc:
\n This section provides instructions on how to install four specific packages: libx11-dev,\n build-essential, curl and Clang version 18. Use the following command:\n
\n \n \n x86_64\n ARM64\n \n \n $ sudo apt install libx11-dev build-essential curl\n \n \n $ wget https://apt.llvm.org/llvm.sh\n $ sudo bash llvm.sh 18\n $ sudo apt install libx11-dev build-essential curl\n \n \n
\n
\n

Windows

\n \n \n \n Install Microsoft Visual Studio 2019:
\n Install Microsoft Visual Studio 2019 with the C++ workload. You can download it from the official website.\n
\n
\n \n \n Download CMake Installer:
\n Download the CMake installer for Windows from the official website.\n
\n
\n \n \n Run Installer:
\n Run the downloaded CMake installer and follow the installation wizard instructions.\n Make sure to select the option to add CMake to the system PATH during installation.\n
\n
\n
\n

macOS

\n \n \n \n Install Xcode Command Line Tools:
\n If you don't have Xcode installed, you can install the Command Line Tools separately. Open a terminal and run the following command:\n
\n \n \n $ xcode-select --install\n \n \n
\n \n \n Install CMake:
\n Open a terminal and run the following command to install CMake:\n
\n \n \n $ brew install cmake\n \n \n
\n
\n
\n \n

Cloning and Building

\n \n In this section, you'll learn how to clone the NTgCalls repository and build the library from source.\n \n \n

Cloning the Repo

\n \n To begin building NTgCalls from source, you need to clone the GitHub repository. Follow these steps to clone the repo:\n \n \n \n \n Change to the Directory Where You Want to Clone the Repo:
\n Navigate to the directory where you want to store the NTgCalls source code. You can use the `cd` command to change directories.\n
\n \n $ cd /path/to/your/directory\n \n
\n \n \n Clone the NTgCalls Repository:
\n Use the following command to clone the NTgCalls GitHub repository:\n
\n \n $ git clone https://github.com/pytgcalls/ntgcalls.git --recursive\n \n
\n
\n

Compilation

\n \n Now that you have successfully installed all the required prerequisites for NTgCalls,\n it's time to build the library.\n Follow these steps to compile NTgCalls on your system.\n \n \n It's essential to have Python 3.8+ installed on your server.\n \n \n

Building Shared Library

\n \n For developers looking to use NTgCalls with C and C++, we provide C Bindings.\n Follow these steps to compile NTgCalls with C Bindings in either Release or Debug mode:\n \n \n \n \n Change Directory:
\n Navigate to the root directory of the NTgCalls project:\n
\n \n $ cd /path/to/ntgcalls\n \n
\n \n \n Generate Library:
\n Run the following command to generate the libraries:\n
\n \n \n Debug\n Release\n \n \n # Shared\n $ python3 setup.py build_lib --debug\n # Static\n $ python3 setup.py build_lib --debug --static\n \n \n # Shared\n $ python3 setup.py build_lib\n # Static\n $ python3 setup.py build_lib --static\n \n \n
\n
\n
\n

Building Python Bindings

\n \n NTgCalls offers Python Bindings, facilitating seamless integration with Python.\n Follow these steps to compile NTgCalls with Python Bindings:\n \n \n \n \n Change Directory:
\n Navigate to the root directory of the NTgCalls project:\n
\n \n $ cd /path/to/ntgcalls\n \n
\n \n \n Install Python Bindings:
\n Run the following command to install the Python Bindings:\n
\n \n $ pip3 install . -U\n \n
\n
\n
\n
\n
","/NTgCalls/Callback Registration.xml": "\n

Callback Registration

\n \n Callbacks registration allows you to specify custom functions to be executed when specific\n events occur or conditions are met within your application.\n These events might include changes in call status, media state updates, or other critical moments in\n the NTgCalls library's operation.\n \n \n When registering callbacks, keep in mind that each registration replaces the previously set callback.\n \n \n

\n \n ntg_on_stream_end()\n \n \n
\n \n PARAMETERS\n \n \n ntg_stream_callback callback\n The callback function to be executed when the stream ends.\n \n \n \n
\n

Example

\n \n #include \"ntgcalls.h\"\n ...\n void myStreamEndCallback(uint32_t uid, int64_t chatID, ntg_stream_type_enum type, void *data) {\n // Your callback logic here\n }\n ...\n int main() {\n uint32_t uid = ntg_init();\n ... // Your Code Here\n ntg_on_stream_end(uid, myStreamEndCallback, customData);\n ...\n return 0;\n }\n \n
\n \n
\n

\n \n ntg_on_upgrade()\n \n \n
\n \n PARAMETERS\n \n \n ntg_upgrade_callback callback\n The callback function to be executed when the stream needs to update MTProto stream parameters.\n \n \n \n
\n

Example

\n \n #include \"ntgcalls.h\"\n ...\n void myOnUpgradeCallback(uint32_t uid, int64_t chatID, ntg_media_state_struct mediaState, void *data) {\n // Your callback logic here\n }\n ...\n int main() {\n uint32_t uid = ntg_init();\n ... // Your Code Here\n ntg_on_upgrade(uid, myOnUpgradeCallback, customData);\n ...\n return 0;\n }\n \n
\n \n
\n

\n \n ntg_on_connection_change()\n \n \n
\n \n PARAMETERS\n \n \n ntg_connection_callback callback\n The callback function to be executed when the connection state changes.\n \n \n \n
\n

Example

\n \n #include \"ntgcalls.h\"\n ...\n void myOnConnectionChangeCallback(uint32_t uid, int64_t chatID, ntg_connection_state_enum state, void *data) {\n // Your callback logic here\n }\n ...\n int main() {\n uint32_t uid = ntg_init();\n ... // Your Code Here\n ntg_on_connection_change(uid, myOnConnectionChangeCallback, customData);\n ...\n return 0;\n }\n \n
\n \n
\n

\n \n ntg_on_signaling_data()\n \n \n
\n \n PARAMETERS\n \n \n ntg_signaling_callback callback\n The callback function to be executed when signaling data is received.\n \n \n \n
\n

Example

\n \n #include \"ntgcalls.h\"\n ...\n void myOnSignalingDataCallback(uint32_t uid, int64_t chatID, const char *data, size_t size, void *customData) {\n // Your callback logic here\n }\n ...\n int main() {\n uint32_t uid = ntg_init();\n ... // Your Code Here\n ntg_on_signaling_data(uid, myOnSignalingDataCallback, customData);\n ...\n return 0;\n }\n \n
\n \n
\n

\n \n ntg_register_logger()\n \n \n
\n \n PARAMETERS\n \n ntg_log_message_callback callback\n \n \n \n
\n

Example

\n \n #include <stdint.h>\n #include \"ntgcalls.h\"\n\n void logger(ntg_log_message_struct* message) {\n printf(\"Log message: %s\\n\", message->message);\n }\n\n int main() {\n ntg_register_logger(logger);\n ...\n return 0;\n }\n \n
\n
\n
","/NTgCalls/Callbacks.xml": "\n

Callbacks

\n \n Callbacks allows you to define custom behavior or actions that should be triggered in response to specific\n events or conditions within your application.\n These events could include call-related occurrences, state changes, or other interactions with the NTgCalls library.\n \n
\n \n NTgCalls.on_stream_end()\n \n \n

Example

\n \n ...\n app = NTgCalls()\n ...\n def handler(chat_id: int, update: StreamType):\n print(chat_id, update)\n ...\n app.on_stream_end(handler)\n \n
\n
\n

\n \n NTgCalls.on_upgrade()\n \n \n

Example

\n \n ...\n app = NTgCalls()\n ...\n def handler(chat_id: int, update: MediaState):\n print(chat_id, update)\n ...\n app.on_upgrade(handler)\n \n
\n
\n

\n \n NTgCalls.on_connection_change()\n \n \n

Example

\n \n ...\n app = NTgCalls()\n ...\n def handler(chat_id: int, state: ConnectionState):\n print(chat_id, state)\n ...\n app.on_connection_change(handler)\n \n
\n
\n

\n \n NTgCalls.on_signaling()\n \n \n

Example

\n \n ...\n app = NTgCalls()\n ...\n def handler(chat_id: int, payload: bytes):\n print(chat_id, payload)\n ...\n app.on_signaling(handler)\n \n
\n
\n
","/NTgCalls/Client.xml": "\n

NTgCalls Client

\n \n Welcome to the API Reference section, where you'll find comprehensive information about the NTgCalls API.\n This is your gateway to in-depth details about the main Client class, its methods, types,\n all of which play a crucial role in utilizing NTgCalls effectively.\n \n

Example

\n \n from ntgcalls import NTgCalls\n\n app = NTgCalls()\n print(app.ping())\n \n \n

Details

\n \n \n class ntgcalls.NTgCalls\n \n \n The NTgCalls Client is your primary interface for seamless interaction with Group Calls.\n
\n \n STATIC METHODS\n \n async calls() -> dict[int, ntgcalls.StreamStatus]\n \n\n async cpu_usage() -> float\n \n\n ping() -> str\n Return \"pong\" message when calling this method\n\n get_protocol() -> ntgcalls.Protocol\n \n \n \n
\n
\n
","/NTgCalls/Getting Started.xml": "\n

Getting Started

\n \n This section provides documentation for the NTgCalls C API, which allows you to use NTgCalls in various programming languages,\n including C, C++, Go, Rust, Deno, and more.\n Below, you will find detailed information about the initialization and cleanup functions.\n \n \n

Initialization

\n \n To get started with NTgCalls in your application, you need to initialize the library using the ntg_init function.\n This function sets up the necessary resources and prepares NTgCalls for use.\n \n \n Make sure to call ntg_init before using any other NTgCalls functions.\n \n \n

Example

\n \n #include \"ntgcalls.h\"\n\n int main() {\n uint32_t uid = ntg_init();\n\n ... // Your Code Here\n return 0;\n }\n \n
\n\n

Cleanup

\n \n To clean up and release the resources used by NTgCalls, you should call the ntg_destroy function.\n This function deallocates memory and performs necessary cleanup operations.\n \n \n Always call ntg_destroy when you are done using NTgCalls to prevent memory leaks and resource issues.\n \n \n

Example

\n \n #include \"ntgcalls.h\"\n\n int main() {\n uint32_t uid = ntg_init();\n ... // Your Code Here\n\n int result = ntg_destroy(uid);\n if (result != 0) {\n printf(\"NTgCalls cleanup failed.\\n\");\n return 1;\n }\n return 0;\n }\n \n
\n\n \n

Library Version

\n \n You can retrieve the version of the NTgCalls library currently in use using the ntg_get_version function.\n This function returns a string containing the version number.\n \n \n

Example

\n \n #include \"ntgcalls.h\"\n #include <stdio.h>\n\n int main() {\n char version[8];\n ntg_get_version(version, sizeof(version));\n printf(\"NTgCalls Version: %s\\n\", version);\n return 0;\n }\n \n \n
\n

Details

\n \n int ntg_get_version()\n \n \n Retrieve library version\n
\n \n PARAMETERS\n \n char* buffer\n A character buffer to store the version string.\n\n \n \n \n
\n \n ERROR CODES\n \n \n \n \n
\n
\n
","/NTgCalls/Quick Start.xml": "\n

Quick Start

\n \n Welcome to this section, which is primarily intended for developers who are moderately experienced or\n seeking to perform a porting in their language using C bindings. If you are new to Python development,\n we strongly recommend using Py-TgCalls.\n However, if you fall into the aforementioned categories,\n you can find an example of usage with the various porting below.\n \n

Community and Official Libraries

\n \n In the following section, we present a comprehensive catalog of libraries,\n thoughtfully crafted by the community and officially endorsed,\n all of which leverage the robust capabilities of NTgCalls.\n \n
\n \n \n \n

Enjoy the API

\n \n What we've just seen are simplified ports of NTgCalls. However, now let's delve deeper!\n In the upcoming pages, we'll explore NTgCalls in a step-by-step manner,\n covering how it functions, how to install it, and more.\n\n Are you feeling eager to continue?\n You can take a shortcut to the Call Methods\n section and return later to delve into more details.\n \n
","/NTgCalls/Stream Methods/Change Stream.xml": "\n

Change Stream

\n \n

Example

\n \n from ntgcalls import NTgCalls\n ...\n\n app = NTgCalls()\n\n await app.change_stream(\n -1001185324811,\n MediaDescription(\n AudioDescription(\n input_mode=InputMode.File,\n input=\"foxes.pcm\",\n sample_rate=96000,\n bits_per_sample=16,\n channel_count=2,\n ),\n )\n )\n \n \n

Details

\n \n async NTgCalls.change_stream()\n \n \n \n
\n \n PARAMETERS\n \n \n \n \n \n
\n \n RAISES\n \n \n \n \n \n
\n
","/NTgCalls/Stream Methods/Mute.xml": "\n

Mute

\n \n

Example

\n \n from ntgcalls import NTgCalls\n ...\n\n app = NTgCalls()\n ...\n\n await app.mute(\n -1001185324811,\n )\n \n \n

Details

\n \n async NTgCalls.mute() -> bool\n \n \n \n
\n \n PARAMETERS\n \n \n \n \n
\n \n RAISES\n \n \n \n \n
\n
","/NTgCalls/Stream Methods/Pause.xml": "\n

Pause

\n \n

Example

\n \n from ntgcalls import NTgCalls\n ...\n\n app = NTgCalls()\n ...\n\n await app.pause(\n -1001185324811,\n )\n \n \n

Details

\n \n async NTgCalls.pause() -> bool\n \n \n \n
\n \n PARAMETERS\n \n \n \n \n
\n \n RAISES\n \n \n \n \n
\n
","/NTgCalls/Stream Methods/Resume.xml": "\n

Resume

\n \n

Example

\n \n from ntgcalls import NTgCalls\n ...\n\n app = NTgCalls()\n ...\n\n await app.resume(\n -1001185324811,\n )\n \n \n

Details

\n \n async NTgCalls.resume() -> bool\n \n \n \n
\n \n PARAMETERS\n \n \n \n \n
\n \n RAISES\n \n \n \n \n
\n
","/NTgCalls/Stream Methods/Time.xml": "\n

Time

\n \n

Example

\n \n from ntgcalls import NTgCalls\n ...\n\n app = NTgCalls(client)\n\n print(\n await app.time(\n -1001185324811,\n )\n )\n \n \n

Details

\n \n async NTgCalls.time() -> int\n \n \n \n
\n \n PARAMETERS\n \n \n \n \n
\n \n RAISES\n \n \n \n \n
\n
","/NTgCalls/Stream Methods/UnMute.xml": "\n

UnMute

\n \n

Example

\n \n from ntgcalls import NTgCalls\n ...\n\n app = NTgCalls()\n ...\n\n await app.unmute(\n -1001185324811,\n )\n \n \n

Details

\n \n async NTgCalls.unmute() -> bool\n \n \n \n
\n \n PARAMETERS\n \n \n \n \n
\n \n RAISES\n \n \n \n \n
\n
","/NTgCalls/Stream Methods/ntg_change_stream.xml": "\n

ntg_change_stream

\n \n

Example

\n \n #include <stdint.h>\n #include \"ntgcalls.h\"\n\n int main() {\n uint32_t uid = ntg_init();\n ...\n int64_t chatID = ...; // Obtain the chat ID\n ntg_media_description_struct desc = {\n // Fill in updated media description fields\n };\n ntg_async_struct future;\n // Initialize the async struct\n int result = ntg_change_stream(uid, chatID, desc, &future);\n // Wait for the async operation to complete\n return 0;\n }\n \n \n

Details

\n \n int ntg_change_stream()\n \n \n \n
\n \n PARAMETERS\n \n \n \n \n \n \n \n
\n \n ERROR CODES\n \n \n \n
\n ASYNC ERROR CODES\n \n \n\n \n \n
\n
\n
","/NTgCalls/Stream Methods/ntg_mute.xml": "\n

ntg_mute

\n \n

Example

\n \n #include <stdint.h>\n #include \"ntgcalls.h\"\n\n int main() {\n uint32_t uid = ntg_init();\n ...\n int64_t chatID = ...; // Obtain the chat ID\n ntg_async_struct future;\n // Initialize the async struct\n int errCode = ntg_mute(uid, chatID, &future);\n // Wait for the async operation to complete\n if (future.errorCode == 0) {\n printf(\"Audio muted.\\n\");\n } else if (future.errorCode == 1) {\n printf(\"Audio was already muted.\\n\");\n } else {\n printf(\"Failed to mute audio (Error code: %d).\\n\", future.errorCode);\n return 1;\n }\n ... // Your Code Here\n return 0;\n }\n \n \n

Details

\n \n int ntg_mute()\n \n \n \n
\n \n PARAMETERS\n \n \n \n \n \n \n
\n \n ERROR CODES\n \n \n \n
\n ASYNC ERROR CODES\n \n \n \n
\n
\n
","/NTgCalls/Stream Methods/ntg_pause.xml": "\n

ntg_pause

\n \n

Example

\n \n #include <stdint.h>\n #include \"ntgcalls.h\"\n\n int main() {\n uint32_t uid = ntg_init();\n ...\n int64_t chatID = ...; // Obtain the chat ID\n ntg_async_struct future;\n // Initialize the async struct\n int errCode = ntg_pause(uid, chatID);\n // Wait for the async operation to complete\n if (future.errorCode == 0) {\n printf(\"Audio paused.\\n\");\n } else if (future.errorCode == 1) {\n printf(\"Audio was already paused.\\n\");\n } else {\n printf(\"Failed to pause audio (Error code: %d).\\n\", result);\n return 1;\n }\n ... // Your Code Here\n return 0;\n }\n \n \n

Details

\n \n int ntg_pause()\n \n \n \n
\n \n PARAMETERS\n \n \n \n \n \n \n
\n \n ERROR CODES\n \n \n \n
\n ASYNC ERROR CODES\n \n \n \n
\n
\n
","/NTgCalls/Stream Methods/ntg_resume.xml": "\n

ntg_resume

\n \n

Example

\n \n #include <stdint.h>\n #include \"ntgcalls.h\"\n\n int main() {\n uint32_t uid = ntg_init();\n ...\n int64_t chatID = ...; // Obtain the chat ID\n ntg_async_struct future;\n // Initialize the async struct\n int errCode = ntg_resume(uid, chatID, &future);\n // Wait for the async operation to complete\n if (future.errorCode == 0) {\n printf(\"Audio resumed.\\n\");\n } else if (future.errorCode == 1) {\n printf(\"Audio was already resumed.\\n\");\n } else {\n printf(\"Failed to resume audio (Error code: %d).\\n\", result);\n return 1;\n }\n ... // Your Code Here\n return 0;\n }\n \n \n

Details

\n \n int ntg_resume()\n \n \n \n
\n \n PARAMETERS\n \n \n \n \n \n \n
\n \n ERROR CODES\n \n \n \n
\n ASYNC ERROR CODES\n \n \n \n
\n
\n
","/NTgCalls/Stream Methods/ntg_time.xml": "\n

ntg_time

\n \n

Example

\n \n #include <stdint.h>\n #include \"ntgcalls.h\"\n\n int main() {\n uint32_t uid = ntg_init();\n ...\n int64_t chatID = ...; // Obtain the chat ID\n int64_t time = 0;\n ntg_async_struct future;\n // Initialize the async struct\n int64_t result = ntg_time(uid, chatID, &time, &future);\n // Wait for the async operation to complete\n return 0;\n }\n \n \n

Details

\n \n int64_t ntg_time()\n \n \n \n
\n \n PARAMETERS\n \n \n \n int64_t* time\n The playback time in seconds.\n \n \n \n
\n \n ERROR CODES\n \n \n \n
\n ASYNC ERROR CODES\n \n \n \n
\n
\n
","/NTgCalls/Stream Methods/ntg_unmute.xml": "\n

ntg_unmute

\n \n

Example

\n \n #include <stdint.h>\n #include \"ntgcalls.h\"\n\n int main() {\n uint32_t uid = ntg_init();\n ...\n int64_t chatID = ...; // Obtain the chat ID\n ntg_async_struct future;\n // Initialize the async struct\n int errCode = ntg_unmute(uid, chatID, &future);\n // Wait for the async operation to complete\n if (future.errorCode == 0) {\n printf(\"Audio unmuted.\\n\");\n } else if (future.errorCode == 1) {\n printf(\"Audio was already unmuted.\\n\");\n } else {\n printf(\"Failed to unmute audio (Error code: %d).\\n\", future.errorCode);\n return 1;\n }\n ... // Your Code Here\n return 0;\n }\n \n \n

Details

\n \n int ntg_unmute()\n \n \n \n
\n \n PARAMETERS\n \n \n \n \n \n \n
\n \n ERROR CODES\n \n \n \n
\n ASYNC ERROR CODES\n \n \n \n
\n
\n
","/NTgCalls/Using Async.xml": "\n

Using Async

\n \n NTgCalls starting from version 1.2.0 supports asynchronous calls to function using ntg_async_struct,\n which contains userData that can be used to pass data between the caller and the callback,\n promise that is called when the operation is completed, and error that is set\n when an error occurs, but by default it is set to #NTG_ASYNC_NOT_READY (-4) until\n the operation is completed.\n \n \n

Async Call in a Sync way

\n \n To make an async call in a sync way, you can use a mutex to wait for the operation to complete:\n \n \n #include <ntgcalls.h>\n #include <mutex>\n\n void onCallReady(void* data) {\n ((std::mutex*)data)->unlock();\n }\n\n void makeAsyncCall() {\n ntg_async_struct asyncData;\n std::mutex mtx;\n asyncData.userData = &mtx;\n asyncData.promise = onCallReady;\n mutex.lock();\n int error = ntg_pause(asyncData);\n if (error != 0) {\n // Handle error\n }\n mutex.lock();\n // Async operation completed\n if (asyncData.errorCode != 0) {\n // Handle Async error\n }\n }\n \n \n

Async Call with custom data

\n \n You can pass custom data to the async call by using the userData field:\n \n \n #include <ntgcalls.h>\n #include <mutex>\n #include <iostream>\n\n struct CustomData {\n std::mutex* mtx;\n int64_t chatID;\n };\n\n void onCallReady(void* data) {\n CustomData* customData = (CustomData*)data;\n customData->mtx->unlock();\n std::cout << \"Chat ID: \" << customData->chatID << std::endl;\n }\n\n void makeAsyncCall() {\n ntg_async_struct asyncData;\n std::mutex mtx;\n CustomData data;\n data.mtx = &mtx;\n data.chatID = 1234567890;\n asyncData.userData = &data;\n asyncData.promise = onCallReady;\n mutex.lock();\n int error = ntg_pause(asyncData);\n if (error != 0) {\n // Handle error\n }\n mutex.lock();\n // Async operation completed\n if (asyncData.errorCode != 0) {\n // Handle Async error\n }\n }\n \n
","/PyTgCalls/Advanced Methods/Change Volume Call.xml": "\n

Change Volume Call

\n \n This feature has some Telegram bugs; sometimes the volume is not applied on the Client side.\n \n This method changes the userbot\u2019s output volume using MTProto APIs.\n

Example

\n \n from pytgcalls import Client\n from pytgcalls import idle\n ...\n\n app = PyTgCalls(client)\n app.start()\n\n ... # Call API methods\n\n app.change_volume_call(\n -1001185324811,\n 175,\n )\n\n idle()\n \n \n

Details

\n \n PyTgCalls.change_volume_call()\n \n \n Change the stream\u2019s volume.\n
\n \n PARAMETERS\n \n \n\n volume: int\n New stream\u2019s volume\n \n \n
\n \n RAISES\n \n \n \n \n
\n
","/PyTgCalls/Advanced Methods/Get Participants.xml": "\n

Get Participants

\n This method returns the list of a group call\u2019s participants using MTProto APIs.\n

Example

\n \n from pytgcalls import Client\n from pytgcalls import idle\n ...\n\n app = PyTgCalls(client)\n app.start()\n\n ... # Call API methods\n\n app.get_participants(\n -1001185324811,\n )\n\n idle()\n \n \n

Details

\n \n PyTgCalls.get_participants() -> list[GroupCall]\n \n \n Get a list of participants from a group call\n
\n \n PARAMETERS\n \n \n \n \n
\n
","/PyTgCalls/Advanced Types/Call.xml": "\n

Call

\n
\n \n class pytgcalls.types.Call\n \n \n \n
\n PROPERTIES\n \n call_type -> Type\n The type of the call.\n\n status -> Status\n \n \n
\n
","/PyTgCalls/Advanced Types/CallConfig.xml": "\n

CallConfig

\n
\n \n class pytgcalls.types.CallConfig\n \n \n Configuration descriptor for a private call\n
\n PARAMETERS\n \n timeout: int\n Timeout for an answer from the user\n \n
\n
","/PyTgCalls/Advanced Types/ChatUpdate.xml": "\n

ChatUpdate

\n \n class pytgcalls.types.ChatUpdate\n \n \n Represents a chat update.\n
\n PROPERTIES\n \n \n status -> Status\n Status of the chat.\n action -> Any\n Action of the chat.\n \n
\n
","/PyTgCalls/Advanced Types/GroupCallConfig.xml": "\n

GroupCallConfig

\n
\n \n class pytgcalls.types.GroupCallConfig\n \n \n Configuration descriptor for a group call\n
\n PARAMETERS\n \n invite_hash: Optional[str]\n Unique identifier for a group call invite in t.me link form\n join_as: \n InputPeer to join as a channel or a profile\n auto_start: bool\n Start group call if not present, by default, is True\n \n
\n
","/PyTgCalls/Advanced Types/GroupCallParticipant.xml": "\n

GroupCallParticipant

\n
\n \n class pytgcalls.types.GroupCallParticipant\n \n \n Info about a group call participant\n
\n PROPERTIES\n \n user_id -> int\n Unique identifier of a participant.\n\n muted -> bool\n Whether the participant is muted.\n\n muted_by_admin -> bool\n Whether an admin has muted the participant.\n\n video -> bool\n Whether the participant is currently broadcasting a video stream.\n\n screen_sharing -> bool\n Whether the participant is currently screen sharing.\n\n video_camera -> bool\n Whether the participant is currently broadcasting a video camera.\n\n raised_hand -> bool\n Whether the participant has raised the hand.\n\n volume -> int\n Volume level of the participant.\n\n action -> Action\n Current action of the participant.\n \n
\n
","/PyTgCalls/Advanced Types/StreamAudioEnded.xml": "\n

StreamAudioEnded

\n
\n \n class pytgcalls.types.StreamAudioEnded\n \n \n The audio stream has ended.\n
\n PROPERTIES\n \n \n \n
\n
","/PyTgCalls/Advanced Types/StreamVideoEnded.xml": "\n

StreamVideoEnded

\n
\n \n class pytgcalls.types.StreamVideoEnded\n \n \n The video stream has ended.\n
\n PROPERTIES\n \n \n \n
\n
","/PyTgCalls/Advanced Types/UpdatedGroupCallParticipant.xml": "\n

UpdatedGroupCallParticipant

\n
\n \n class pytgcalls.types.UpdatedGroupCallParticipant\n \n \n A participant changed his status.\n
\n PROPERTIES\n \n \n \n \n
\n
","/PyTgCalls/Available Enums/AudioQuality.xml": "\n

AudioQuality

\n
\n \n class pytgcalls.types.AudioQuality\n \n \n Enumeration of audio quality settings for audio streams in telegram calls.\n
\n ENUMERATION MEMBERS\n \n STUDIO = (96000, 2)\n Represents studio-quality audio with a bitrate of 96000 and 2 channels.\n\n HIGH = (48000, 2)\n Represents high-quality audio with a bitrate of 48000 and 2 channels.\n\n MEDIUM = (36000, 1)\n Represents medium-quality audio with a bitrate of 36000 and 1 channel.\n\n LOW = (24000, 1)\n Represents low-quality audio with a bitrate of 24000 and 1 channel.\n \n
\n
","/PyTgCalls/Available Enums/Call Status.xml": "\n

Call Status

\n
\n \n class pytgcalls.types.Call.Status\n \n \n Enumeration for managing call statuses.\n
\n ENUMERATION MEMBERS\n \n PLAYING = 1\n Indicates that the call is playing.\n PAUSED = 2\n Indicates that the call is paused.\n IDLE = 4\n Indicates that the call is idle.\n \n
\n
","/PyTgCalls/Available Enums/Call Type.xml": "\n

Call Type

\n
\n \n class pytgcalls.types.Call.Type\n \n \n Enumeration for managing call types.\n
\n ENUMERATION MEMBERS\n \n GROUP = 1\n Group call type.\n PRIVATE = 2\n Private call type.\n \n
\n
","/PyTgCalls/Available Enums/ChatUpdate Status.xml": "\n

ChatUpdate Status

\n
\n \n class pytgcalls.types.ChatUpdate.Status\n \n \n Enumeration for managing chat update status in telegram calls.\n
\n ENUMERATION MEMBERS\n \n KICKED = 1\n Indicates that you was kicked.\n LEFT_GROUP = 2\n Indicates that you left the chat.\n CLOSED_VOICE_CHAT = 4\n Indicates that the voice chat was closed.\n INVITED_VOICE_CHAT = 8\n Indicates that you was invited to the voice chat.\n DISCARDED_CALL = 16\n Indicates that the call was discarded.\n INCOMING_CALL = 32\n Indicates that an incoming call is available.\n LEFT_CALL = KICKED | LEFT_GROUP | CLOSED_VOICE_CHAT | DISCARDED_CALL\n Indicates that you left the call.\n \n
\n
","/PyTgCalls/Available Enums/GroupCallParticipant Action.xml": "\n

GroupCallParticipant Action

\n
\n \n class pytgcalls.types.GroupCallParticipant.Action\n \n \n Enumeration of actions for group call participants.\n
\n ENUMERATION MEMBERS\n \n JOINED = 1\n Represents a participant joined in a group call.\n\n LEFT = 2\n Represents a participant left a group call.\n\n UPDATED = 4\n Represents a participant updated in a group call.\n \n
\n
","/PyTgCalls/Available Enums/MediaStream Flags.xml": "\n

MediaStream Flags

\n
\n \n class pytgcalls.types.MediaStream.Flags\n \n \n Enumeration for managing media stream requirements in telegram calls.\n
\n ENUMERATION MEMBERS\n \n AUTO_DETECT = 1\n Automatically detects the presence of the stream.\n\n IGNORE = 2\n Ignores the stream.\n\n REQUIRED = 4\n Indicates that the stream is mandatory.\n\n NO_LATENCY = 8\n Used to indicate that the stream should be sent with no latency.\n \n
\n
","/PyTgCalls/Available Enums/VideoQuality.xml": "\n

VideoQuality

\n
\n \n class pytgcalls.types.VideoQuality\n \n \n Enumeration of video quality settings for video streams in telegram calls.\n
\n ENUMERATION MEMBERS\n \n UHD_4K = (3840, 2160, 60)\n Represents ultra-high-definition 4K video with a resolution of 3840x2160 and 60 FPS.\n\n QHD_2K = (2560, 1440, 60)\n Represents quad high-definition 2K video with a resolution of 2560x1440 and 60 FPS.\n\n FHD_1080p = (1920, 1080, 60)\n Represents full high-definition 1080p video with a resolution of 1920x1080 and 60 FPS.\n\n HD_720p = (1280, 720, 30)\n Represents high-definition 720p video with a resolution of 1280x720 and 30 FPS.\n\n SD_480p = (854, 480, 30)\n Represents standard-definition 480p video with a resolution of 854x480 and 30 FPS.\n\n SD_360p = (640, 360, 30)\n Represents standard-definition 360p video with a resolution of 640x360 and 30 FPS.\n \n
\n
","/PyTgCalls/Basic Methods/Idle.xml": "\n

Idle

\n \n This function will run indefinitely in order to block the main script\n execution and prevent it from exiting while having client(s) that are still running in the background.\n\n PyTgCalls works by keeping your handlers in a pool of worker threads, which run\n concurrently outside the main thread. Calling idle() will ensure that the client(s) remain active, by\n preventing the main script from ending until you decide to quit.\n\n Once a signal is received (e.g.: from CTRL+C) the function will terminate and your main script will continue.\n \n

Example

\n \n from pytgcalls import Client\n from pytgcalls import idle\n ...\n\n app1 = PyTgCalls(client1)\n app2 = PyTgCalls(client2)\n app3 = PyTgCalls(client3)\n\n ... # Set handlers up\n\n app1.start()\n app2.start()\n app3.start()\n\n idle()\n \n \n

Details

\n \n pytgcalls.idle()\n \n \n Blocks the main script execution until a signal is received.\n \n
","/PyTgCalls/Basic Methods/Leave Call.xml": "\n

Leave Call

\n \n This method replaces the deprecated leave_group_call method.\n \n This method allows leaving and stopping a group call or a private call, or declining a private call.\n

Example

\n \n from pytgcalls import Client\n from pytgcalls import idle\n ...\n\n app = PyTgCalls(client)\n app.start()\n\n ... # Call API methods\n\n app.leave_call(\n -1001185324811,\n )\n\n idle()\n \n \n

Details

\n \n PyTgCalls.leave_call()\n \n \n Leave a group call or a private call.\n
\n \n PARAMETERS\n \n \n \n \n
\n \n RAISES\n \n \n \n \n
\n
","/PyTgCalls/Basic Methods/Play.xml": "\n \n

Play

\n \n This method replaces the deprecated join_group_call and change_stream methods.\n \n This method allows streaming audio or video to a group call or a private call.\n

Example

\n \n from pytgcalls import Client\n from pytgcalls import idle\n from pytgcalls.types import MediaStream\n ...\n\n app = PyTgCalls(client)\n app.start()\n\n ... # Call API methods\n\n app.play(\n -1001185324811,\n MediaStream(\n 'test.mp4',\n )\n )\n\n idle()\n \n \n

Details

\n \n PyTgCalls.play()\n \n \n Join in a group call or accept/request a private call to stream audio or video.\n
\n \n PARAMETERS\n \n \n \n config: Optional[Union[pytgcalls.types.CallConfig, pytgcalls.types.GroupCallConfig]]\n Additional configuration for the call.\n \n \n
\n \n RAISES\n \n \n \n \n exception pytgcalls.exceptions.CallDeclined\n The call was declined by the user.\n exception pytgcalls.exceptions.CallDiscarded\n The call was discarded by the user while connecting.\n \n exception pytgcalls.exceptions.AlreadyJoinedError\n You are attempting to join in a call you're already a part of.\n \n \n \n
\n
","/PyTgCalls/Basic Methods/Run.xml": "\n

Run

\n \n This is a convenience method that calls start(), idle() in sequence.\n It makes running a client less verbose, but it is not suitable in case you want to run more than one client in a single script,\n since the idle() part will block all the subsequent code after starting the client.\n \n

Example

\n \n from pytgcalls import Client\n from pytgcalls import idle\n ...\n app = Client(client)\n\n ... # Call API decorators / MtProto decorators\n\n app.run()\n \n \n

Details

\n \n PyTgCalls.run()\n \n \n Start the client, idle the main script and finally stop the client.\n
\n \n RAISES\n \n \n \n \n
\n
","/PyTgCalls/Basic Methods/Start.xml": "\n

Start

\n \n This method start and then initialize NTgCalls core.\n \n

Example

\n \n from pytgcalls import Client\n from pytgcalls import idle\n ...\n app = Client(client)\n\n ... # Call API decorators / MTProto decorators\n\n app.start()\n \n \n

Details

\n \n PyTgCalls.start()\n \n \n Start the client.\n
\n \n RAISES\n \n \n \n \n
\n
","/PyTgCalls/Calling Methods.xml": "\n

Calling Methods

\n \n At this point, we have successfully installed PyTgCalls and installed an MTProto client;\n we are now aiming towards the core of the library. It\u2019s time to start playing with the API!\n \n

Basic Usage

\n Making API method calls with PyTgCalls is very simple. Here\u2019s a basic example we are going to examine step by step:\n \n from pytgcalls import PyTgCalls\n from pytgcalls import idle\n from pytgcalls.types import MediaStream\n ...\n api_id = 12345\n api_hash = '0123456789abcdef0123456789abcdef'\n ...\n app = PyTgCalls(client)\n app.start()\n app.play(\n -1001185324811,\n MediaStream(\n 'http://docs.evostream.com/sample_content/assets/sintel1m720p.mp4',\n )\n )\n idle()\n \n

Basic step-by-step

\n \n \n Let\u2019s begin by importing the Client class, Stream type and idle function:\n \n \n Now let\u2019s import your MTProto Client:\n \n \n PyrogramMod\n Telethon\n Hydrogram\n \n \n from pyrogram import Client\n \n \n from telethon import TelegramClient\n \n \n from hydrogram import Client\n \n \n \n \n Set your api_id and api_hash taken from my.telegram.org:\n \n api_id = 12345\n api_hash = '0123456789abcdef0123456789abcdef'\n \n \n \n Initialize the MTProto client:\n \n \n PyrogramMod\n Telethon\n Hydrogram\n \n \n client = Client('test_session', api_id, api_hash)\n \n \n client = TelegramClient('test_session', api_id, api_hash)\n \n \n client = Client('test_session', api_id, api_hash)\n \n \n \n \n Initialize the PyTgCalls client:\n \n app = PyTgCalls(client)\n \n \n \n Start the PyTgCalls client:\n \n app.start()\n \n \n \n Now you can call any method you want:\n \n app.play(\n -1001185324811,\n MediaStream(\n 'http://docs.evostream.com/sample_content/assets/sintel1m720p.mp4',\n )\n )\n \n \n \n Lastly, call the idle function to keep your code running:\n \n idle()\n \n \n \n

Asynchronous Calls

\n In case you wish to run PyTgCalls asynchronously:\n \n import asyncio\n from pytgcalls import PyTgCalls\n from pytgcalls import idle\n from pytgcalls.types import MediaStream\n ...\n app = PyTgCalls(client)\n\n async def main():\n await app.start()\n await app.play(\n -1001185324811,\n MediaStream(\n 'http://docs.evostream.com/sample_content/assets/sintel1m720p.mp4',\n )\n )\n await idle()\n\n asyncio.get_event_loop().run_until_complete(main())\n \n

Asynchronous step-by-step

\n \n \n Import PyTgCalls, AsyncIO and create an instance:\n \n import asyncio\n from pytgcalls import PyTgCalls\n from pytgcalls import idle\n ...\n app = PyTgCalls(client)\n \n \n \n Async methods can\u2019t be executed at the top level, because they must be within an async-defined function;\n here, we define one, and we put our code inside it; method calls require the await keyword:\n \n async def main():\n await app.start()\n await app.play(\n -1001185324811,\n MediaStream(\n 'http://docs.evostream.com/sample_content/assets/sintel1m720p.mp4',\n )\n )\n await idle()\n \n \n \n Then, we tell asyncio to call main() in async mode\n asyncio.get_event_loop().run_until_complete(main())\n \n \n
","/PyTgCalls/Changelogs.xml": "\n

Changelogs

\n \n
\n \n \n

What's new?

\n \n Private Calls: Now you can make private calls by just using a single method for also group calls, by using play().\n Code Rework: The code has been reworked to improve performance, stability and to make it more readable.\n Async Support: NTgCalls now supports asynchronous methods for improved performance.\n Filters for Updates: Added filters for updates to allow for more granular control over updates, More Info.\n Improved Documentation: Updated documentation with more examples, new UI and comprehensive guidance.\n \n \n

Breaking Changes

\n \n \n Now methods like change_stream() and join_group_call() was removed, now you can use play() for both private, group calls and changing streams.\n \n \n # Change stream\n call_py.change_stream(\n -1001234567890,\n AudioPiped(\n 'input.mp4',\n ),\n )\n
\n # Join group call\n call_py.join_group_call(\n -1001234567890,\n AudioPiped(\n 'input.mp4',\n ),\n )\n
\n \n # Change stream\n call_py.play(\n -1001234567890,\n AudioPiped(\n 'input.mp4',\n ),\n )\n
\n # Join group call\n call_py.play(\n -1001234567890,\n AudioPiped(\n 'input.mp4',\n ),\n )\n
\n
\n
\n \n Now all listeners like on_stream_end() was unified in on_update() and with filters, for example:\n \n \n # On Closed Voice Chat\n @call_py.on_closed_voice_chat()\n async def on_closed_voice_chat(client: PyTgCalls, update: Update):\n print(update)\n
\n # On stream end\n @call_py.on_stream_end()\n async def on_stream_end(client: PyTgCalls, update: Update):\n print(update)\n
\n \n from pytgcalls import filters\n from pytgcalls.types import ChatUpdate\n ...\n # On Closed Voice Chat\n @call_py.on_update(filters.chat_update(ChatUpdate.Status.CLOSED_VOICE_CHAT))\n async def on_closed_voice_chat(client: PyTgCalls, update: Update):\n print(update)\n
\n # On stream end\n @call_py.on_update(filters.stream_end)\n async def on_stream_end(client: PyTgCalls, update: Update):\n print(update)\n
\n
\n
\n \n Reworked GroupCall type, now is Call and now is more powerful and easy to use.\n \n \n Removed JoinedGroupCallParticipant and LeftGroupCallParticipant classes, now you can see the action in GroupCallParticipant class.\n \n \n Removed all legacy types and input stream, now is a mandatory to use MediaStream for all streams.\n \n \n Now ping() from Client is not anymore a coroutine, now is a normal method.\n \n \n Removed get_active_call() and get_call(), now is a mandatory to use calls() from Client.\n \n \n Renamed leave_group_call to leave_call().\n \n \n Moved MediaStream flags under MediaStream.Flags instead of MediaStream.\n \n \n Now invite_hash, join_as and auto_start are part of GroupCallConfig instead of join_group_call.\n \n \n Renamed additional_ffmpeg_parameters to ffmpeg_parameters in MediaStream.\n \n \n For more info about breaking changes, check the Examples, if we missed something, please open an issue.\n \n
\n

Additional Notes

\n \n We're pleased to announce that now is available an unofficial porting of NTgCalls for Rust, for more info, check the repository.\n \n
\n \n
\n \n
\n \n \n

What's new?

\n \n Static Typing: PyTgCalls is now fully statically typed, ensuring that the types of each method and class are thoroughly checked.\n YtDlp Support: MediaStream now supports links from YouTube using YtDlp, for example: https://www.youtube.com/watch?v=iSbLHrrqmoM\n \n MediaStream Quality Support: MediaStream now accepts enhanced quality options for audio and video parameters. For audio, use pytgcalls.types.AudioQuality, and for video, use pytgcalls.types.VideoQuality.\n \n \n call_py.join_group_call(\n -1001234567890,\n MediaStream(\n 'input.mp4',\n AudioParameters.from_quality(AudioQuality.STUDIO),\n VideoParameters.from_quality(VideoQuality.FHD_1080p),\n ),\n )\n \n \n call_py.join_group_call(\n -1001234567890,\n MediaStream(\n 'input.mp4',\n AudioQuality.STUDIO,\n VideoQuality.FHD_1080p,\n ),\n )\n \n \n \n \n \n

Breaking Changes

\n \n Now all raw methods like AudioParameters, VideoParameters, AudioStream, VideoStream, and Stream are all under pytgcalls.types.raw instead of pytgcalls.types.\n The exception class pytgcalls.exceptions.TelegramServerError is now part of ntgcalls.TelegramServerError.\n \n

Additional Notes

\n \n We're pleased to announce that pre-compiled wheels optimized for ARM64 devices are now available.\n \n
\n \n
\n \n
\n \n \n

Here's how to join:

\n \n Visit the discussion page: PyTgCalls Contest\n Share these details: Your Repository Name, Brief Description of Your Bot, Link to Your Repository\n \n

Prizes and Recognition

\n \n Encourage upvotes by reposting this message in your channels.\n The bot with the highest upvotes earns a prestigious place in the PyTgCalls documentation.\n \n

Contest Rules

\n \n Make sure your repository goes beyond minor tweaks of a fork.\n Use the latest PyTgCalls version).\n Your repository should be public.\n \n Join the contest now and showcase your PyTgCalls-powered bot for a chance to be featured prominently on the PyTgCalls documentation! Good luck!\n
\n \n
\n \n
\n \n \n

What's new?

\n \n AutoStart of Group Calls: Now GroupCalls will be started automatically if they are not started, if you want to know how to disable it, read here.\n \n Unified Stream Design: Now you can do whatever you want, streaming audio, video, both, recording the stream etc. with just one class!.\n \n \n # Play audio and video from and MP4 file\n call_py.join_group_call(\n -1001234567890,\n AudioVideoPiped(\n 'input.mp4',\n ),\n )\n
\n # Stream audio only from an MP4 file\n call_py.join_group_call(\n -1001234567890,\n AudioPiped(\n 'input.mp4',\n ),\n )\n
\n # Stream screen\n call_py.join_group_call(\n -1001234567890,\n CaptureVideoDesktop(\n MediaDevices.get_screen_devices()[0],\n ),\n )\n
\n \n # Play audio and video from and MP4 file\n call_py.join_group_call(\n -1001234567890,\n MediaStream(\n 'input.mp4',\n ),\n )\n
\n # Stream audio only from an MP4 file\n call_py.join_group_call(\n -1001234567890,\n MediaStream(\n 'input.mp4',\n video_flags=MediaStream.IGNORE,\n ),\n )\n
\n # Stream screen\n call_py.join_group_call(\n -1001234567890,\n MediaStream(\n MediaDevices.get_screen_devices()[0],\n ),\n )\n
\n
\n
\n \n
\n

Deprecation Notice

\n \n As we said in the last post,\n now PyTgCalls 0.8.6 has reached the end of life,\n so this update is completely incompatible with this or previous versions.\n We have also deprecated most of the Stream Piped methods, here's the list:\n \n \n AudioImagePiped\n AudioPiped\n AudioVideoPiped\n CaptureAudioDevice\n CaptureAVDesktop\n CaptureAVDeviceDesktop\n CaptureVideoDesktop\n VideoPiped\n \n
\n \n
\n \n
\n \n \n

What's new?

\n \n NTgCalls Integration: The PyTgCalls core has been updated to use NTgCalls instead of TgCallsJS, making it more portable and eliminating overhead. Now, you only need to install ffmpeg on your machine, resulting in improved performance.\n Hydrogram Support: Official support for Hydrogram, a new mtproto client based on Pyrogram, providing new possibilities and enhancing the overall experience.\n New Documentation: Revamped documentation with improved clarity, comprehensive examples, and up-to-date guidance for developers.\n \n \n

Community Milestone

\n \n Thank You All: Celebrating over 100 thousand Downloads! The project has seen remarkable growth, averaging around 8,000 downloads per week since its launch. We appreciate the community's strong interest and support.\n \n

Deprecation Notice

\n \n End-of-Life (EOL) Dates: Due to changes in Pyrogram and significant time since the release of PyTgCalls 0.8.X, different versions are marked for end-of-life:\n \n \n 0.8.0, 0.8.1, 0.8.2, 0.8.3, 0.8.4, 0.8.5: Support ended due to outdated versions.\n 0.8.6: Support will continue until December 18 due to Pyrogram archiving.\n 0.9.X: Current Long-Term Support.\n 1.0.X: Latest version with high-support rate.\n \n
\n \n
\n \n
\n \n \n

What's new?

\n \n Time Tracking: Added the ability to determine the time of the currently playing audio/video. For more details, check Played Time.\n New Errors: Introduced two new errors, UnMuteNeeded and RTMPStreamNeeded.\n \n

Changes & Bug Fixes

\n \n End of Life for Python3.6: Support for Python 3.6 has reached the end of life and is no longer maintained.\n Security Fix: Addressed a security issue with the ID generation process to enhance overall security.\n Multi-Thread Removal: Removed Multi-Thread Py-TgCalls due to no bug fixes by Node.js for over 4 years.\n \n
\n \n
\n \n
\n \n \n \n As we know, Google is in charge of financing Python.\n Due to the recent events with the Node.js situation, PyPI ran for cover,\n thanks to the strong collaboration between Python and the Google Open Source Security Team they offered 4000 Titan Tokens for free available only in some regions of the world.\n PyPI to distribute these security tokens was based on a criterion, that is; any project in the top 1% of downloads in the previous 6 months is considered critical,\n at the moment only 3500 projects are considered out of 350 thousand are considered as such and py-tgcalls is considered a critical project.\n According to statistics last month, it was downloaded 684 thousand times.\n \n \n \n
\n \n
\n \n \n

Changes & Bug Fixes

\n \n WebRTC Retry Fixes: Addressed issues with WebRTC retry for more reliable connections.\n Asynchronous Method Invocation: All methods, such as join_group_call, now use asyncio future, waiting for responses from Node.js asynchronously.\n \n
\n \n
\n \n
\n \n \n

What's new?

\n \n \n Internal FFmpeg Conversion: Introduced internal FFmpeg conversion for AudioPiped, AudioVideoPiped, and AudioImagePiped for seamless multimedia handling.\n \n call_py.join_group_call(\n -1001234567890,\n AudioVideoPiped(\n 'input.webm',\n ),\n stream_type=StreamType().pulse_stream,\n )\n \n \n Remote Stream Support: Added support for remote streams for more diverse streaming options.\n Stream Image with Audio: Added the ability to stream images with audio using AudioImagePiped.\n GetParticipants and OnParticipantChange: New functionalities for handling participants in group calls.\n Browser Constants as Headers: Added browser constants as headers for FFmpeg.\n Python 3.10 Support: Added compatibility with Python 3.10.\n \n

Changes & Fixes

\n \n Proportion Video Support: Added support for all proportion video formats for a more versatile video experience.\n Communication Fix: Addressed stderr overflow by adding a reader for improved Node.js communication.\n WebRTC Connection Retry: Added automatic retry if WebRTC connection fails for more reliable connections.\n Lighter Buffer Reader: Optimized the Buffer Reader for lighter resource usage.\n Multiple Ping Requests: Now supports multiple ping requests for improved responsiveness.\n \n
\n \n
\n \n
\n \n \n

What's new?

\n \n Custom Exceptions: Added custom exceptions for more robust error handling.\n Platform Support: Added support for Windows, macOS, and Linux Arm64.\n \n

Changes & Fixes

\n \n PyTgCalls Re-Base: Code cleanup and fixes for a more streamlined and efficient codebase.\n Fully Async: The library is now fully asynchronous for improved performance.\n Communication Update: Removed the internal socket server for Node.js communication between Python, replaced with stdin and stdout.\n CustomAPI Renewed: CustomAPI upgraded to version 2.1 with new features and improvements.\n RawUpdate Enhancement: RawUpdate renewed with PyTgCalls Object Update for better handling of updates.\n Method Name Change: .run() is now .start() and no longer blocks code execution.\n Logging Update: Now logs are directed to Python Logging for improved logging capabilities.\n Voice Call Handling: If the stream is deleted, the userbot will exit the voice call by printing an error in RawUpdate.\n \n \n
\n \n
\n \n
\n \n \n

What's new?

\n \n Multi-core support: PyTgCalls now supports multiple cores for enhanced performance.\n Remote version check: Added the ability to check for the latest version available on GitHub remotely.\n \n

Changes & Fixes

\n \n CustomAPI 2.0: Upgraded to CustomAPI version 2.0 with new features and improvements.\n Security Fix: Addressed a security vulnerability for a more secure experience.\n Function execution without Node.js Core waiting: Users can now call functions without waiting for the Node.js Core.\n \n
\n \n
\n \n
\n \n \n

Changes & Fixes

\n \n Fixed PyPi builds: Fixed an issue where PyTgCalls compiled without the JavaScript core\n Improved join_group_call error: The join_group_call error is now more descriptive\n \n \n
\n
\n
","/PyTgCalls/Client.xml": "\n

PyTgCalls Client

\n \n You now are in the API Reference section. Here you can find detailed information about PyTgCalls API:\n the main Client class, all available methods, types, attributes and decorators detailed descriptions can be found starting from this page.\n\n This page is about the Client class, which exposes high-level methods for easy access to the API.\n \n

Example

\n \n from pytgcalls import PyTgCalls\n\n app = PyTgCalls(client)\n app.start()\n \n \n

Details

\n \n \n class pytgcalls.PyTgCalls\n \n \n PyTgCalls Client, the main tool for interacting with Telegram Calls.\n
\n \n PARAMETERS\n \n app: Union[pyrogram.Client, telethon.TelegramClient, hydrogram.Client]\n Pass the MTProto Client\n cache_duration: int\n Cache duration of a Full Chat query\n \n \n
\n \n STATIC METHODS\n \n async calls -> dict[str, Call]\n \n\n async group_calls -> dict[str, Call]\n Get all group calls\n\n async private_calls -> dict[str, Call]\n Get all private calls\n\n cache_peer -> \n Get current Telegram user\n\n ping -> int\n Ping of NTgCalls core\n\n async cpu_usage -> float\n Get the CPU usage of the current process\n \n \n
\n \n RAISES\n \n exception pytgcalls.exceptions.InvalidMTProtoClient\n You set an invalid MTProto client.\n \n \n
\n\n
\n
","/PyTgCalls/Custom Api.xml": "\n

Custom API

\n \n You now are in the API Reference section where you can find detailed information about the Custom API:\n the Front-end API class, all available methods, types, attributes and decorators detailed descriptions can be found starting from this page.\n\n This page is about the CustomAPI class, which exposes high-level methods for easy access to the API.\n \n

Example

\n \n from pytgcalls import CustomApi\n\n api = CustomApi()\n\n @api.on_update_custom_api()\n async def custom_api_request(request: dict):\n print(request)\n return {\n 'response': 'FOXES',\n }\n api.start()\n \n \n

Details

\n \n \n class pytgcalls.CustomApi\n \n \n CustomApi, the main means host the local http api server.\n
\n \n PARAMETERS\n \n port: int\n CustomApi port of the http server\n \n \n
\n \n METHODS\n \n start()\n This method starts the internal http webserver, this is helpful if you need an API interface to PyTgCalls.\n \n \n
\n
\n
","/PyTgCalls/Decorators.xml": "\n

Decorators

\n \n While still being methods bound to the PyTgCalls class,\n decorators hold a special significance that justifies a dedicated page.\n\n Decorators allow you to register callback functions for handling updates in a much easier and cleaner way.\n All you need to do is add the decorators on top of your functions.\n \n \n from pytgcalls import PyTgCalls\n from pytgcalls.types import Update\n from pytgcalls import filters as call_filters\n ...\n client = # Here Your MTProto Client\n app = PyTgCalls(client)\n\n @app.on_update(call_filters.stream_end)\n async def handler(client: PyTgCalls, update: Update):\n print(update)\n\n app.run()\n \n \n

PyTgCalls Decorators

\n
\n \n @PyTgCalls.on_update()\n \n \n Decorator for handling all incoming updates.\n When any update is received, this decorator will be triggered.\n \n PARAMETERS\n \n filters: Optional[Filters]\n \n

Example

\n \n from pytgcalls.types import Update\n ...\n app = PyTgCalls(client)\n ...\n @app.on_update()\n async def handler(client: PyTgCalls, update: Update):\n print(chat_id)\n ...\n app.run()\n \n
\n
\n
\n

CustomApi Decorators

\n @CustomApi.on_update_custom_api()\n \n Decorator for handling incoming HTTP events.\n RAISES\n \n exception pytgcalls.exceptions.TooManyCustomApiDecorators\n You have set too many decorators.\n \n

Example

\n \n ...\n webserver = CustomApi(client)\n ...\n @webserver.on_update_custom_api()\n async def handler(request: dict):\n print(update)\n ... # Add Your Code here, switch or etc.\n return {\n 'result': 'OK',\n }\n webserver.start()\n idle()\n \n
\n
","/PyTgCalls/Examples.xml": "\n

Examples

\n \n This page contains example scripts to demonstrate how PyTgCalls looks like.\n\n Every script is working right away (assuming you correctly set up your credentials), meaning you can simply copy-paste them\n and run. The only things you have to modify are session names and target chats, where applicable.\n\n The examples listed below can be treated as building blocks for your own applications and are designed to be simple enough\n to give you a basic idea.\n \n \n \n \n Example\n Description\n \n \n additional_ffmpeg_parameters\n Append parameters to ffmpeg\n \n \n capture_mic\n Capture microphone\n \n \n custom_api\n Use custom API server to bind PHP or other API to PyTgCalls\n \n \n fifo_conversion\n Play a stream from fifo\n \n \n p2p_example\n Play a stream from a private call using PyTgCalls\n \n \n piped_audio_calls\n Play audio using ffmpeg for live conversion (with integrated ffmpeg)\n \n \n piped_image_calls\n Play audio and image using ffmpeg for live conversion (with integrated ffmpeg)\n \n \n raw_streaming\n Play PCM16L and RAW_VIDEO from disk\n \n \n remote_piped_play\n Play a stream from a remote link using ffmpeg for live conversion (with integrated ffmpeg)\n \n \n remote_stream_with_header\n Play a stream from a remote link using ffmpeg for live conversion (with integrated ffmpeg) with additional headers\n \n \n screen_sharing\n Screen sharing\n \n \n screen_sharing_mic\n Screen sharing with microphone\n \n \n simple_calls\n A simple example about using PyTgCalls with High Level Methods\n \n \n telethon_example\n A simple example about using PyTgCalls with Telethon\n \n \n video_calls\n Play audio and video using ffmpeg for live conversion (with integrated ffmpeg)\n \n \n youtube_dl\n Example usage of PyTgCalls with YoutubeDL\n \n
\n
","/PyTgCalls/Filters.xml": "\n

Filters

\n \n Filters are objects that can be used to filter the content of incoming updates.\n Read more about how filters work.\n \n

Details

\n \n pytgcalls.filters.create()\n \n \n Easily create a custom filter.\n\n Custom filters give you extra control over which updates are allowed or not to be processed by your handlers.\n \n
\n PARAMETERS\n \n func: callable\n \n \n A function that accepts three positional arguments (filter, client, update) and returns a boolean: True if the update\n should be handled, False otherwise. The filter argument refers to the filter itself and can be used to access keyword\n arguments (read below). The client argument refers to the Client that received the update. The update argument type will\n vary depending on which Handler is coming from. Your function body can then access the incoming update attributes and decide\n whether to allow it or not.\n \n \n name: Optional[str]\n \n \n Your filter\u2019s name. Can be anything you like. Defaults to \"CustomFilter\".\n \n \n **kwargs: Optional[Any]\n \n \n Any additional keyword arguments you want to pass to your filter function.\n \n \n \n
\n
\n pytgcalls.filters.me()\n \n \n Filter updates for yourself.\n \n \n
\n pytgcalls.filters.stream_end()\n \n \n Filter updates for when a stream ends.\n \n \n
\n pytgcalls.filters.chat()\n \n \n Filter updates coming from one or more chats.\n You can use set bound methods to manipulate the chats container.\n \n
\n PARAMETERS\n \n chats: Union[int, str, list]\n \n \n Pass one or more chat ids/usernames to filter chats. Defaults to None (no chats).\n \n \n \n
\n
\n pytgcalls.filters.chat_update()\n \n \n Filter specific type of chat updates.\n \n
\n PARAMETERS\n \n flags: ChatUpdate.Status\n \n \n Pass one or more flags to filter chat updates.\n \n \n \n
\n pytgcalls.filters.call_participant()\n \n \n Filter updates for when a call participant joins, leaves or is updated.\n \n
\n PARAMETERS\n \n flags: Optional[GroupCallParticipant.Action]\n \n \n Pass one or more flags to filter call participant updates.\n \n \n \n
\n
\n
","/PyTgCalls/Handling Updates.xml": "\n

Handling Updates

\n \n Calling API methods sequentially is cool, but what if, for example, the list of participants changes?\n This page covers updates and how to handle such events in PyTgCalls. Let\u2019s have a look at how they work.\n \n

Defining Updates

\n \n First of all, let's define what these updates are. As hinted earlier, updates are events that happen in PyTgCalls, such as\n joining a group call, changes in the participant list, stream ended etc. They are meant to notify you about a new\n specific state change. These updates are handled by registering one or more callback functions in your app\n using Decorators.\n\n Each handler deals with a specific event. When a matching update arrives from Telegram or NTgCalls, the registered callback\n function will be called back by the framework, and its body will execute.\n \n

Registering a Handler

\n \n To explain how handlers work, let's examine the one that will be in charge of handling StreamVideoEnded\n updates, which occur when a video stream ends. The same setup logic is shared with every type of handler, and you should not\n have troubles settings them up once you have learned from this section.\n \n

Using Decorators

\n The most elegant way to register a stream end handler is by using the on_stream_end() decorator:\n \n from pytgcalls import PyTgCalls, filters\n from pytgcalls.types import Update\n from pytgcalls.types import MediaStream\n ...\n app = PyTgCalls(client)\n\n @app.on_update(filters.stream_end)\n async def my_handler(client: PyTgCalls, update: Update):\n if isinstance(update, StreamVideoEnded):\n await pytgcalls.play(\n -1001185324811,\n stream=MediaStream(\n 'http://docs.evostream.com/sample_content/assets/sintel1m720p.mp4',\n )\n )\n\n app.run()\n \n \n The defined my_handler function, which accepts two arguments (client, update),\n will be executed whenever a new update arrives.\n \n \n You can mix def and async def handlers as much as you need,\n PyTgCalls will still work concurrently and efficiently regardless of what you choose.\n \n
","/PyTgCalls/Install Guide.xml": "\n

Install Guide

\n \n Being a modern Python library, PyTgCalls requires Python 3.8+ to be installed in your system.\n We recommend using the latest versions of both Python 3 and pip.\n \n \n Get Python 3 from the Python website or use your package manager.\n Get pip by following the instructions here.\n \n PyTgCalls only supports Python 3, starting from version 3.8.\n \n

Install PyTgCalls

\n The easiest way to install and upgrade PyTgCalls to its latest stable version is by using pip:\n \n $ pip3 install -U py-tgcalls\n \n

Bleeding Edge

\n \n PyTgCalls is always evolving: although new releases on PyPI are only published when a significant number of changes are added,\n this doesn\u2019t mean you can\u2019t try new features right now!\n\n In case you\u2019d like to try out the latest PyTgCalls\u2019 features, the GitHub repo is constantly updated with new changes;\n you can install the development version straight from the master branch using this command (note \u201cmaster.zip\u201d in the link):\n \n \n $ pip3 install -U git+https://github.com/pytgcalls/pytgcalls\n \n

Verifying

\n To verify that PyTgCalls is correctly installed, open a Python shell and import it. If no errors show up you are good to go.\n \n >>> import pytgcalls\n >>> pytgcalls.__version__\n ''\n \n
","/PyTgCalls/Media Devices.xml": "\n

Media Devices

\n \n This class offers methods to access information regarding media devices available on your system.\n This functionality proves valuable when you intend to stream content from either your screen or microphone.\n \n

Example

\n \n from pytgcalls import Client\n from pytgcalls import idle\n from pytgcalls.media_devices import MediaDevices\n ...\n\n app = PyTgCalls(client)\n app.start()\n\n ... # Call API methods\n\n app.play(\n -1001185324811,\n MediaStream(\n MediaDevices.get_audio_devices()[0],\n )\n )\n\n idle()\n \n \n

Details

\n \n \n class pytgcalls.MediaDevices\n \n \n MediaDevices, the main tool for retrieving media devices list.\n
\n \n METHODS\n \n get_audio_devices() -> list[pytgcalls.DeviceInfo]\n Retrieve a list of available audio input devices.\n\n get_screen_devices() -> list[pytgcalls.ScreenInfo]\n Retrieve a list of available screen devices\n \n \n
\n
\n
","/PyTgCalls/Quick Start.xml": "\n

Quick Start

\n The next few steps serve as a quick start for all new Pythoneers that want to see PyTgCalls in action as quickly as possible. Let\u2019s go!\n

Get PyTgCalls Real Fast

\n \n Install PyTgCalls with pip3 install -U py-tgcalls.\n \n Choose your MTProto client between PyrogramMod (ex Pyrogram),\n Telethon or Hydrogram.\n \n Get your own Telegram API key from my.telegram.org\n \n Open your favorite text editor and use the following:\n \n from pytgcalls import PyTgCalls\n from pytgcalls import idle\n from pytgcalls.types import MediaStream\n ...\n chat_id = -1001185324811\n app = PyTgCalls(client)\n app.start()\n app.play(\n chat_id,\n MediaStream(\n 'http://docs.evostream.com/sample_content/assets/sintel1m720p.mp4',\n )\n )\n idle()\n \n \n Replace client and chat_id values with your own.\n Save the file as main.py.\n Watch PyTgCalls playing the audio file.\n Join our community.\n \n

Enjoy the API

\n \n That was just a brief overview that barely scratched the surface!\n In the following few pages of the introduction,\n we\u2019ll have a much more in-depth look at what we have just done.\n\n Are you feeling eager to continue?\n You can take a shortcut to Call Methods and return later to learn more details.\n \n
","/PyTgCalls/Stream Descriptors/AudioParameters.xml": "\n

AudioParameters

\n
\n \n class pytgcalls.types.raw.AudioParameters\n \n \n \n
\n PARAMETERS\n \n bitrate: int\n \n\n channels: int\n \n \n
\n STATIC METHODS\n \n from_quality(quality: pytgcalls.types.AudioQuality)\n \n \n \n This method was deprecated on PyTgCalls 1.2.X, use directly\n pytgcalls.types.AudioQuality in MediaStream instead\n \n \n Create an AudioParameters instance from an AudioQuality enumeration.\n \n \n
\n
","/PyTgCalls/Stream Descriptors/AudioStream.xml": "\n

AudioStream

\n \n This class replaces the deprecated pytgcalls.types.raw.InputAudioStream.\n \n \n class pytgcalls.types.raw.AudioStream\n \n \n The raw audio stream (PCM16L) descriptor\n
\n PARAMETERS\n \n \n\n path: str\n The audio file path or shell command (PCM16L format only).\n\n parameters: pytgcalls.types.raw.AudioParameters\n \n \n
\n
","/PyTgCalls/Stream Descriptors/MediaStream.xml": "\n

MediaStream

\n
\n \n class pytgcalls.types.MediaStream\n \n \n The media stream piped descriptor.\n
\n PARAMETERS\n \n media_path: Union[str, ScreenInfo, DeviceInfo]\n The audio, video or media device path.\n\n \n \n\n audio_path: Optional[Union[str, DeviceInfo]]\n The audio or input audio device path.\n\n audio_flags: Optional[Flags]\n \n \n Flag used to control the handling of the audio stream in the media. It allows the system to decide whether to automatically detect, ignore, or require the audio stream.\n \n \n\n video_flags: Optional[Flags]\n \n \n Flag used to control the handling of the video stream in the media. It allows the system to decide whether to automatically detect, ignore, or require the video stream.\n \n \n\n \n ffmpeg_parameters: Optional[str]\n FFmpeg additional parameters.\n ytdlp_parameters: Optional[str]\n yt-dlp additional parameters.\n \n
\n
","/PyTgCalls/Stream Descriptors/Stream.xml": "\n

Stream

\n \n This class replaces the deprecated pytgcalls.types.InputStream.\n \n \n class pytgcalls.types.Stream\n \n \n Stream Descriptor.\n
\n PARAMETERS\n \n stream_audio: pytgcalls.types.raw.AudioStream\n Audio Stream Descriptor.\n\n stream_video: pytgcalls.types.raw.VideoStream\n Video Stream Descriptor.\n \n
\n
","/PyTgCalls/Stream Descriptors/VideoParameters.xml": "\n

VideoParameters

\n
\n \n class pytgcalls.types.raw.VideoParameters\n \n \n Stream\u2019s video parameters.\n
\n PARAMETERS\n \n \n\n frame_rate: int\n \n \n
\n STATIC METHODS\n \n from_quality(quality: pytgcalls.types.VideoQuality)\n \n \n \n This method was deprecated on PyTgCalls 1.2.X, use directly\n pytgcalls.types.VideoQuality in MediaStream instead\n \n \n Create an VideoParameters instance from an VideoQuality enumeration.\n \n \n
\n
","/PyTgCalls/Stream Descriptors/VideoStream.xml": "\n

VideoStream

\n \n This class replaces the deprecated pytgcalls.types.InputVideoStream.\n \n \n class pytgcalls.types.raw.VideoStream\n \n \n The raw video stream (YUV420P) descriptor\n
\n PARAMETERS\n \n \n\n path: str\n The video file path or shell command (YUV420P format only).\n\n parameters : pytgcalls.types.raw.VideoParameters\n \n \n
\n
","/PyTgCalls/Stream Methods/Mute Stream.xml": "\n

Mute Stream

\n This method allows muting the userbot via MTProto APIs.\n

Example

\n \n from pytgcalls import Client\n from pytgcalls import idle\n ...\n\n app = PyTgCalls(client)\n app.start()\n\n ... # Call API methods\n\n app.mute_stream(\n -1001185324811,\n )\n\n idle()\n \n \n

Details

\n \n PyTgCalls.mute_stream() -> bool\n \n \n Mute the userbot\n
\n \n PARAMETERS\n \n \n \n \n
\n \n RAISES\n \n \n \n \n
\n
","/PyTgCalls/Stream Methods/Pause Stream.xml": "\n

Pause Stream

\n This method allows pausing the streaming file.\n

Example

\n \n from pytgcalls import Client\n from pytgcalls import idle\n ...\n\n app = PyTgCalls(client)\n app.start()\n\n ... # Call API methods\n\n app.pause_stream(\n -1001185324811,\n )\n\n idle()\n \n \n

Details

\n \n PyTgCalls.pause_stream() -> bool\n \n \n Pause the stream\n
\n \n PARAMETERS\n \n \n \n \n
\n \n RAISES\n \n \n \n \n
\n
","/PyTgCalls/Stream Methods/Played Time.xml": "\n

Played Time

\n \n

Example

\n \n from pytgcalls import Client\n from pytgcalls import idle\n ...\n\n app = PyTgCalls(client)\n app.start()\n\n ... # Call API methods\n\n print(\n app.played_time(\n -1001185324811,\n )\n )\n\n idle()\n \n \n

Details

\n \n PyTgCalls.played_time() -> int\n \n \n \n
\n \n PARAMETERS\n \n \n \n \n
\n \n RAISES\n \n \n \n \n
\n
","/PyTgCalls/Stream Methods/Resume Stream.xml": "\n

Resume Stream

\n This method allows resuming the streaming file.\n

Example

\n \n from pytgcalls import Client\n from pytgcalls import idle\n ...\n\n app = PyTgCalls(client)\n app.start()\n\n ... # Call API methods\n\n app.resume_stream(\n -1001185324811,\n )\n\n idle()\n \n \n

Details

\n \n PyTgCalls.resume_stream() -> bool\n \n \n Resume the stream\n
\n \n PARAMETERS\n \n \n \n \n
\n \n RAISES\n \n \n \n \n
\n
","/PyTgCalls/Stream Methods/UnMute Stream.xml": "\n

UnMute Stream

\n This method allows unmuting the userbot via MTProto APIs\n

Example

\n \n from pytgcalls import Client\n from pytgcalls import idle\n ...\n\n app = PyTgCalls(client)\n app.start()\n\n ... # Call API methods\n\n app.unmute_stream(\n -1001185324811,\n )\n\n idle()\n \n \n

Details

\n \n PyTgCalls.unmute_stream() -> bool\n \n \n UnMute the userbot\n
\n \n PARAMETERS\n \n \n \n \n
\n \n RAISES\n \n \n \n \n
\n
","/PyTgCalls/Using Filters.xml": "\n

Using Filters

\n \n So far we\u2019ve seen how to register a decorator function that executes every time an update comes from the server,\n but there\u2019s much more than that to come.\n\n Here we\u2019ll discuss filters. Filters enable a fine-grain control over what kind of updates are allowed or\n not to be passed in your callback functions, based on their inner details.\n \n \n

Single Filters

\n Let\u2019s start right away with a simple example:\n \n \n \n This example will show you how to only handle updates that are an Incoming Call\n and ignore any other update. Filters are passed as the first argument of the decorator:\n \n from pytgcalls import filters\n from pytgcalls.types import ChatUpdate\n ...\n @pytgcalls.on_update(filters.chat_update(ChatUpdate.Status.INCOMING_CALL))\n def on_incoming_call(client, update):\n print(\"Incoming call!\", update)\n \n \n \n \n

Combining Filters

\n \n Filters can be used in a more advanced way by inverting and combining more filters together using bitwise operators ~, & and |:\n \n \n Use ~ to invert a filter (behaves like the not operator).\n \n \n Use & and | to combine filters together (behaves like the and and or operators).\n \n \n Here are some examples:\n \n \n \n This example will show you how to only handle updates that are left updates from a specific chat and ignore any other update:\n \n from pytgcalls import filters\n from pytgcalls.types import ChatUpdate\n ...\n @pytgcalls.on_update(~filters.chat_update(ChatUpdate.Status.LEFT_GROUP) & filters.chat(1234567890))\n def on_incoming_voice_call(client, update):\n print(\"Left chat!\", update)\n \n \n \n \n \n This example will show you how to only handle updates that are left updates or incoming call updates and from a specific chat:\n \n from pytgcalls import filters\n from pytgcalls.types import ChatUpdate\n ...\n @pytgcalls.on_update(filters.chat(1234567890) & (filters.chat_update(ChatUpdate.Status.LEFT_GROUP) | filters.chat_update(ChatUpdate.Status.INCOMING_CALL)))\n def on_incoming_voice_call(client, update):\n print(\"Incoming voice call or left chat!\", update)\n \n \n \n \n \n
"}