ntgcalls_flutter 1.0.0 copy "ntgcalls_flutter: ^1.0.0" to clipboard
ntgcalls_flutter: ^1.0.0 copied to clipboard

PlatformAndroid

Transport-only Flutter binding to the ntgcalls media engine for 1:1 Telegram-style P2P voice and video calls. Pair it with a signaling layer (e.g. TDLib) that performs call setup and Diffie-Hellman ke [...]

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:ntgcalls_flutter/tgcalls.dart';
import 'package:ntgcalls_flutter/tgcalls_method_channel.dart';

void main() => runApp(const TgCallsExampleApp());

/// Minimal app that warms up the engine and shows its supported protocol
/// versions. Placing a real call additionally needs a signaling layer
/// (e.g. TDLib) to perform call setup and the Diffie-Hellman key exchange.
class TgCallsExampleApp extends StatelessWidget {
  const TgCallsExampleApp({super.key});

  @override
  Widget build(BuildContext context) => MaterialApp(
        title: 'tgcalls example',
        theme: ThemeData(
          colorScheme: ColorScheme.fromSeed(seedColor: Colors.indigo),
        ),
        home: const _HomePage(),
      );
}

class _HomePage extends StatefulWidget {
  const _HomePage();

  @override
  State<_HomePage> createState() => _HomePageState();
}

class _HomePageState extends State<_HomePage> {
  final TgCallsEngine _engine = MethodChannelTgCalls();
  List<String>? _versions;

  Future<void> _warmUp() async {
    if (_engine case final MethodChannelTgCalls engine) {
      await engine.warmUp();
    }
    setState(() => _versions = _engine.supportedVersions);
  }

  @override
  Widget build(BuildContext context) => Scaffold(
        appBar: AppBar(title: const Text('tgcalls example')),
        body: Center(
          child: Column(
            mainAxisSize: MainAxisSize.min,
            children: <Widget>[
              Text(
                _versions == null
                    ? 'Press the button to query the engine.'
                    : 'Supported versions: ${_versions!.join(', ')}',
                textAlign: TextAlign.center,
              ),
              const SizedBox(height: 16),
              FilledButton(
                onPressed: _warmUp,
                child: const Text('Warm up engine'),
              ),
            ],
          ),
        ),
      );
}
1
likes
150
points
9
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

Transport-only Flutter binding to the ntgcalls media engine for 1:1 Telegram-style P2P voice and video calls. Pair it with a signaling layer (e.g. TDLib) that performs call setup and Diffie-Hellman key exchange.

Homepage
Repository (GitHub)
View/report issues

Topics

#telegram #calls #webrtc #voip #ntgcalls

License

MIT (license)

Dependencies

flutter

More

Packages that depend on ntgcalls_flutter

Packages that implement ntgcalls_flutter