@voicemaster/core 1.0.3 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +6 -2
- package/dist/index.mjs +6 -2
- package/package.json +1 -1
- package/src/VoiceClient.ts +7 -4
package/dist/index.js
CHANGED
|
@@ -48,7 +48,8 @@ var VoiceClient = class {
|
|
|
48
48
|
this.roomId = config.roomId;
|
|
49
49
|
this.userId = config.userId;
|
|
50
50
|
this.iceServers = config.iceServers || [
|
|
51
|
-
{ urls: "stun:stun.l.google.com:19302" }
|
|
51
|
+
{ urls: "stun:stun.l.google.com:19302" },
|
|
52
|
+
{ urls: "stun:stun1.l.google.com:19302" }
|
|
52
53
|
];
|
|
53
54
|
if (config.autoConnect !== false) {
|
|
54
55
|
this.connect();
|
|
@@ -116,11 +117,14 @@ var VoiceClient = class {
|
|
|
116
117
|
}
|
|
117
118
|
initPeer(initiator) {
|
|
118
119
|
if (this.peer) return;
|
|
120
|
+
const config = {
|
|
121
|
+
iceServers: this.iceServers
|
|
122
|
+
};
|
|
119
123
|
this.peer = new import_simple_peer.default({
|
|
120
124
|
initiator,
|
|
121
125
|
trickle: true,
|
|
122
126
|
stream: this.localStream || void 0,
|
|
123
|
-
config
|
|
127
|
+
config
|
|
124
128
|
});
|
|
125
129
|
this.peer.on("signal", (data) => {
|
|
126
130
|
this.send({
|
package/dist/index.mjs
CHANGED
|
@@ -12,7 +12,8 @@ var VoiceClient = class {
|
|
|
12
12
|
this.roomId = config.roomId;
|
|
13
13
|
this.userId = config.userId;
|
|
14
14
|
this.iceServers = config.iceServers || [
|
|
15
|
-
{ urls: "stun:stun.l.google.com:19302" }
|
|
15
|
+
{ urls: "stun:stun.l.google.com:19302" },
|
|
16
|
+
{ urls: "stun:stun1.l.google.com:19302" }
|
|
16
17
|
];
|
|
17
18
|
if (config.autoConnect !== false) {
|
|
18
19
|
this.connect();
|
|
@@ -80,11 +81,14 @@ var VoiceClient = class {
|
|
|
80
81
|
}
|
|
81
82
|
initPeer(initiator) {
|
|
82
83
|
if (this.peer) return;
|
|
84
|
+
const config = {
|
|
85
|
+
iceServers: this.iceServers
|
|
86
|
+
};
|
|
83
87
|
this.peer = new Peer({
|
|
84
88
|
initiator,
|
|
85
89
|
trickle: true,
|
|
86
90
|
stream: this.localStream || void 0,
|
|
87
|
-
config
|
|
91
|
+
config
|
|
88
92
|
});
|
|
89
93
|
this.peer.on("signal", (data) => {
|
|
90
94
|
this.send({
|
package/package.json
CHANGED
package/src/VoiceClient.ts
CHANGED
|
@@ -25,7 +25,8 @@ export class VoiceClient {
|
|
|
25
25
|
this.roomId = config.roomId;
|
|
26
26
|
this.userId = config.userId;
|
|
27
27
|
this.iceServers = config.iceServers || [
|
|
28
|
-
{ urls: 'stun:stun.l.google.com:19302' }
|
|
28
|
+
{ urls: 'stun:stun.l.google.com:19302' },
|
|
29
|
+
{ urls: 'stun:stun1.l.google.com:19302' }
|
|
29
30
|
];
|
|
30
31
|
|
|
31
32
|
if (config.autoConnect !== false) {
|
|
@@ -105,11 +106,15 @@ export class VoiceClient {
|
|
|
105
106
|
private initPeer(initiator: boolean): void {
|
|
106
107
|
if (this.peer) return;
|
|
107
108
|
|
|
109
|
+
const config = {
|
|
110
|
+
iceServers: this.iceServers
|
|
111
|
+
};
|
|
112
|
+
|
|
108
113
|
this.peer = new Peer({
|
|
109
114
|
initiator,
|
|
110
115
|
trickle: true,
|
|
111
116
|
stream: this.localStream || undefined,
|
|
112
|
-
config:
|
|
117
|
+
config: config
|
|
113
118
|
});
|
|
114
119
|
|
|
115
120
|
this.peer.on('signal', (data) => {
|
|
@@ -124,7 +129,6 @@ export class VoiceClient {
|
|
|
124
129
|
this.peer.on('stream', (stream) => {
|
|
125
130
|
this.remoteStream = stream;
|
|
126
131
|
this.emit('remoteStream', stream);
|
|
127
|
-
// Когда получили удалённый поток — значит соединение установлено
|
|
128
132
|
if (!this.isConnectedFlag) {
|
|
129
133
|
this.isConnectedFlag = true;
|
|
130
134
|
this.emit('connected');
|
|
@@ -186,7 +190,6 @@ export class VoiceClient {
|
|
|
186
190
|
return this.userId;
|
|
187
191
|
}
|
|
188
192
|
}
|
|
189
|
-
|
|
190
193
|
export interface VoiceEvents {
|
|
191
194
|
connected: () => void;
|
|
192
195
|
disconnected: () => void;
|