11diff --git a/lib/dataconnection.ts b/lib/dataconnection.ts
2- index ab58d6c..dfbf3b2 100644
2+ index aec3c05..f0ca925 100644
33--- a/lib/dataconnection.ts
44+++ b/lib/dataconnection.ts
5- @@ -56 ,7 +56 ,7 @@ export class DataConnection extends BaseConnection {
5+ @@ -58 ,7 +58 ,7 @@ export class DataConnection extends BaseConnection implements IDataConnection {
66 this.options.connectionId || DataConnection.ID_PREFIX + util.randomToken();
7-
7+
88 this.label = this.options.label || this.connectionId;
99- this.serialization = this.options.serialization || SerializationType.Binary;
1010+ this.serialization = this.options.serialization || SerializationType.JSON;
1111 this.reliable = !!this.options.reliable;
12-
13- if ( this.options._payload) {
12+
13+ this._encodingQueue.on('done', (ab: ArrayBuffer) => {
1414diff --git a/lib/exports.ts b/lib/exports.ts
15- index 5772d02..07fc457 100644
15+ index 5772d02..63a57e3 100644
1616--- a/lib/exports.ts
1717+++ b/lib/exports.ts
18- @@ -8,6 +8,3 @@ export const peerjs = {
19-
18+ @@ -7,7 +7,3 @@ export const peerjs = {
19+ };
20+
2021 export default Peer;
21-
22+ -
2223- (<any>window).peerjs = peerjs;
2324- /** @deprecated Should use peerjs namespace */
2425- (<any>window).Peer = Peer;
26+ diff --git a/lib/negotiator.ts b/lib/negotiator.ts
27+ index e2b3df9..c48efa3 100644
28+ --- a/lib/negotiator.ts
29+ +++ b/lib/negotiator.ts
30+ @@ -142,10 +142,11 @@ export class Negotiator {
31+ // MEDIACONNECTION.
32+ logger.log("Listening for remote stream");
33+
34+ - peerConnection.ontrack = (evt) => {
35+ - logger.log("Received remote stream");
36+ + // react-native-webrtc implements the old API.
37+ + peerConnection.onaddstream = (evt) => {
38+ + logger.log("Received remote stream", evt);
39+
40+ - const stream = evt.streams[0];
41+ + const stream = evt.stream;
42+ const connection = provider.getConnection(peerId, connectionId);
43+
44+ if (connection.type === ConnectionType.Media) {
45+ @@ -168,7 +169,7 @@ export class Negotiator {
46+ this.connection.peerConnection = null;
47+
48+ //unsubscribe from all PeerConnection's events
49+ - peerConnection.onicecandidate = peerConnection.oniceconnectionstatechange = peerConnection.ondatachannel = peerConnection.ontrack = () => { };
50+ + peerConnection.onicecandidate = peerConnection.oniceconnectionstatechange = peerConnection.ondatachannel = peerConnection.onaddstream = () => { };
51+
52+ const peerConnectionNotClosed = peerConnection.signalingState !== "closed";
53+ let dataChannelNotClosed = false;
54+ @@ -340,15 +341,14 @@ export class Negotiator {
55+ ): void {
56+ logger.log(`add tracks from stream ${stream.id} to peer connection`);
57+
58+ - if (!peerConnection.addTrack) {
59+ + // react-native-webrtc implements the old API.
60+ + if (!peerConnection.addStream) {
61+ return logger.error(
62+ - `Your browser does't support RTCPeerConnection#addTrack. Ignored.`
63+ + `Your browser does't support RTCPeerConnection#addStream. Ignored.`
64+ );
65+ }
66+
67+ - stream.getTracks().forEach(track => {
68+ - peerConnection.addTrack(track, stream);
69+ - });
70+ + peerConnection.addStream(stream);
71+ }
72+
73+ private _addStreamToMediaConnection(
2574diff --git a/lib/peer.ts b/lib/peer.ts
26- index 66a3412..78ac6cf 100644
75+ index 8f11659..1af0753 100644
2776--- a/lib/peer.ts
2877+++ b/lib/peer.ts
2978@@ -111,11 +111,6 @@ export class Peer extends EventEmitter {
3079 };
3180 this._options = options;
32-
81+
3382- // Detect relative URL host.
3483- if (this._options.host === "/") {
3584- this._options.host = window.location.hostname;
@@ -39,7 +88,7 @@ index 66a3412..78ac6cf 100644
3988 if (this._options.path) {
4089 if (this._options.path[0] !== "/") {
4190diff --git a/lib/supports.ts b/lib/supports.ts
42- index 1801188..8bb163e 100644
91+ index 1801188..db1dc70 100644
4392--- a/lib/supports.ts
4493+++ b/lib/supports.ts
4594@@ -1,5 +1,3 @@
@@ -50,17 +99,17 @@ index 1801188..8bb163e 100644
5099 readonly supportedBrowsers = ['firefox', 'chrome', 'safari'];
51100@@ -28,36 +26,15 @@ export const Supports = new class {
52101 }
53-
102+
54103 getBrowser(): string {
55104- return webRTCAdapter.browserDetails.browser;
56105+ return 'chrome';
57106 }
58-
107+
59108 getVersion(): number {
60109- return webRTCAdapter.browserDetails.version || 0;
61110+ return this.minChromeVersion;
62111 }
63-
112+
64113 isUnifiedPlanSupported(): boolean {
65114- const browser = this.getBrowser();
66115- const version = webRTCAdapter.browserDetails.version || 0;
@@ -86,5 +135,5 @@ index 1801188..8bb163e 100644
86135- return supported;
87136+ return false;
88137 }
89-
138+
90139 toString(): string {
0 commit comments