mirror of
https://gitlab.com/comunic/comunicmobile
synced 2024-12-26 04:48:51 +00:00
Can send SDP back to server
This commit is contained in:
parent
45d903bcf7
commit
096251eaad
@ -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())
|
||||
});
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user