SkyWay MultiParty
This is a library for easy implementation of group video chat with SkyWay(http://nttcom.github.io/skyway/).
Sample
// Generate a MultiParty instance.multiparty = "key": "********-****-****-****-************" /* SkyWay key */ "reliable": true /* Use reliable communication(SCTP) in Data Channel. */; // for MediaStream// multiparty // for DataChannel// ; multiparty; // Connect to the server and peersmultipartystart
Demo page(local test)
- update your own APIKEY in line 57 of
examples/multiparty-sample.html
. (Please be sure thatlocalhost
is registered in your APIKEY setting) $ npm install
$ npm run webpack-dev-server
- open https://localhost:8081/examples/multiparty-sample.html in two browser window.
In case you don't have APIKEY, please sign-up SkyWay account and obtain API key at https://skyway.io/ds/.
Demo Page
Installing with NPM
$ npm install skyway-multiparty
Using with webpack etc.
const MultiParty =
Download
API reference
MultiParty
var multiparty = options;
-
options
- key (string)
- an API key obtained from SkyWay Web Site
- room (string)
- room name
- id (string)
- user id
- reliable (boolean)
- true indicates reliable data transfer (data channel).
default : false
- true indicates reliable data transfer (data channel).
- selialization (string)
- set data selialization mode ( binary | binary-utf8 | json | none ).
default : binary
- set data selialization mode ( binary | binary-utf8 | json | none ).
- video (boolean)
- true indicates video streaming is enabled.
default: true
- true indicates video streaming is enabled.
- audio (boolean)
- true indicates audio streaming is enabled.
default: true
- true indicates audio streaming is enabled.
- polling (boolean)
- true indicates check user list via server polling.
default: true
- true indicates check user list via server polling.
- polling_interval (number)
- polling interval in msec order.
default: 3000
- polling interval in msec order.
- debug (number)
- debug log level appeared in console.
0 Prints no logs. 1 Prints only errors. 2 Prints errors and warnings. 3 Prints all logs.
- host (string)
- peer server host name.
- port (number)
- peer server port number.
- secure (boolean)
- true means peer server provide tls.
- config (object)
- passed to RTCPeerConnection. it indicates custom ICE server configuration. Defaults to
{ 'iceServers': [{ 'url': 'stun:stun.skyway.io:3478' }] }
.
- passed to RTCPeerConnection. it indicates custom ICE server configuration. Defaults to
- key (string)
start
Connect to the SkyWay server and all peers.
multiparty.on
multiparty;
'open'
multiparty;
- Emitted when a connection to SkyWay server has established.
- id : id of current window.
'my_ms'
multiparty;
- Emitted when this window's video/audio stream has setuped. object url is the url for captured stream. id is current window's id.
- object url : url for captured stream.
- id : current window's id.
'peer_ms'
multiparty;
- Emitted when peer's av stream has setuped.
- src : Object URL of peer's stream.
- id : peer's id.
- reconnect : true when connected via reconnect method.
'peer_ss'
multiparty;
- Emitted when peer's screen captrure stream has setuped.
- src : Object URL of peer's screen capture stream.
- id : peer's id.
- reconnect : true when connected via reconnect method.
'ms_close'
multiparty;
- Emitted when peer's media stream has closed.
- peer-id : peer's id.
'ss_close'
multiparty;
- Emitted when peer's screen cast stream has closed.
- peer-id : peer's id.
'dc_open'
multiparty;
- Emitted when the connection for data channel with peer is setuped.
- peer-id : peer's id.
'message'
multiparty;
- Emitted when receive message from peer.
- peer-id : peer's id.
- data : Received data.
'dc_close'
multiparty;
- Emitted when data connection has closed with peer.
- peer-id : peer's id.
'error'
multiparty;
- Emitted when an error occurs.
- error : Error object.
mute
Mute current video/audio.
multiparty
unmute
Unmute current video/audio.
multiparty
removePeer
Close peer's media stream and data stream.
multiparty;
send
Send data to every peer.
multiparty;
close
Close every connection.
multiparty;
startScreenShare
Start screen share.
multiparty;
stopScreenShare
Stop screen share.
multiparty;
listAllPeers
Get all of the connected peer ids.
multiparty;
reconnect
Reconnect the disconnected peer.
multiparty;
MultiParty.util.createVideoNode
Create video node from Object URL.
var vNode = MultiPartyutil ... );