simplewebrtc_flutter_webrtc_shim 0.2.9

  • Readme
  • Changelog
  • Example
  • Installing
  • 65

Flutter-WebRTC #

This is a fork of

Changelog #


  • Fix podspec


  • Fix package paths


  • Publish compilation error fix

[0.2.6] - 2020.02.03

  • Fixed the interruption of the Bluetooth headset that was playing music after the plugin started.

[0.2.4] - 2020.02.03

  • Fixed bug.

[0.2.3] - 2020.02.03

  • Fixed bug for enableSpeakerphone (Android/iOS).
  • Fix RtcVideoView not rebuild when setState called and renderer is changed.
  • Fix Android frame orientation.

[0.2.2] - 2019.12.13

  • Removed the soft link of WebRTC.framework to fix compile errors of macos version when third-party flutter app depends on plugins

[0.2.1] - 2019.12.12

  • Code format.
  • Remove unused files.

[0.2.0] - 2019.12.12

  • Add support for macOS (channel dev).
  • Add support for Flutter Web (channel dev).
  • Add hasTorch support for Android (Camera2 API) and iOS.
  • Fix(PeerConnections) split dispose and close
  • Add microphone mute support for Android/iOS.
  • Add enable speakerphone support for Android/iOS.
  • Fix 'createIceServer' method Invalid value error (Android).
  • Store SignalingState/IceGatheringState/IceConnectionState in RTCPeerConnection.
  • Fixed rendering issues caused by remote MediaStream using the same msid/label when using multiple PeerConntions.

[0.1.7] - 2019.05.16

  • Add RTCDataChannelMessage for data channel and remove base64 type.
  • Add streaming API for datachannel messages and state changes.
  • Remove cloudwebrtc prefix in the plugin method/event channel name.
  • Other bug fixes.

[0.1.6] - 2019.03.31

  • Add getConfiguration/setConfiguration methods for Peerconnection.
  • Add object fit for RTCVideoView.

[0.1.5] - 2019.03.27

  • Remove unnecessary parameter for getLocalDescription method.

[0.1.4] - 2019.03.26

  • switchCamera method now returns future with isFrontCamera as result
  • Fix camera stuck in rare cases
  • Add getLocalDescription/getRemoteDescription methods

[0.1.3] - 2019.03.25

  • Add horizontal flip (mirror) function for RTCVideoView.
  • Fixed ScreenCapture preview aspect ratio for Android.

[0.1.2] - 2019.03.24

  • Fix compilation failure caused by invalid code.

[0.1.1] - 2019.03.24

  • Migrated to AndroidX using Refactoring from Andoid Studio
  • Fix mediaStreamTrackSetEnable not working.
  • Fix iOS can't render video when resolution changes.
  • Some code style changes.

[0.1.0] - 2019.01.21

  • Fix camera switch issues.
  • Support data channel, please use the latest demo to test.
  • Support screen sharing, but the work is not perfect, there is a problem with the local preview.

[0.0.3] - 2018.12.20

  • Update WebRTC to 1.0.25821.
  • Implemented MediaStreamTrack.setVolume().
  • Add public getter for texture id.
  • Fixed getUserMedia does not work for capturing audio only.

[0.0.2] - 2018.11.04

  • Add 'enabled' method for MediaStreamTrack.
  • Implement switch camera.
  • Add arm64-v8a and x86_64 architecture support for android.

[0.0.1] - 2018.05.30

  • Initial release.


import 'dart:core';
import 'package:flutter/material.dart';
import 'package:flutter/foundation.dart'
    show debugDefaultTargetPlatformOverride;
import 'package:simplewebrtc_flutter_webrtc_shim/webrtc.dart';

import 'src/loopback_sample.dart';
import 'src/get_user_media_sample.dart'
    if (dart.library.js) 'src/get_user_media_sample_web.dart';
import 'src/get_display_media_sample.dart';
import 'src/data_channel_sample.dart';
import 'src/route_item.dart';

