Skip to content

Commit 7238d6a

Browse files
committed
Changes for golang server.
1 parent a1e547e commit 7238d6a

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

lib/src/basic_sample/loopback_sample.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,8 @@ class _MyAppState extends State<LoopBackSample> {
151151
//change for loopback.
152152
description.type = 'answer';
153153
_peerConnection.setRemoteDescription(description);
154+
155+
_localStream.getAudioTracks()[0].setMicrophoneMute(false);
154156
} catch (e) {
155157
print(e.toString());
156158
}

lib/src/call_sample/signaling.dart

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,6 @@ class Signaling {
220220
break;
221221
case 'bye':
222222
{
223-
var from = data['from'];
224223
var to = data['to'];
225224
var sessionId = data['session_id'];
226225
print('bye: ' + sessionId);
@@ -259,7 +258,7 @@ class Signaling {
259258
}
260259

261260
void connect() async {
262-
var url = 'wss://$_host:$_port';
261+
var url = 'wss://$_host:$_port/ws';
263262
_socket = SimpleWebSocket(url);
264263

265264
print('connect to $url');
@@ -321,6 +320,7 @@ class Signaling {
321320
pc.onIceCandidate = (candidate) {
322321
_send('candidate', {
323322
'to': id,
323+
'from': _selfId,
324324
'candidate': {
325325
'sdpMLineIndex': candidate.sdpMlineIndex,
326326
'sdpMid': candidate.sdpMid,
@@ -375,6 +375,7 @@ class Signaling {
375375
pc.setLocalDescription(s);
376376
_send('offer', {
377377
'to': id,
378+
'from': _selfId,
378379
'description': {'sdp': s.sdp, 'type': s.type},
379380
'session_id': this._sessionId,
380381
'media': media,
@@ -391,6 +392,7 @@ class Signaling {
391392
pc.setLocalDescription(s);
392393
_send('answer', {
393394
'to': id,
395+
'from': _selfId,
394396
'description': {'sdp': s.sdp, 'type': s.type},
395397
'session_id': this._sessionId,
396398
});
@@ -400,8 +402,10 @@ class Signaling {
400402
}
401403

402404
_send(event, data) {
403-
data['type'] = event;
405+
var request = new Map();
406+
request["type"] = event;
407+
request["data"] = data;
404408
JsonEncoder encoder = new JsonEncoder();
405-
_socket.send(encoder.convert(data));
409+
_socket.send(encoder.convert(request));
406410
}
407411
}

0 commit comments

Comments
 (0)