mirror of
https://gitlab.com/comunic/comunicmobile
synced 2024-11-25 22:39:22 +00:00
Can send ice candidates to server
This commit is contained in:
parent
ee6509bb9a
commit
7364fc49a8
@ -4,6 +4,7 @@ import 'package:comunic/helpers/websocket_helper.dart';
|
|||||||
import 'package:comunic/lists/call_members_list.dart';
|
import 'package:comunic/lists/call_members_list.dart';
|
||||||
import 'package:comunic/models/call_config.dart';
|
import 'package:comunic/models/call_config.dart';
|
||||||
import 'package:comunic/models/call_member.dart';
|
import 'package:comunic/models/call_member.dart';
|
||||||
|
import 'package:flutter_webrtc/rtc_ice_candidate.dart';
|
||||||
import 'package:flutter_webrtc/rtc_session_description.dart';
|
import 'package:flutter_webrtc/rtc_session_description.dart';
|
||||||
|
|
||||||
/// Calls helper
|
/// Calls helper
|
||||||
@ -51,4 +52,14 @@ class CallsHelper {
|
|||||||
"type": "SDP",
|
"type": "SDP",
|
||||||
"data": jsonEncode(sdp.toMap())
|
"data": jsonEncode(sdp.toMap())
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/// Send an IceCandidate
|
||||||
|
static Future<void> sendIceCandidate(
|
||||||
|
int callID, int peerID, RTCIceCandidate candidate) async =>
|
||||||
|
await ws("calls/signal", {
|
||||||
|
"callID": callID,
|
||||||
|
"peerID": peerID,
|
||||||
|
"type": "CANDIDATE",
|
||||||
|
"data": jsonEncode(candidate)
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
@ -168,6 +168,10 @@ class _CallScreenState extends SafeState<CallScreen> {
|
|||||||
|
|
||||||
_peersConnections[memberID] = peerConnection;
|
_peersConnections[memberID] = peerConnection;
|
||||||
|
|
||||||
|
// Register callbacks
|
||||||
|
peerConnection.onIceCandidate =
|
||||||
|
(c) => CallsHelper.sendIceCandidate(convID, memberID, c);
|
||||||
|
|
||||||
// Request an offer to establish a peer connection
|
// Request an offer to establish a peer connection
|
||||||
await CallsHelper.requestOffer(convID, memberID);
|
await CallsHelper.requestOffer(convID, memberID);
|
||||||
} catch (e, stack) {
|
} catch (e, stack) {
|
||||||
|
Loading…
Reference in New Issue
Block a user