View class Null safety
View manages a webSocket connection to view a stream using Millicast.
View extends BaseWebRTC
class.
Before you can view an active broadcast, you will need:
- A connection path that you can get from Director module or from your
own implementation based on Get a Connection Path.
streamName - Millicast existing Stream Name where you want to connect.
tokenGenerator - Callback function executed when a new token is needed.
mediaElement
- Target media element to mount stream. autoReconnect = true - Enable auto reconnect to stream.
- Inheritance
- Object
- EventEmitter
- View
Constructors
- View({required String streamName, required Function tokenGenerator, RTCVideoRenderer? mediaElement, bool autoReconnect = true})
Properties
- alreadyDisconnected ↔ bool?
-
read / write, inherited
- autoReconnect ↔ bool
-
autoReconnect - Enable auto reconnect.
read / write, inherited
- count → int
-
Get the unique count of events registered in the emitter.
read-only, inherited
- firstReconnection ↔ bool?
-
read / write, inherited
- hashCode → int
-
The hash code for this object. [...]
read-only, inherited
- logger ↔ Logger
-
logger - Logger instance from the extended classes.
read / write, inherited
-
options
↔ Map<
String, dynamic> ? -
read / write, inherited
- reconnectionInterval ↔ int?
-
read / write, inherited
- runtimeType → Type
-
A representation of the runtime type of the object.
read-only, inherited
- signaling ↔ Signaling?
-
read / write, inherited
- stopReconnection ↔ bool
-
read / write, inherited
- stopReemitingSignalingInstanceEvents ↔ Function?
-
read / write
- stopReemitingWebRTCPeerInstanceEvents ↔ Function?
-
read / write
- streamName ↔ String
-
streamName - Millicast existing stream name.
read / write, inherited
- tokenGenerator ↔ Function
-
tokenGenerator - Callback function executed when a new token is needed.
read / write, inherited
- webRTCPeer ↔ PeerConnection
-
read / write, inherited
Methods
-
addRemoteTrack(
String media, List< MediaStream> streams) → Future<RTCRtpTransceiver> - Add remote receving track. [...]
-
clear(
) → void -
Clear all subscribers from the cache.
inherited
-
connect(
{Map< String, dynamic> options = _connectOptions}) → dynamic - Connects to an active stream as subscriber. [...]
-
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
-
getRTCPeerConnection(
) → Future< RTCPeerConnection> -
Get current RTC peer connection. [...]
inherited
-
initConnection(
Map< String, dynamic> data) → dynamic -
isActive(
) → bool -
Get if the current connection is active. [...]
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a non-existent 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
- Listener instance 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
- EventCallback function registered to receive events emitted from the publisher. A valid callback function is mandatory.inherited -
project(
String? sourceId, List< Map> mapping) → dynamic - Start projecting source in selected media ids. [...]
-
reconnect(
) → dynamic -
Reconnects to last broadcast.
inherited
-
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
- EventCallback used when registering subscription using on function.inherited -
replaceConnection(
) → dynamic -
select(
{Map? layer = const {}}) → dynamic - Select the simulcast encoding layer and svc layers for the main video track. [...]
-
setReconnect(
) → dynamic -
Sets reconnection if autoReconnect is enabled.
inherited
-
stop(
) → dynamic -
Stops connection.
inherited
-
toString(
) → String -
A string representation of this object. [...]
inherited
-
unproject(
List< String> mediaIds) → dynamic - Stop projecting attached source in selected media ids. [...]
Operators
-
operator ==(
Object other) → bool -
The equality operator. [...]
inherited