パッケージ、リポジトリ、アプリカテゴリを検索

パッケージ詳細v0.5.6

peerdart

Dart用のシンプルなピアツーピアWebRTC。Flutter用のPeerJSポート。

AndroidiOSmacOSWindowsLinux
30日間ダウンロード
481
いいね数
78
Pub ポイント
135

パッケージをインストール

flutter pub add peerdart

パッケージ概要

公開情報に基づく選定ガイドです。参考としてご利用ください。

peerdart は、WebRTC を使用して簡単なピアツーピア通信を可能にする Dart パッケージであり、PeerJS の Flutter互換版です。中央サーバーによるルーティングを必要とせず、デバイス間でリアルタイムのデータおよびメディアのやり取りを実現します。低遅延接続を想定しており、Android、iOS、macOS、Windows、Linux など複数のプラットフォームでのデバイス間直接通信をサポートしています。ビデオ通話、ライブストリーミング、共同作業ツールなどの即時接続が必要なアプリケーションに最適です。

用途

  • リアルタイム動画通話
  • ライブストリーミング
  • 共同作業アプリケーション
  • デバイスへの直接メッセージ
  • WebRTCベースのチャットアプリ

主な機能

  • WebRTC対応のP2P接続
  • クロスプラットフォーム対応
  • PeerJS に似たシンプルな API
  • データおよびメディアチャネルをサポート
  • 自動 ICE/STUN ハンドリング

適している対象

  • Flutterでリアルタイムアプリを開発する開発者
  • 直接的なデバイス通信を必要とするプロジェクト
  • 複数のオペレーティングシステムをターゲットにするアプリ
  • WebRTC機能のプロトタイピング
  • 低遅延のインタラクティブ体験

注意事項

  • ネットワーク構成(ファイアウォール/NAT)が必要です
  • 接続設定にはシグナリングサーバーに依存します
  • 限定されたブラウザサポート(Flutter専用)
  • パフォーマンスはネットワークの品質によって異なります
  • NATトラバーサルにはTURNサーバーが必要になる場合があります

元の README

関連するソースリポジトリの README 原文のスナップショットです。最新の内容はリポジトリをご覧ください。

PeerDart: Simple peer-to-peer with WebRTC

PeerDart provides a complete, configurable, and easy-to-use peer-to-peer API built on top of WebRTC, supporting both data channels and media streams.

PeerDart mirrors the design of peerjs. Find the documentation here..

Status

  • [x] Alpha: Under heavy development
  • [x] Public Alpha: Ready for testing. But go easy on us, there will be bugs and missing functionality.
  • [ ] Public Beta: Stable. No breaking changes expected in this version but possible bugs.
  • [ ] Public: Production-ready

Live Example

Here's an example application that uses both media and data connections: Example

Setup

Create a Peer

final Peer peer = Peer("pick-an-id");
// You can pick your own id or omit the id if you want to get a random one from the server.

Data connections

Connect

const conn = peer.connect("another-peers-id");

conn.on("open").listen((name) {
    conn.send("hi!");
})

Receive

peer.on<DataConnection>("connection").listen((connection) {

    // On peer closed.
    conn.on("close").listen((event) {
        setState(() {
            connected = false;
        });
    });

    // ....
})

Media calls

Call

final mediaStream = await navigator.mediaDevices
        .getUserMedia({"video": true, "audio": false});

    final conn = peer.call("peerId", mediaStream);

    // Do some stuff with stream
    conn.on<MediaStream>("stream").listen((event) {
      _remoteRenderer.srcObject = event;
      _localRenderer.srcObject = mediaStream;

      setState(() {
        inCall = true;
      });
    });
});

Answer

peer.on<MediaConnection>("call").listen((call) async {
    final mediaStream = await navigator.mediaDevices
        .getUserMedia({"video": true, "audio": false});

    call.answer(mediaStream);


    // on peer closed
    call.on("close").listen((event) {
        setState(() {
            inCall = false;
        });
    });

    // Get peer stream
    call.on<MediaStream>("stream").listen((event) {
        _localRenderer.srcObject = mediaStream;
        _remoteRenderer.srcObject = event;

        setState(() {
            inCall = true;
        });
    });
});

More examples

See more at example.

Support

Works both on mobile and web browsers (Chrome tested.).

Links

Documentation / API Reference
PeerServer

License

PeerDart is licensed under the MIT License.

カテゴリー

依存関係

依存関係一覧 5 件

ソースリポジトリ

このパッケージを使用しているプロジェクト