npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

skyway-multiparty

v1.0.4

Published

SkyWay js library for multi party apps

Downloads

5

Readme

SkyWay MultiParty

日本語 | English

SkyWay( http://nttcom.github.io/skyway/ )を用い、多人数参加のグループビデオチャットを簡単に開発できるライブラリです。

サンプル

// MultiParty インスタンスを生成
multiparty = new MultiParty( {
  "key": "********-****-****-****-************"  /* SkyWay keyを指定 */,
  "reliable": true /* data channel でreliable通信(sctp)を行う */
});

// for MediaStream
//

multiparty.on('my_ms', function(video) {
  // 自分のvideoを表示
  var vNode = MultiParty.util.createVideoNode(video);
  vNode.volume = 0;
  $(vNode).appendTo("#streams");
}).on('peer_ms', function(video) {
  // peerのvideoを表示
  var vNode = MultiParty.util.createVideoNode(video);
  $(vNode).appendTo("#streams");
}).on('ms_close', function(peer_id) {
  // peerが切れたら、対象のvideoノードを削除する
  $("#"+peer_id).remove();
})


// for DataChannel
//

$("button").on('click', function(ev) {
  multiparty.send('hello'); /* 接続中のピアにメッセージを送信 */
});

multiparty.on('message', function(mesg) {
  $("p.receive").append(mesg.data + "<br>"); /* 相手から受信したメッセージを表示 */
});

// サーバとpeerに接続
multiparty.start()

サンプルページ(local test)

  1. examples/multiparty-sample.html の57行目 'key' プロパティを各自のAPIKEYに変更(このとき、localhostをAPIKEYに登録してください)
  2. $ npm install
  3. $ npm run webpack-dev-server
  4. https://localhost:8081/examples/multiparty-sample.html を二つのブラウザウィンドウで開いてください

APIKEYは、https://skyway.io/ds/ に開発者登録することで入手できます。

サンプルページ

NPM インストール

$ npm install skyway-multiparty

webpackなどで利用する場合

const MultiParty = require('skyway-multiparty')

ダウンロード

APIリファレンス

MultiParty

var multiparty = new MultiParty([options]);
  • options
    • key (string)
      • API key(skywayから取得)。必須
    • room (string)
      • ルーム名。
    • id (string)
      • ユーザID。
    • reliable (boolean)
      • true : データチャンネルで信頼性のあるデータ転送を行う。デフォルト値はfalse。
    • selialization (string)
      • データシリアライゼーションモードを( binary | binary-utf8 | json | none )のいずれかにセットする。デフォルト値はbinary。
    • video (boolean)
      • true : ビデオストリーミングを許可する。デフォルト値はtrue。
    • audio (boolean)
      • true : オーディオストリーミングを許可する。デフォルト値はtrue。
    • polling (boolean)
      • true : サーバポーリングによるユーザリストのチェックを許可する。デフォルト値はtrue。
    • polling_interval (number)
      • ポーリング間隔(msec)を設定する。デフォルト値は3000。
    • debug (number)
      • コンソールに表示されるデバッグログレベルを設定する。
    0 ログを表示ない
    1 エラーだけ表示
    2 エラーと警告だけ表示
    3 すべてのログを表示
    • host (string)
      • peerサーバのホスト名。
    • port (number)
      • peerサーバのポート番号。
    • secure (boolean)
      • true: peerサーバとの接続にTLSを使用する。
    • config (object).
      • RTCPeerConnectionに渡されるオプション。ICEサーバの設定を行うことができる。初期値は{ 'iceServers': [{ 'url': 'stun:stun.skyway.io:3478' }] }

start

SkyWayサーバに接続し、peerに接続します。

multiparty.on

各種イベント発生時のコールバックを設定できます。

multiparty.on(event, callback);

'open'

multiparty.on('open', function(myid){ ... });
  • SkyWayサーバとのコネクションが確立した際に発生します。
  • id : 現在のウィンドウのid

'my_ms'

multiparty.on('my_ms', function({"src": <object url>, "id": <myid>}){...});
  • このウィンドウのvideo/audioストリームのセットアップが完了した際に発生します。
  • object url : キャプチャされたストリームのurl。
  • id : 現在のウィンドウのid。

'peer_ms'

multiparty.on('peer_ms', function({"src": <object url>, "id": <peer-id>, "reconnect": <true or false>}){ ... });
  • peerのvideo/audioストリームのセットアップが完了した際に発生します。
  • src : peerのストリームのオブジェクトURL。
  • id : peerのid。
  • reconnect : reconnectメソッドにより再接続された場合はtrueとなる。

'peer_ss'

multiparty.on('peer_ss', function({"src": <object url>, "id": <peer-id>, "reconnect": <true or false>}){ ... });
  • peerのスクリーンキャプチャストリームのセットアップが完了した際に発生します。
  • src : peerのスクリーンキャプチャストリームのオブジェクトURL。
  • id : peerのid。
  • reconnect :

'ms_close'

multiparty.on('ms_close', function(peer-id){ ... });
  • peerのメディアストリームがクローズした際に発生します。
  • peer-id : peerのid。

'ss_close'

multiparty.on('ss_close', function(peer-id){ ... });
  • peerのスクリーンキャストストリームがクローズした際に発生します。
  • peer-id : peerのid。

'dc_open'

multiparty.on('dc_open', function(peer-id){ ... });
  • データチャンネルのコネクションのセットアップが完了した際に発生します。
  • peer-id : peerのid。

'message'

multiparty.on('message', function({"id": <peer-id>, "data": <data>}){ ... });
  • peerからメッセージを受信した際に発生します。
  • peer-id : peerのid。
  • data : 受信したデータ。

'dc_close'

multiparty.on('dc_close', function(peer-id){ ... });
  • データコネクションがクローズした際に発生します。
  • peer-id : peerのid。

'error'

multiparty.on('error', function(error){ ... });
  • エラーが起きたら発生します。
  • error : 発生したErrorオブジェクト。

mute

自分の映像と音声をミュートすることができます。

multiparty.mute({"video": <true of false>, "audio": <true or false>);

unmute

自分の映像と音声をアンミュートすることができます。

multiparty.unmute({"video": <true of false>, "audio": <true or false>);

removePeer

peerのメディアストリームとデータストリームをクローズします。

multiparty.removePeer(peer-id);

send

peerにデータを送信します。

multiparty.send(data);

close

コネクションを全て切断します。

multiparty.close();

startScreenShare

画面共有を開始します。

multiparty.startScreenShare(function(stream){
  // success callback
}, function(err) {
  // error callback
});

stopScreenShare

画面共有を中断します。

multiparty.stopScreenShare();

listAllPeers

接続しているpeerのidを取得します。

multiparty.listAllPeers(function(lists) { ... });

reconnect

なんらかの原因でコネクションが切れてしまったpeerに再接続を行います。

multiparty.reconnect(peer_id, function({"video": <boolean>, "screen": <boolean>, "data": <boolean>}){ ... });

MultiParty.util.createVideoNode

オブジェクトURLからビデオノードを生成できます。

var vNode = MultiParty.util.createVideoNode({"src": object_url, "id": peer_id}){ ... });

LICENSE & Copyright

LICENSE