webrtc 0.0.1

  • README.md
  • CHANGELOG.md
  • Example
  • Installing
  • Versions
  • 50

webrtc

p2p vedio

Getting Started

For help getting started with Flutter, view our online documentation.

For help on editing plugin code, view the documentation.

0.0.1

  • TODO: Describe initial release.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'dart:async';

import 'package:flutter/services.dart';
import 'package:webrtc/webrtc.dart';
import 'webrtc_call.dart';

void main() => runApp(new MyApp());

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => new _MyAppState();
}

enum DialogDemoAction {
  cancel,
  connect,
}

class _MyAppState extends State<MyApp> {
  String _platformVersion = 'Unknown';

  String _serverAddress;

  void showDemoDialog<T>({BuildContext context, Widget child}) {
    showDialog<T>(
      context: context,
      builder: (BuildContext context) => child,
    ).then<void>((T value) {
      // The value passed to Navigator.pop() or null.
      if (value != null) {
        if (value == DialogDemoAction.connect) {
          Navigator.push(
              context,
              MaterialPageRoute(
                  builder: (BuildContext context) =>
                      CallSample(ip: _serverAddress)));
        }
      }
    });
  }

  _showAddressDialog(context) {
    showDemoDialog<DialogDemoAction>(
        context: context,
        child: new AlertDialog(
            title: const Text('Enter server address:'),
            content: TextField(
              onChanged: (String text) {
                setState(() {
                  _serverAddress = text;
                });
              },
              decoration: InputDecoration(
                hintText: _serverAddress,
              ),
              textAlign: TextAlign.center,
            ),
            actions: <Widget>[
              new FlatButton(
                  child: const Text('CANCEL'),
                  onPressed: () {
                    Navigator.pop(context, DialogDemoAction.cancel);
                  }),
              new FlatButton(
                  child: const Text('CONNECT'),
                  onPressed: () {
                    Navigator.pop(context, DialogDemoAction.connect);
                  })
            ]));
  }

  @override
  void initState() {
    super.initState();
    initPlatformState();
    printLogs();
  }

  void printLogs() async {
    print(await Webrtc.printLog(tag: "Karthik", msg: "This is Test Log")); // default logType
    print(await Webrtc.printLog(tag: "Karthik", msg: "This is Test Log", logType: Log.WARNING)); // logType = warning
    print(await Webrtc.printLog(tag: "Karthik", msg: "This is Test Log", logType: Log.ERROR)); // logType = error
    print(await Webrtc.printLog(tag: "Karthik", msg: "This is Test Log", logType: Log.DEBUG)); // logType = debug

  }

  // Platform messages are asynchronous, so we initialize in an async method.
  Future<void> initPlatformState() async {
    String platformVersion;
    // Platform messages may fail, so we use a try/catch PlatformException.
    try {
      platformVersion = await Webrtc.platformVersion;
    } on PlatformException {
      platformVersion = 'Failed to get platform version.';
    }

    // If the widget was removed from the tree while the asynchronous platform
    // message was in flight, we want to discard the reply rather than calling
    // setState to update our non-existent appearance.
    if (!mounted) return;

    setState(() {
      _platformVersion = platformVersion;
    });
  }

  @override
  Widget build(BuildContext context) {
    return new MaterialApp(
      home: new Scaffold(
        appBar: new AppBar(
          title: const Text('Plugin example app'),
        ),
        body: CallSample(ip: "demo.cloudwebrtc.com")
      ),
    );
  }
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  webrtc: ^0.0.1

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter packages get

Alternatively, your editor might support flutter packages get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:webrtc/webrtc.dart';
  
Version Uploaded Documentation Archive
0.0.1 Jul 20, 2018 Go to the documentation of webrtc 0.0.1 Download webrtc 0.0.1 archive
Popularity:
Describes how popular the package is relative to other packages. [more]
55
Health:
Code health derived from static analysis. [more]
29
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
70
Overall:
Weighted score of the above. [more]
50
Learn more about scoring.

We analyzed this package on Dec 5, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.1.0
  • pana: 0.12.7
  • Flutter: 1.0.0

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Health issues and suggestions

Fix lib/signaling.dart. (-58.86 points)

Analysis of lib/signaling.dart failed with 3 errors, 5 hints, including:

line 230 col 24: Undefined name 'JSON'.

line 355 col 38: Undefined name 'JSON'.

line 356 col 22: Undefined name 'JSON'.

line 1 col 8: Unused import: 'dart:convert'.

line 34 col 9: The value of the field '_timer' isn't used.

Document public APIs (-9.82 points)

272 out of 277 API elements (library, class, field or method) have no adequate dartdoc content. Good documentation improves code readability and discoverability through search.

Fix lib/rtc_data_channel.dart. (-1.99 points)

Analysis of lib/rtc_data_channel.dart reported 4 hints:

line 37 col 10: The value of the field '_label' isn't used.

line 57 col 13: The value of the local variable 'dataChannelId' isn't used.

line 63 col 13: The value of the local variable 'dataChannelId' isn't used.

line 64 col 16: The value of the local variable 'type' isn't used.

Fix lib/rtc_video_view.dart. (-1.49 points)

Analysis of lib/rtc_video_view.dart reported 3 hints:

line 22 col 8: The value of the field '_mirror' isn't used.

line 24 col 25: The value of the field '_objectFit' isn't used.

line 26 col 31: The value of the field '_eventSubscription' isn't used.

Fix additional 3 files with analysis or formatting issues. (-1.50 points)

Additional issues in the following files:

  • lib/get_user_media.dart (1 hint)
  • lib/media_stream.dart (1 hint)
  • lib/rtc_peerconnection.dart (1 hint)

Maintenance suggestions

The description is too short. (-20 points)

Add more detail about the package, what it does and what is its target use case. Try to write at least 60 characters.

Package is pre-v0.1 release. (-10 points)

While there is nothing inherently wrong with versions of 0.0.*, it usually means that the author is still experimenting with the general direction of the API.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.35.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.11
meta 1.1.6
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8