call method
Implementation
MediaConnection? call(String peer, MediaStream? stream, [CallOption? options]) {
options ??= CallOption();
if (_disconnected) {
logger.warn(
'You cannot connect to a new Peer because you called .disconnect() on this Peer and ended your connection with the server. You can create a new Peer to reconnect.');
emitError(PeerErrorType.Disconnected.value, 'Cannot connect to new Peer after disconnecting from server.');
return null;
}
if (stream == null) {
logger.error("To call a peer, you must provide a stream from your browser's `getUserMedia`.");
return null;
}
final mediaConnection = MediaConnection(peer, this, <String, dynamic>{
...options.toMap(),
'_stream': stream,
});
_addConnection(peer, mediaConnection);
return mediaConnection;
}