8000 Store SignalingState / IceGatheringStateIceConnectionState in RTCPeer… · model-lib/flutter-webrtc@396af85 · GitHub
[go: up one dir, main page]

Skip to content

Commit 396af85

Browse files
committed
Store SignalingState / IceGatheringStateIceConnectionState in RTCPeerConnection.
1 parent dd6edbe commit 396af85

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

lib/rtc_peerconnection.dart

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,9 @@ class RTCPeerConnection {
6060
List<MediaStream> _remoteStreams = new List();
6161
RTCDataChannel _dataChannel;
6262
Map<String, dynamic> _configuration;
63+
RTCSignalingState _signalingState;
64+
RTCIceGatheringState _iceGatheringState;
65+
RTCIceConnectionState _iceConnectionState;
6366

6467
// public: delegate
6568
SignalingStateCallback onSignalingState;
@@ -87,6 +90,12 @@ class RTCPeerConnection {
8790
.listen(eventListener, onError: errorListener);
8891
}
8992

93+
RTCSignalingState get signalingState => _signalingState;
94+
95+
RTCIceGatheringState get iceGatheringState => _iceGatheringState;
96+
97+
RTCIceConnectionState get iceConnectionState => _iceConnectionState;
98+
9099
/*
91100
* PeerConnection event listener.
92101
*/
@@ -95,19 +104,19 @@ class RTCPeerConnection {
95104

96105
switch (map['event']) {
97106
case 'signalingState':
98-
String state = map['state'];
107+
_signalingState = signalingStateForString(map['state']);
99108
if (this.onSignalingState != null)
100-
this.onSignalingState(signalingStateForString(state));
109+
this.onSignalingState(_signalingState);
101110
break;
102111
case 'iceGatheringState':
103-
String state = map['state'];
112+
_iceGatheringState = iceGatheringStateforString(map['state']);
104113
if (this.onIceGatheringState != null)
105-
this.onIceGatheringState(iceGatheringStateforString(state));
114+
this.onIceGatheringState(_iceGatheringState);
106115
break;
107116
case 'iceConnectionState':
108-
String state = map['state'];
117+
_iceConnectionState = iceConnectionStateForString(map['state']);
109118
if (this.onIceConnectionState != null)
110-
this.onIceConnectionState(iceConnectionStateForString(state));
119+
this.onIceConnectionState(_iceConnectionState);
111120
break;
112121
case 'onCandidate':
113122
Map<dynamic, dynamic> cand = map['candidate'];

0 commit comments

Comments
 (0)
0