void main() {
  if (WebRTC.platformIsDesktop)
    debugDefaultTargetPlatformOverride = TargetPlatform.fuchsia;
  runApp(new MyApp());

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

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

  initState() {

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

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

  _initItems() {
    items = <RouteItem>[
          title: 'GetUserMedia',
          push: (BuildContext context) {
                new MaterialPageRoute(
                    builder: (BuildContext context) =>
                        new GetUserMediaSample()));
          title: 'GetDisplayMedia',
          push: (BuildContext context) {
                new MaterialPageRoute(
                    builder: (BuildContext context) =>
                        new GetDisplayMediaSample()));
          title: 'LoopBack Sample',
          push: (BuildContext context) {
                new MaterialPageRoute(
                    builder: (BuildContext context) => new LoopBackSample()));
          title: 'DataChannel',
          push: (BuildContext context) {
                new MaterialPageRoute(
                    builder: (BuildContext context) =>
                        new DataChannelSample()));

Use this package as a library

1. Depend on it

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

  simplewebrtc_flutter_webrtc_shim: ^0.2.9

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:simplewebrtc_flutter_webrtc_shim/enums.dart';
import 'package:simplewebrtc_flutter_webrtc_shim/get_user_media.dart';
import 'package:simplewebrtc_flutter_webrtc_shim/media_recorder.dart';
import 'package:simplewebrtc_flutter_webrtc_shim/media_stream.dart';
import 'package:simplewebrtc_flutter_webrtc_shim/media_stream_track.dart';
import 'package:simplewebrtc_flutter_webrtc_shim/rtc_data_channel.dart';
import 'package:simplewebrtc_flutter_webrtc_shim/rtc_dtmf_sender.dart';
import 'package:simplewebrtc_flutter_webrtc_shim/rtc_ice_candidate.dart';
import 'package:simplewebrtc_flutter_webrtc_shim/rtc_peerconnection.dart';
import 'package:simplewebrtc_flutter_webrtc_shim/rtc_peerconnection_factory.dart';
import 'package:simplewebrtc_flutter_webrtc_shim/rtc_session_description.dart';
import 'package:simplewebrtc_flutter_webrtc_shim/rtc_stats_report.dart';
import 'package:simplewebrtc_flutter_webrtc_shim/rtc_video_view.dart';
import 'package:simplewebrtc_flutter_webrtc_shim/utils.dart';
import 'package:simplewebrtc_flutter_webrtc_shim/web/get_user_media.dart';
import 'package:simplewebrtc_flutter_webrtc_shim/web/media_recorder.dart';
import 'package:simplewebrtc_flutter_webrtc_shim/web/media_stream.dart';
import 'package:simplewebrtc_flutter_webrtc_shim/web/media_stream_track.dart';
import 'package:simplewebrtc_flutter_webrtc_shim/web/rtc_data_channel.dart';
import 'package:simplewebrtc_flutter_webrtc_shim/web/rtc_ice_candidate.dart';
import 'package:simplewebrtc_flutter_webrtc_shim/web/rtc_peerconnection.dart';
import 'package:simplewebrtc_flutter_webrtc_shim/web/rtc_peerconnection_factory.dart';
import 'package:simplewebrtc_flutter_webrtc_shim/web/rtc_session_description.dart';
import 'package:simplewebrtc_flutter_webrtc_shim/web/rtc_video_view.dart';
import 'package:simplewebrtc_flutter_webrtc_shim/web/utils.dart';
import 'package:simplewebrtc_flutter_webrtc_shim/webrtc.dart';
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

We analyzed this package on May 30, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.8.2
  • pana: 0.13.8-dev
  • Flutter: 1.17.1

Health suggestions

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

Analysis of lib/rtc_data_channel.dart reported 2 hints:

line 12 col 7: The declaration '_messageTypeToTypeString' isn't referenced.

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

Fix lib/rtc_peerconnection.dart. (-1 points)

Analysis of lib/rtc_peerconnection.dart reported 2 hints:

line 314 col 39: Don't explicitly initialize variables to null.

line 346 col 35: The value of the local variable 'response' isn't used.

Fix lib/web/rtc_data_channel.dart. (-1 points)

Analysis of lib/web/rtc_data_channel.dart reported 2 hints:

line 8 col 7: The declaration '_typeStringToMessageType' isn't referenced.

line 13 col 7: The declaration '_messageTypeToTypeString' isn't referenced.

Fix additional 5 files with analysis or formatting issues. (-3.50 points)

Additional issues in the following files:

  • lib/web/rtc_peerconnection.dart (2 hints)
  • lib/web/rtc_video_view.dart (2 hints)
  • lib/get_user_media.dart (1 hint)
  • lib/rtc_video_view.dart (1 hint)
  • lib/web/get_user_media.dart (1 hint)

Maintenance issues and suggestions

Homepage URL doesn't exist. (-20 points)

At the time of the analysis the homepage field was unreachable.

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 Constraint Resolved Available
Direct dependencies
Dart SDK >=2.2.2 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.12
meta 1.1.8
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8