Peer class
Represents a peer in the WebRTC communication.
Constructors
- Peer(TxSocket _socket, bool _debug, TelnyxClient _txClient, bool _forceRelayCandidate)
- The constructor for the Peer class.
Properties
- currentSession ↔ Session?
-
Current active session
getter/setter pair
- hashCode → int
-
The hash code for this object.
no setterinherited
- onAddRemoteStream ↔ dynamic Function(Session session, MediaStream stream)?
-
Callback for when a remote media stream is added.
getter/setter pair
- onCallQualityChange ↔ CallQualityCallback?
-
Callback for call quality metrics updates.
getter/setter pair
- onCallStateChange ↔ dynamic Function(Session session, CallState state)?
-
Callback for when the call state changes.
getter/setter pair
- onDataChannel ↔ dynamic Function(Session session, RTCDataChannel dc)?
-
Callback for when a data channel is available.
getter/setter pair
- onDataChannelMessage ↔ dynamic Function(Session session, RTCDataChannel dc, RTCDataChannelMessage data)?
-
Callback for when a data channel message is received.
getter/setter pair
- onLocalStream ↔ dynamic Function(MediaStream stream)?
-
Callback for when the local media stream is available.
getter/setter pair
- onPeersUpdate ↔ dynamic Function(dynamic event)?
-
Callback for when peer updates occur.
getter/setter pair
- onRemoveRemoteStream ↔ dynamic Function(Session session, MediaStream stream)?
-
Callback for when a remote media stream is removed.
getter/setter pair
- onSignalingStateChange ↔ dynamic Function(SignalingState state)?
-
Callback for when the signaling state changes.
getter/setter pair
- peerConnection ↔ RTCPeerConnection?
-
The peer connection instance.
getter/setter pair
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- sdpSemantics → String
-
Gets the SDP semantics based on the platform.
Returns 'plan-b' for Windows and 'unified-plan' for other platforms.
no setter
Methods
-
accept(
String callerName, String callerNumber, String destinationNumber, String clientState, String callId, IncomingInviteParams invite, Map< String, String> customHeaders, bool isAttach) → void - Accepts an incoming call.
-
applyAudioCodecPreferences(
RTCPeerConnection peerConnection, List< Map< ? preferredCodecs) → Future<String, dynamic> >void> - Applies audio codec preferences to the peer connection's audio transceiver. This method must be called before creating an offer or answer to ensure the preferred codecs are negotiated in the correct order.
-
close(
) → void - Closes the peer connection and cleans up sessions.
-
closeSession(
) → void - Closes the current session.
-
createStream(
String media) → Future< MediaStream> - Creates a local media stream.
-
enableSpeakerPhone(
bool enable) → void - Enables or disables the speakerphone.
-
handleUpdateMediaResponse(
UpdateMediaResponse response) → Future< void> - Handles the updateMedia response from the server
-
invite(
String callerName, String callerNumber, String destinationNumber, String clientState, String callId, String telnyxSessionId, Map< String, String> customHeaders, {List<Map< ? preferredCodecs}) → voidString, dynamic> > - Initiates a call.
-
muteUnmuteMic(
) → void - Mutes or unmutes the microphone.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
remoteSessionReceived(
String sdp) → void - Sets the remote session description when an answer is received.
-
startIceRenegotiation(
String callId, String sessionId) → Future< void> - Starts ICE renegotiation process when ICE connection fails
-
startStats(
String callId, String peerId, {CallQualityCallback? onCallQualityChange}) → Future< bool> - Starts reporting WebRTC statistics.
-
stopStats(
String callId) → void - Stops reporting WebRTC statistics for a specific call.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited