medea_flutter_webrtc 0.8.0-dev+rev.a909030f9a6378036bb0571611fc9a3fe44fe917 copy "medea_flutter_webrtc: ^0.8.0-dev+rev.a909030f9a6378036bb0571611fc9a3fe44fe917" to clipboard
medea_flutter_webrtc: ^0.8.0-dev+rev.a909030f9a6378036bb0571611fc9a3fe44fe917 copied to clipboard

outdated

Flutter WebRTC plugin for iOS/Android/Desktop/Web, based on GoogleWebRTC.

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]);
              })),
    );
  }

  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
63%
popularity

Publisher

verified publisherinstrumentisto.com

Flutter WebRTC plugin for iOS/Android/Desktop/Web, based on GoogleWebRTC.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

ffi, flutter, flutter_rust_bridge, freezed_annotation, js

More

Packages that depend on medea_flutter_webrtc