name field for participant

This commit is contained in:
Hiroshi Horie
2022-01-02 01:38:54 +07:00
parent 252ee3ed3b
commit 44a42eafea
5 changed files with 15 additions and 2 deletions
+1
View File
@@ -222,6 +222,7 @@ class Room extends DisposableChangeNotifier with EventsEmittable<RoomEvent> {
room: this,
sid: sid,
identity: '',
name: '',
);
} else {
participant = RemoteParticipant.fromInfo(
+1
View File
@@ -28,6 +28,7 @@ class LocalParticipant extends Participant<LocalTrackPublication> {
room: room,
sid: info.sid,
identity: info.identity,
name: info.name,
) {
updateFromInfo(info);
}
+7 -1
View File
@@ -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);
+3
View File
@@ -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);
}