Skip to content

Commit

Permalink
Merge pull request #250 from RationalCoding/addStream
Browse files Browse the repository at this point in the history
changing tracks, multistreaming and renegotiation
  • Loading branch information
rationalcoding authored Mar 28, 2018
2 parents 7001cc7 + 644d5a0 commit 461ed97
Show file tree
Hide file tree
Showing 5 changed files with 736 additions and 51 deletions.
30 changes: 30 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ If `opts` is specified, then the default options (shown below) will be overridde
reconnectTimer: false,
sdpTransform: function (sdp) { return sdp },
stream: false,
streams: [],
trickle: true,
wrtc: {}, // RTCPeerConnection/RTCSessionDescription/RTCIceCandidate
objectMode: false
Expand All @@ -236,6 +237,7 @@ The options do the following:
- `reconnectTimer` - wait __ milliseconds after ICE 'disconnect' for reconnect attempt before emitting 'close'
- `sdpTransform` - function to transform the generated SDP signaling data (for advanced users)
- `stream` - if video/voice is desired, pass stream returned from `getUserMedia`
- `streams` - an array of MediaStreams returned from `getUserMedia`
- `trickle` - set to `false` to disable [trickle ICE](http://webrtchacks.com/trickle-ice/) and get a single 'signal' event (slower)
- `wrtc` - custom webrtc implementation, mainly useful in node to specify in the [wrtc](https://npmjs.com/package/wrtc) package
- `objectMode` - set to `true` to create the stream in [Object Mode](https://nodejs.org/api/stream.html#stream_object_mode). In this mode, incoming string data is not automatically converted to `Buffer` objects.
Expand All @@ -259,6 +261,22 @@ etc.), `ArrayBuffer`, or `Blob` (in browsers that support it).
Note: If this method is called before the `peer.on('connect')` event has fired, then data
will be buffered.

### `peer.addStream(stream)`

Add a `MediaStream` to the connection.

### `peer.removeStream(stream)`

Remove a `MediaStream` from the connection.

### `peer.addTrack(track, stream)`

Add a `MediaStreamTrack` to the connection. Must also pass the `MediaStream` you want to attach it to.

### `peer.removeTrack(track, stream)`

Remove a `MediaStreamTrack` from the connection. Must also pass the `MediaStream` that it was attached to.

### `peer.destroy([err])`

Destroy and cleanup this peer connection.
Expand Down Expand Up @@ -334,6 +352,18 @@ peer.on('stream', function (stream) {
})
```

### `peer.on('track', function (track, stream) {})`

Received a remote audio/video track. Streams may contain multiple tracks.

### `peer.on('removestream', function (stream) {})`

Fired when the remote peer removes all of a video stream's tracks from the connection.

### `peer.on('removetrack', function (track, stream) {})`

Fired when the remote peer removes a audio/video track from the connection.

### `peer.on('close', function () {})`

Called when the peer connection has closed.
Expand Down
Loading

0 comments on commit 461ed97

Please sign in to comment.