name field for participant
This commit is contained in:
@@ -222,6 +222,7 @@ class Room extends DisposableChangeNotifier with EventsEmittable<RoomEvent> {
|
||||
room: this,
|
||||
sid: sid,
|
||||
identity: '',
|
||||
name: '',
|
||||
);
|
||||
} else {
|
||||
participant = RemoteParticipant.fromInfo(
|
||||
|
||||
@@ -28,6 +28,7 @@ class LocalParticipant extends Participant<LocalTrackPublication> {
|
||||
room: room,
|
||||
sid: info.sid,
|
||||
identity: info.identity,
|
||||
name: info.name,
|
||||
) {
|
||||
updateFromInfo(info);
|
||||
}
|
||||
|
||||
@@ -43,6 +43,10 @@ abstract class Participant<T extends TrackPublication>
|
||||
/// User-assigned identity.
|
||||
String identity;
|
||||
|
||||
/// Name of the participant (readonly).
|
||||
String get name => _name;
|
||||
String _name;
|
||||
|
||||
/// Client-assigned metadata, opaque to livekit.
|
||||
String? metadata;
|
||||
|
||||
@@ -94,7 +98,8 @@ abstract class Participant<T extends TrackPublication>
|
||||
required this.room,
|
||||
required this.sid,
|
||||
required this.identity,
|
||||
}) {
|
||||
required String name,
|
||||
}) : _name = name {
|
||||
// Any event emitted will trigger ChangeNotifier
|
||||
events.listen((event) {
|
||||
logger.fine('[ParticipantEvent] $event, will notifyListeners()');
|
||||
@@ -150,6 +155,7 @@ abstract class Participant<T extends TrackPublication>
|
||||
@internal
|
||||
void updateFromInfo(lk_models.ParticipantInfo info) {
|
||||
identity = info.identity;
|
||||
_name = info.name;
|
||||
// participantSid = info.sid;
|
||||
if (info.metadata.isNotEmpty) {
|
||||
_setMetadata(info.metadata);
|
||||
|
||||
@@ -22,10 +22,12 @@ class RemoteParticipant extends Participant<RemoteTrackPublication> {
|
||||
required Room room,
|
||||
required String sid,
|
||||
required String identity,
|
||||
required String name,
|
||||
}) : super(
|
||||
room: room,
|
||||
sid: sid,
|
||||
identity: identity,
|
||||
name: name,
|
||||
);
|
||||
|
||||
@internal
|
||||
@@ -36,6 +38,7 @@ class RemoteParticipant extends Participant<RemoteTrackPublication> {
|
||||
room: room,
|
||||
sid: info.sid,
|
||||
identity: info.identity,
|
||||
name: info.name,
|
||||
) {
|
||||
updateFromInfo(info);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user