return casted list for videoTracks/audioTracks/subscribedTracks
This commit is contained in:
@@ -231,6 +231,18 @@ class LocalParticipant extends Participant {
|
|||||||
void updateFromInfo(lk_models.ParticipantInfo info) {
|
void updateFromInfo(lk_models.ParticipantInfo info) {
|
||||||
super.updateFromInfo(info);
|
super.updateFromInfo(info);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<LocalTrackPublication> get subscribedTracks =>
|
||||||
|
super.subscribedTracks.cast<LocalTrackPublication>().toList();
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<LocalTrackPublication> get videoTracks =>
|
||||||
|
super.videoTracks.cast<LocalTrackPublication>();
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<LocalTrackPublication> get audioTracks =>
|
||||||
|
super.audioTracks.cast<LocalTrackPublication>();
|
||||||
}
|
}
|
||||||
|
|
||||||
extension LocalParticipantTrackSourceExt on LocalParticipant {
|
extension LocalParticipantTrackSourceExt on LocalParticipant {
|
||||||
|
|||||||
@@ -74,8 +74,17 @@ abstract class Participant extends DisposableChangeNotifier
|
|||||||
ConnectionQuality get connectionQuality => _connectionQuality;
|
ConnectionQuality get connectionQuality => _connectionQuality;
|
||||||
|
|
||||||
/// tracks that are subscribed to
|
/// tracks that are subscribed to
|
||||||
List<TrackPublication> get subscribedTracks =>
|
List<TrackPublication> get subscribedTracks => trackPublications.values
|
||||||
trackPublications.values.where((e) => e.subscribed).toList();
|
.where((e) => e.subscribed)
|
||||||
|
.toList();
|
||||||
|
|
||||||
|
List<TrackPublication> get videoTracks => trackPublications.values
|
||||||
|
.where((e) => e.kind == lk_models.TrackType.VIDEO)
|
||||||
|
.toList();
|
||||||
|
|
||||||
|
List<TrackPublication> get audioTracks => trackPublications.values
|
||||||
|
.where((e) => e.kind == lk_models.TrackType.AUDIO)
|
||||||
|
.toList();
|
||||||
|
|
||||||
/// for internal use
|
/// for internal use
|
||||||
/// {@nodoc}
|
/// {@nodoc}
|
||||||
@@ -178,17 +187,6 @@ abstract class Participant extends DisposableChangeNotifier
|
|||||||
bool operator ==(Object other) => other is Participant && sid == other.sid;
|
bool operator ==(Object other) => other is Participant && sid == other.sid;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Convenience extension
|
|
||||||
extension ParticipantExt on Participant {
|
|
||||||
List<TrackPublication> get videoTracks => trackPublications.values
|
|
||||||
.where((e) => e.kind == lk_models.TrackType.VIDEO)
|
|
||||||
.toList();
|
|
||||||
|
|
||||||
List<TrackPublication> get audioTracks => trackPublications.values
|
|
||||||
.where((e) => e.kind == lk_models.TrackType.AUDIO)
|
|
||||||
.toList();
|
|
||||||
}
|
|
||||||
|
|
||||||
extension ParticipantTrackSourceExt on Participant {
|
extension ParticipantTrackSourceExt on Participant {
|
||||||
bool isCameraEnabled() {
|
bool isCameraEnabled() {
|
||||||
return !(getTrackPublicationBySource(TrackSource.camera)?.muted ?? true);
|
return !(getTrackPublicationBySource(TrackSource.camera)?.muted ?? true);
|
||||||
|
|||||||
@@ -20,6 +20,19 @@ class RemoteParticipant extends Participant {
|
|||||||
final RTCEngine _engine;
|
final RTCEngine _engine;
|
||||||
RTCEngine get engine => _engine;
|
RTCEngine get engine => _engine;
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<RemoteTrackPublication> get subscribedTracks => super.subscribedTracks
|
||||||
|
.cast<RemoteTrackPublication>()
|
||||||
|
.toList();
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<RemoteTrackPublication> get videoTracks =>
|
||||||
|
super.videoTracks.cast<RemoteTrackPublication>();
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<RemoteTrackPublication> get audioTracks =>
|
||||||
|
super.audioTracks.cast<RemoteTrackPublication>();
|
||||||
|
|
||||||
RemoteParticipant(
|
RemoteParticipant(
|
||||||
this._engine,
|
this._engine,
|
||||||
String sid,
|
String sid,
|
||||||
|
|||||||
Reference in New Issue
Block a user