Skip to main content

appsocom_flutter 0.6.3 copy "appsocom_flutter: ^0.6.3" to clipboard
appsocom_flutter: ^0.6.3 copied to clipboard

Flutter client for Appsocom Live video calls - join rooms, camera and mic, video grid, controls, prejoin and classrooms. Built on flutter_webrtc.

example/lib/main.dart

// sfukit example: enter your Worker URL and a join token (from your backend's
// POST /tokens, or `npx sfukit token --room demo --user me`), then join.
// On the web you can also open ?url=...&token=... directly.
// ignore_for_file: deprecated_member_use
import 'package:flutter/material.dart';
import 'package:appsocom_flutter/appsocom_flutter.dart';

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

class ExampleApp extends StatelessWidget {
  const ExampleApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'sfukit',
      theme: ThemeData(colorSchemeSeed: const Color(0xFF4F8CFF), brightness: Brightness.dark, useMaterial3: true),
      home: const Home(),
    );
  }
}

class Home extends StatefulWidget {
  const Home({super.key});
  @override
  State<Home> createState() => _HomeState();
}

class _HomeState extends State<Home> {
  final _url = TextEditingController(text: Uri.base.queryParameters['url'] ?? '');
  final _token = TextEditingController(text: Uri.base.queryParameters['token'] ?? '');
  bool _inCall = false;

  @override
  void initState() {
    super.initState();
    _inCall = _url.text.isNotEmpty && _token.text.isNotEmpty;
  }

  @override
  Widget build(BuildContext context) {
    if (_inCall) {
      return Scaffold(
        body: VideoConference(
          url: _url.text.trim(),
          token: _token.text.trim(),
          onLeft: (_) {},
        ),
      );
    }
    return Scaffold(
      appBar: AppBar(title: const Text('sfukit')),
      body: ListView(padding: const EdgeInsets.all(16), children: [
        TextField(controller: _url, decoration: const InputDecoration(labelText: 'Worker URL', hintText: 'https://video.example.com')),
        const SizedBox(height: 12),
        TextField(controller: _token, decoration: const InputDecoration(labelText: 'Join token'), maxLines: 3, minLines: 1),
        const SizedBox(height: 16),
        FilledButton(
          onPressed: () => setState(() => _inCall = _url.text.trim().isNotEmpty && _token.text.trim().isNotEmpty),
          child: const Text('Continue'),
        ),
      ]),
    );
  }
}
0
likes
160
points
69
downloads

Documentation

Documentation
API reference

Publisher

unverified uploader

Weekly Downloads

Flutter client for Appsocom Live video calls - join rooms, camera and mic, video grid, controls, prejoin and classrooms. Built on flutter_webrtc.

Homepage

Topics

#video #webrtc #video-call

License

MIT (license)

Dependencies

flutter, flutter_webrtc, http, video_player, web_socket_channel

More

Packages that depend on appsocom_flutter