1
0
mirror of https://gitlab.com/comunic/comunicmobile synced 2024-10-23 06:53:23 +00:00

Can send SDP back to server

This commit is contained in:
Pierre HUBERT 2020-04-20 17:29:36 +02:00
parent 45d903bcf7
commit 096251eaad
2 changed files with 14 additions and 2 deletions

View File

@ -1,7 +1,10 @@
import 'dart:convert';
import 'package:comunic/helpers/websocket_helper.dart';
import 'package:comunic/lists/call_members_list.dart';
import 'package:comunic/models/call_config.dart';
import 'package:comunic/models/call_member.dart';
import 'package:flutter_webrtc/rtc_session_description.dart';
/// Calls helper
///
@ -38,4 +41,14 @@ class CallsHelper {
/// Request an offer to access another peer's stream
static Future<void> requestOffer(int callID, int peerID) async =>
await ws("calls/request_offer", {"callID": callID, "peerID": peerID});
/// Send a Session Description message to the server
static Future<void> sendSessionDescription(
int callID, int peerID, RTCSessionDescription sdp) async =>
await ws("calls/signal", {
"callID": callID,
"peerID": peerID,
"type": "SDP",
"data": jsonEncode(sdp.toMap())
});
}

View File

@ -184,8 +184,7 @@ class _CallScreenState extends SafeState<CallScreen> {
if (ev.sessionDescription.type == "offer") {
final answer = await _peersConnections[ev.peerID].createAnswer({});
//TODO : Send answer back to server
print("ANSWER TO SEND ${answer.toMap()}");
await CallsHelper.sendSessionDescription(convID, ev.peerID, answer);
}
}