peer-data
Advanced tools
Comparing version 3.1.2 to 3.1.3
@@ -16,2 +16,3 @@ import { SignalingEvent } from './Signaling'; | ||
close: () => Participant; | ||
addStream: (stream: MediaStream) => Participant; | ||
onSignalingEvent: (event: SignalingEvent) => Participant; | ||
@@ -18,0 +19,0 @@ init: (remoteDesc?: RTCSessionDescription | undefined) => Promise<Participant>; |
@@ -0,1 +1,2 @@ | ||
import 'webrtc-adapter'; | ||
import { App as PeerData } from './app/App'; | ||
@@ -2,0 +3,0 @@ import { Room } from './app/Room'; |
@@ -0,1 +1,3 @@ | ||
import 'webrtc-adapter'; | ||
var EventDispatcher = /** @class */ (function () { | ||
@@ -150,2 +152,6 @@ function EventDispatcher() { | ||
}; | ||
this.addStream = function (stream) { | ||
stream.getTracks().map(function (track) { return _this.peer.addTrack(track, stream); }); | ||
return _this; | ||
}; | ||
this.onSignalingEvent = function (event) { | ||
@@ -240,4 +246,5 @@ if (!event.caller || _this.id !== event.caller.id) { | ||
this.onAnswer = function (event) { | ||
var remoteDesc = new RTCSessionDescription(event.payload); | ||
_this.peer | ||
.setRemoteDescription(new RTCSessionDescription(event.payload)) | ||
.setRemoteDescription(remoteDesc) | ||
.catch(function (evnt) { return _this.dispatcher.dispatch('error', evnt); }); | ||
@@ -308,3 +315,3 @@ }; | ||
if (stream instanceof MediaStream) { | ||
stream.getTracks().map(function (track) { return _this.peer.addTrack(track, stream); }); | ||
this.addStream(stream); | ||
} | ||
@@ -311,0 +318,0 @@ } |
@@ -5,2 +5,4 @@ 'use strict'; | ||
require('webrtc-adapter'); | ||
var EventDispatcher = /** @class */ (function () { | ||
@@ -154,2 +156,6 @@ function EventDispatcher() { | ||
}; | ||
this.addStream = function (stream) { | ||
stream.getTracks().map(function (track) { return _this.peer.addTrack(track, stream); }); | ||
return _this; | ||
}; | ||
this.onSignalingEvent = function (event) { | ||
@@ -244,4 +250,5 @@ if (!event.caller || _this.id !== event.caller.id) { | ||
this.onAnswer = function (event) { | ||
var remoteDesc = new RTCSessionDescription(event.payload); | ||
_this.peer | ||
.setRemoteDescription(new RTCSessionDescription(event.payload)) | ||
.setRemoteDescription(remoteDesc) | ||
.catch(function (evnt) { return _this.dispatcher.dispatch('error', evnt); }); | ||
@@ -312,3 +319,3 @@ }; | ||
if (stream instanceof MediaStream) { | ||
stream.getTracks().map(function (track) { return _this.peer.addTrack(track, stream); }); | ||
this.addStream(stream); | ||
} | ||
@@ -315,0 +322,0 @@ } |
{ | ||
"name": "peer-data", | ||
"version": "3.1.2", | ||
"version": "3.1.3", | ||
"description": "PeerData - library for files, media streaming/sharing using WebRTC", | ||
@@ -30,4 +30,2 @@ "scripts": { | ||
"files": [ | ||
"lib", | ||
"es", | ||
"dist" | ||
@@ -79,3 +77,3 @@ ], | ||
}, | ||
"peerDependencies": { | ||
"dependencies": { | ||
"socket.io-client": "^2.0.3", | ||
@@ -82,0 +80,0 @@ "webrtc-adapter": "^7.2.3" |
@@ -6,3 +6,2 @@ # PeerData | ||
[](LICENSE) | ||
[](https://beerpay.io/vardius/peer-data) [](https://beerpay.io/vardius/peer-data?focus=wish) | ||
<!--[](https://codecov.io/gh/vardius/peer-data)--> | ||
@@ -35,2 +34,4 @@ | ||
2. [Chat Example](https://github.com/vardius/webrtc-chat) | ||
3. [React Chat Example](https://github.com/vardius/react-webrtc-chat) | ||
4. [React Hook](https://github.com/vardius/react-peer-data) | ||
@@ -37,0 +38,0 @@ ## Installation |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
145066
1101
77
+ Addedsocket.io-client@^2.0.3
+ Addedwebrtc-adapter@^7.2.3