webrtc 0.0.1

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

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 pub get

Alternatively, your editor might support flutter pub 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]
60
Health:
Code health derived from static analysis. [more]
37
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
65
Overall:
Weighted score of the above. [more]
54
Learn more about scoring.

We analyzed this package on Jun 25, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.3.2
  • pana: 0.12.18
  • Flutter: 1.5.4-hotfix.2

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Health issues and suggestions

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

Analysis of lib/signaling.dart failed with 3 errors, 10 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 27 col 10: Name non-constant identifiers using lowerCamelCase.

Document public APIs. (-0.50 points)

287 out of 292 API elements have no dartdoc comment.Providing good documentation for libraries, classes, functions, and other API elements improves code readability and helps developers find and use your API.

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.99 points)

Analysis of lib/rtc_video_view.dart reported 4 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.

line 26 col 31: Cancel instances of dart.async.StreamSubscription.

Fix additional 9 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)
  • lib/rtc_dtmf_sender.dart (Run flutter format to format lib/rtc_dtmf_sender.dart.)
  • lib/rtc_ice_candidate.dart (Run flutter format to format lib/rtc_ice_candidate.dart.)
  • lib/rtc_peerconnection_factory.dart (Run flutter format to format lib/rtc_peerconnection_factory.dart.)
  • lib/rtc_session_description.dart (Run flutter format to format lib/rtc_session_description.dart.)
  • lib/rtc_stats_report.dart (Run flutter format to format lib/rtc_stats_report.dart.)
  • lib/webrtc.dart (Run flutter format to format lib/webrtc.dart.)

Maintenance issues and suggestions

Support latest dependencies. (-5 points)

The version constraint in pubspec.yaml does not support the latest published versions for 1 dependency.

The package description is too short. (-20 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.

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

While nothing is inherently wrong with versions of 0.0.*, it might mean 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 1.1.7
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8