medea_flutter_webrtc 0.8.1-dev+rev.0e22a7b5d33796574a996704217ea8e88ec7832c copy "medea_flutter_webrtc: ^0.8.1-dev+rev.0e22a7b5d33796574a996704217ea8e88ec7832c" to clipboard
medea_flutter_webrtc: ^0.8.1-dev+rev.0e22a7b5d33796574a996704217ea8e88ec7832c copied to clipboard

Flutter WebRTC plugin for Android/iOS/macOS/Linux/Windows/Web, based on GoogleWebRTC, designed for and used in Medea Jason WebRTC client.

example/lib/main.dart

import 'dart:core';

import 'package:flutter/material.dart';

import 'src/create_peer_connection.dart';
import 'src/get_display_media.dart';
import 'src/get_sources.dart';
import 'src/get_user_media.dart'
    if (dart.library.html) 'src/get_user_media_sample_web.dart';
import 'src/loopback.dart';
import 'src/on_device_change.dart';
import 'src/route_item.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatefulWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  late List<RouteItem> items;

  @override
  void initState() {
    super.initState();
    _initItems();
  }

  ListBody _buildRow(context, item) {
    return ListBody(children: <Widget>[
      ListTile(
        title: Text(item.title),
        onTap: () => item.push(context),
        trailing: const Icon(Icons.arrow_right),
      ),
      const Divider()
    ]);
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
          appBar: AppBar(
            title: const Text('Flutter-WebRTC example'),
          ),
          body: ListView.builder(
              shrinkWrap: true,
              padding: const EdgeInsets.all(0.0),
              itemCount: items.length,
              itemBuilder: (context, i) {
                return _buildRow(context, items[i]);
              })),
      debugShowCheckedModeBanner: false,
    );
  }

  void _initItems() {
    items = <RouteItem>[
      RouteItem(
          title: 'GetUserMedia',
          push: (BuildContext context) {
            Navigator.push(
                context,
                MaterialPageRoute(
                    builder: (BuildContext context) =>
                        const GetUserMediaSample()));
          }),
      RouteItem(
          title: 'GetDisplayMedia',
          push: (BuildContext context) {
            Navigator.push(
                context,
                MaterialPageRoute(
                    builder: (BuildContext context) =>
                        const GetDisplayMediaSample()));
          }),
      RouteItem(
          title: 'LoopBack Sample',
          push: (BuildContext context) {
            Navigator.push(
                context,
                MaterialPageRoute(
                    builder: (BuildContext context) => const Loopback()));
          }),
      RouteItem(
          title: 'getSources',
          push: (BuildContext context) {
            Navigator.push(
                context,
                MaterialPageRoute(
                    builder: (BuildContext context) =>
                        const GetSourcesSample()));
          }),
      RouteItem(
          title: 'Basic RtcPeerConnection',
          push: (BuildContext context) {
            Navigator.push(
                context,
                MaterialPageRoute(
                    builder: (BuildContext context) =>
                        const PeerConnectionSample()));
          }),
      RouteItem(
          title: 'onDeviceChange notifier',
          push: (BuildContext context) {
            Navigator.push(
                context,
                MaterialPageRoute(
                    builder: (BuildContext context) =>
                        const OnDeviceChangeNotifierSample()));
          }),
    ];
  }
}
10
likes
0
pub points
65%
popularity

Publisher

verified publisherinstrumentisto.com

Flutter WebRTC plugin for Android/iOS/macOS/Linux/Windows/Web, based on GoogleWebRTC, designed for and used in Medea Jason WebRTC client.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

collection, ffi, flutter, flutter_rust_bridge, freezed_annotation, js, meta, uuid

More

Packages that depend on medea_flutter_webrtc