simple_peer 0.0.14 copy "simple_peer: ^0.0.14" to clipboard
simple_peer: ^0.0.14 copied to clipboard

Simple WebRTC. Similar to the simple-peer project in javascript.

Simple WebRTC. Wraps flutter_webrtc similar to simple-peer

IMPORTANT: Right now this library only supports data channels (and not media). Contributions welcome!

Getting started #

Read more about how to get started with webrtc in flutter_webrtc or the javascript simple-peer

Roadmap #

  • Support media (in addition to currently supported data channels)
  • Support batching large data (such as sending files byte by byte)

Usage #

var peer1 = Peer(initiator: true);
var peer2 = Peer();

peer1.onSignal = (data) async {
  // When peer1 has signaling data, give it to peer2 somehow
  // https://developer.mozilla.org/en-US/docs/Web/API/WebRTC_API/Signaling_and_video_calling#the_signaling_server
  await peer2.signal(data);
};

peer2.onSignal = (data) async {
  // When peer2 has signaling data, give it to peer1 somehow
  // https://developer.mozilla.org/en-US/docs/Web/API/WebRTC_API/Signaling_and_video_calling#the_signaling_server
  await peer1.signal(data);
};

peer2.onData = (data) async {
  print(data); // hello!
};

peer2.connect();
await peer1.connect();

await peer1.send('hello!');

Release #

8
likes
140
pub points
73%
popularity

Publisher

verified publisherflown.io

Simple WebRTC. Similar to the simple-peer project in javascript.

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-3-Clause (LICENSE)

Dependencies

flutter, flutter_webrtc

More

Packages that depend on simple_peer