LocalPeer class
LocalPeer is the main class which handles all the functionality of the client Where Client Means the currently Running Application.
- Inheritance
-
- Object
- EnhancedEventEmitter
- LocalPeer
Constructors
- LocalPeer.create()
-
factory
- LocalPeer.getInstance()
-
factory
Properties
- device → Device?
-
Get the current device for this client
no setter
- deviceHandler ↔ DeviceHandler
-
DeviceHandler Instance, Handles the media devices for this client
getter/setter pair
- hashCode → int
-
The hash code for this object.
no setterinherited
- joined ↔ bool
-
Variable to check if the user has joined the room
getter/setter pair
-
labels
→ List<
String> -
Return the labels of the Media Stream that the Local Peer is producing to the room
no setter
-
labelToProducerId
→ Map<
String, String> -
Map of Identifiers to Producer Ids, which handles the mapping of identifiers to producer ids.
identifiers
are the unique identifiers for the stream, which is used to identify the stream.final - peerId ↔ String?
-
PeerId of the current client, specific to the Local Peer who joined the meeting
NOTE: Until you dont join the room, this will be null
getter/setter pair
- permissions → dynamic
-
Get the Permissions of the Local Peer. (e.g canProduce, canConsume, canSendData, canRecvData etc)
no setter
- recvTransport → Transport?
-
Returns the recvTransport
@returns { Transport } recvTransport
@throws { Error } If the recvTransport is not initialized
no setter
- role → dynamic
-
Get the Role of the Local Peer.
no setter
- room → Room
-
Returns the room instance
no setter
- roomId → String?
-
Returns the roomId of the current joined room.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- sendTransport → Transport?
-
Returns the SendTransport
@returns { Transport } SendTransport
@throws { Error } If the SendTransport is not initialized
no setter
- socket → Socket
-
Returns the underlying socket connection
no setter
- token → String?
-
Returns the token of the current socket connection, specific to the Local Peer who joined the meeting
no setter
Methods
-
callback(
Function func, [dynamic arg0, dynamic arg1, dynamic arg2, dynamic arg3, dynamic arg4, dynamic arg5]) → dynamic -
inherited
-
callbackAsFuture(
Function func, [dynamic arg0, dynamic arg1, dynamic arg2, dynamic arg3, dynamic arg4, dynamic arg5]) → Future -
inherited
-
clearListeners(
) → void -
This function unbinds all the handlers for all the events
inherited
-
close(
) → void - Destroy the current peer, closes all the transports, producers and consumers
-
closeConsumer(
String label, String peerId) → void -
consume(
Map< String, dynamic> data) → Future<void> - Consumes a stream with the producerId and peerId of the RemotePeer, appData is application level custom data which can be added to the consumer for the LocalPeer, this data will be available in the consumer object and can be used only by the LocalPeer.
-
disableAudio(
) → void -
Stops the underlying producing of a microphone stream, stops the local track and closes the producer
NOTE: This will notify all the RemotePeers that this producer has stopped producing and they should stop consuming it.
-
disableVideo(
) → void -
Stops the underlying producing of a camera stream, stops the local track and closes the producer
NOTE: This will notify all the RemotePeers that this producer has stopped producing and they should stop consuming it.
-
emit(
String event, [dynamic arg0, dynamic arg1, dynamic arg2, dynamic arg3, dynamic arg4, dynamic arg5]) → void -
This function triggers all the handlers currently listening
to
event
and passes themdata
.inherited -
emitAsFuture(
String event, [dynamic arg0, dynamic arg1, dynamic arg2, dynamic arg3, dynamic arg4, dynamic arg5]) → Future -
This function triggers all the handlers currently listening
to
event
and passes themdata
.inherited -
enableAudio(
{MediaStream? customAudioStream}) → Future< MediaStream?> -
Enables the local mic and starts producing the stream with the label
audio
NOTE: You can only produce to a room when you have joined the room, if you try to produce before joining the room it will fetch the stream and start producing when you join the room -
enableVideo(
{MediaStream? customVideoStream}) → Future< MediaStream?> -
Enables the local cam and starts producing the stream with the label
video
-
getConsumer(
{required String label, required String peerId}) → Consumer? - Get the consumer by label and peerId @returns Consumer | null; Returns null if consumer is not found
-
getMetadata<
T> () → T - Returns the metadata associated to the LocalPeer
-
getProducerWithLabel(
String label) → Producer? - Returns the producer with the given label @param label - Identifier of the producer @returns { Producer } Producer @returns { null } If the producer is not found
-
getStream(
{required String label}) → MediaStream? - getStream returns the stream with the given label
-
listeners(
dynamic event) → List -
Return function list named
event
.inherited -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
off(
String event) → void -
This function attempts to unbind all the
handler
from theevent
inherited -
on(
String event, Function handler) → void -
This function binds the
handler
as a listener to theevent
inherited -
once(
String event, Function handler) → void -
This function binds the
handler
as a listener to the first occurrence of theevent
. Whenhandler
is called once, it is removed.inherited -
produce(
{required String label, required MediaStream? stream, bool? stopTrackOnClose = false, Map< String, dynamic> ? appData}) → Future<void> - Produce a stream with a given label and appData to all the Remote Peers
-
produceData(
) → void -
remove(
String event, Function handler) → void -
This function attempts to unbind the
handler
from theevent
inherited -
removeAllListeners(
[dynamic eventName]) → void -
inherited
-
safeEmit(
String event, [Map< String, dynamic> ? args]) → void -
inherited
-
safeEmitAsFuture(
String event, [Map< String, dynamic> ? args]) → Future -
inherited
-
sendData(
String sendDataTo, String payload, String label) → void -
stopConsuming(
String peerId, String label) → void - Stops the underlying consuming of a stream for a particular label NOTE: This does not notify the remote peers that you are not consuming a stream
-
stopProducing(
{required String label}) → void - Stops the underlying producing of a stream for a particular label NOTE: This will notify all the RemotePeers that this producer has stopped producing and they should stop consuming it.`
-
toString(
) → String -
A string representation of this object.
inherited
-
transportExists(
TransportType transportType) → Transport? -
Can be used to check which
direction
of webRTC connection is currently active for the peer. @param transportType -
updateMetadata<
T> (T data) → void -
Send Message to update the metadata of the Local Peer
NOTE: This will notify every user in the room about the metadata update
-
updateRole(
Map< String, dynamic> data) → void -
Update the role of the Remote Peer in the Room, this will emit an event
updated
with the updated role.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited