MediaConnection class
- Inheritance
-
- Object
- EventEmitter
- BaseConnection
- MediaConnection
Constructors
- MediaConnection({required String peerId, required SignalingClient signalingClient, required WebRtcAdapter adapter, required String connectionId, MediaStream? localStream, IceConfiguration? config})
Properties
- adapter → WebRtcAdapter
-
finalinherited
- config → IceConfiguration?
-
finalinherited
- connectionId → String
-
finalinherited
- count → int
-
Get the unique count of events registered in the emitter.
no setterinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- hasRemoteDescription ↔ bool
-
getter/setter pairinherited
- isCameraOff → bool
-
no setter
- isConnected → bool
-
no setterinherited
- isMicrophoneOff → bool
-
no setter
- isOfferer ↔ bool
-
getter/setter pairinherited
- isOpen ↔ bool
-
getter/setter pairinherited
- localStream → MediaStream?
-
final
- pc ↔ PeerConnection?
-
getter/setter pairinherited
- peerId → String
-
finalinherited
- remoteAudioEnabled → bool
-
no setter
- remoteStream ↔ MediaStream?
-
getter/setter pair
- remoteVideoEnabled → bool
-
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- signalingClient → SignalingClient
-
finalinherited
Methods
-
answer(
MediaStream stream) → Future< void> -
call(
) → Future< void> -
clear(
) → void -
Clear all subscribers from the cache.
inherited
-
close(
) → void -
override
-
emit(
String event, [Object? sender, Object? data]) → void -
API to emit events.
event is a required parameter.
If sender information is sent, it will be used to intimate user about it.
event- What event needs to be emitted.sender- The sender who published the event. Ignore if not required.data- Data the event need to carry. Ignore this argument if no data needs to be sent.inherited -
getListenersCount(
String event) → int -
Get the list of subscribers for a particular event.
inherited
-
handleMessage(
SignalingMessage message) → Future< void> -
override
-
initialize(
) → Future< void> -
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
off(
Listener? listener) → void -
Remove event listener from emitter.
This will unsubscribe the caller from the emitter from any future events.
Listener should be a valid instance.
listener-Listenerinstance to be removed from the event subscription.inherited -
on(
String event, Object? context, EventCallback callback) → Listener -
API to register for notification.
It is mandatory to pass event name and callback parameters.
event- Event name used for the subscription. A valid event name is mandatory.context- Context information, which need to be sent in all emitted events.callback-EventCallbackfunction registered to receive events emitted from the publisher. A valid callback function is mandatory.inherited -
onClose(
void callback()) → void -
Listen for when the connection is closed.
inherited
-
onError(
void callback(dynamic error)) → void -
Listen for errors.
inherited
-
onOpen(
void callback()) → void -
Listen for when the connection is open.
inherited
-
onRemoteStreamChange(
void callback(RemoteStreamChange change)) → void - Listen for remote media state changes (camera/mic toggle).
-
onStream(
void callback(MediaStream stream)) → void - Listen for incoming media streams.
-
removeAllByCallback(
EventCallback callback) → void -
Remove all listeners which matches with the callback provided.
It is possible to register for multiple events with a single callback.
This mechanism ensure that all event registrations would be cancelled which matches the callback.
callback- The event callback used during subscription.inherited -
removeAllByEvent(
String event) → void -
Use this mechanism to remove all subscription for a particular event.
Caution : This will remove all the listeners from multiple files or classes or modules.
Think twice before calling this API and make sure you know what you are doing!!!
event- Event name used during subscription.inherited -
removeListener(
String eventName, EventCallback callback) → void -
Unsubscribe from getting any future events from emitter.
This mechanism uses event name and callback to unsubscribe from all possible events.
eventName- Event name for the subscription.callback-EventCallbackused when registering subscription usingonfunction.inherited -
sendSignal(
SignalingMessageType type, dynamic payload) → void -
inherited
-
switchCamera(
) → Future< void> - Switch between front and back camera
-
switchMicrophone(
) → Future< void> - Switch microphone (rotate through available inputs)
-
switchSpeakers(
) → Future< void> - Switch speakers (rotate between speakerphone and other outputs)
-
toString(
) → String -
A string representation of this object.
inherited
-
turnOffCamera(
{bool? off}) → Future< void> - Turn off or on camera (video)
-
turnoffMicrophone(
{bool? off}) → Future< void> - Turn off or on microphone (audio)
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited