fixed all the bugs with sending signaling data
parent
1e25a4885c
commit
fa2b2b001a
|
@ -1,5 +1,5 @@
|
|||
// Overall sensible settings for development
|
||||
|
||||
final String baseUrlCore = "http://192.168.86.184:10200";
|
||||
final String baseUrlSignaling = "http://192.168.86.184:10201";
|
||||
final String baseUrlCore = "http://localhost:10200";
|
||||
final String baseUrlSignaling = "http://localhost:10201";
|
||||
final String globalUserId = "u-fb91825f564a3cc110f11836fedea6f4";
|
||||
|
|
|
@ -116,11 +116,9 @@ class PeerConnectionFactory {
|
|||
String remoteDeviceId, Map<String, dynamic> data) async {
|
||||
var response = await http.post(
|
||||
"$baseUrlSignaling/user/$remoteUserId/device/$remoteDeviceId",
|
||||
body: jsonEncode({"data": "hi"}));
|
||||
headers: {"Content-Type": "application/json"},
|
||||
body: jsonEncode({"data": data}));
|
||||
|
||||
print(response.statusCode);
|
||||
print(remoteUserId);
|
||||
print(remoteDeviceId);
|
||||
switch (response.statusCode) {
|
||||
case 200:
|
||||
return SignalingResponse.SUCCESSFULL;
|
||||
|
|
|
@ -12,8 +12,8 @@ class PeerManager {
|
|||
PeerConnectionFactory _peerConnectionFactory;
|
||||
MediaStream _localStream;
|
||||
|
||||
List<MediaStream> _currentStreams;
|
||||
Map<String, RTCPeerConnection> _currentConnections;
|
||||
List<MediaStream> _currentStreams = [];
|
||||
Map<String, RTCPeerConnection> _currentConnections = {};
|
||||
|
||||
PeerManager(this._selfUserId, this._selfDeviceId) {
|
||||
_initialize();
|
||||
|
@ -35,7 +35,6 @@ class PeerManager {
|
|||
addPeer(String userId) async {
|
||||
var response = await http.get("$baseUrlSignaling/user/$userId/devices");
|
||||
List<dynamic> deviceIds = jsonDecode(response.body);
|
||||
|
||||
deviceIds.forEach((deviceId) async {
|
||||
RTCPeerConnection connection =
|
||||
await _peerConnectionFactory.newPeerConnection(userId, deviceId);
|
||||
|
@ -46,7 +45,7 @@ class PeerManager {
|
|||
(stream) => _currentStreams.removeWhere((it) => stream.id == it.id);
|
||||
|
||||
// Add peer connection to the map
|
||||
_currentConnections["$userId-$deviceId"] = connection;
|
||||
_currentConnections.addAll({"$userId-$deviceId": connection});
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue