inital
This commit is contained in:
@@ -92,7 +92,10 @@ class _ViewerScreenState extends State<ViewerScreen> {
|
||||
return;
|
||||
}
|
||||
|
||||
_sig.send({'type': 'join', 'roomId': roomId});
|
||||
// build the peer connection BEFORE telling the server we've joined,
|
||||
// otherwise the host's offer can race in before _pc exists and the
|
||||
// whole answer step gets silently dropped
|
||||
await _initPeerConnection(roomId);
|
||||
|
||||
_sigSub = _sig.messages.listen(
|
||||
(msg) => _onSignal(msg, roomId),
|
||||
@@ -100,6 +103,8 @@ class _ViewerScreenState extends State<ViewerScreen> {
|
||||
setState(() => _status = 'Signal error: $e');
|
||||
},
|
||||
);
|
||||
|
||||
_sig.send({'type': 'join', 'roomId': roomId});
|
||||
}
|
||||
|
||||
Future<void> _onSignal(Map<String, dynamic> msg, String roomId) async {
|
||||
@@ -108,7 +113,6 @@ class _ViewerScreenState extends State<ViewerScreen> {
|
||||
switch (type) {
|
||||
case 'joined':
|
||||
setState(() => _status = 'Waiting for host offer...');
|
||||
await _initPeerConnection(roomId);
|
||||
break;
|
||||
|
||||
case 'signal':
|
||||
|
||||
Reference in New Issue
Block a user