tgcalls 0.1.0

Telegram voice and video calls, powered by NTgCalls.
docs.rs failed to build tgcalls-0.1.0
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Visit the last successful build: tgcalls-0.0.0
  • Group calls
  • P2P calls
  • Screen sharing
  • Broadcast reception

All the power of NTgCalls with a Rust-native API.

Add to your project

[dependencies]
tgcalls = ">= 0.1.0"

Requires curl and unzip at build time to download the prebuilt NTgCalls library. Works on Linux x86_64, Linux aarch64 (including Termux), Windows x86_64, and macOS aarch64. See docs/build.md for details.

Usage

use tgcalls::{TgCalls, MediaDescription, AudioDescription, MediaSource, StreamMode};

let tg = TgCalls::try_new()?;

// get params JSON for phone.joinGroupCall
let params = tg.create(chat_id)?;

// after Telegram returns the transport JSON
tg.connect(chat_id, transport_json, false)?;

tg.set_stream_sources(chat_id, StreamMode::Capture, MediaDescription {
    microphone: Some(AudioDescription::new(
        MediaSource::File, "/path/to/audio.raw", 48000, 2, false,
    )),
    ..Default::default()
})?;

tg.stop(chat_id)?;

For P2P calls, see docs/p2p-flow.md.

Version compatibility

TgCalls::try_new() checks that the loaded NTgCalls shared library matches the version this crate was built against. It returns an error if they don't match, catching layout mismatches before they cause wrong behavior at runtime.

Docs

Read these in order for the full picture:

  1. docs/architecture.md - crate layout and how the pieces fit together
  2. docs/build.md - platform requirements and env vars
  3. docs/p2p-flow.md - P2P call flow step by step
  4. docs/upgrade.md - how to upgrade ntgcalls

Run cargo doc --open for the full API reference.

Contributing

Issues and PRs are welcome. If you're adding support for a new ntgcalls feature, read docs/upgrade.md first. It covers how bindings are generated and what needs to change together.

License

MIT or Apache 2.0, at your option.