From b6b48ea310e428fd7754915ba92aa168c16e9d2d Mon Sep 17 00:00:00 2001 From: Artur Shellunts Date: Tue, 7 Dec 2021 11:28:25 +0100 Subject: [PATCH] Fix rendering of remote shared screen (#50) Fix activeVideoTrack to return any unmuted stream, not only first one in the list. --- example/lib/widgets/participant.dart | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/example/lib/widgets/participant.dart b/example/lib/widgets/participant.dart index eb17fae..1f7e568 100644 --- a/example/lib/widgets/participant.dart +++ b/example/lib/widgets/participant.dart @@ -171,10 +171,12 @@ class _RemoteParticipantWidgetState @override VideoTrack? get activeVideoTrack { - if (firstVideoPublication?.subscribed == true && - firstVideoPublication?.muted == false && - _visible) { - return firstVideoPublication?.track; + for (final trackPublication in widget.participant.videoTracks) { + print( + 'video track ${trackPublication.sid} subscribed ${trackPublication.subscribed} muted ${trackPublication.muted}'); + if (trackPublication.subscribed && !trackPublication.muted) { + return trackPublication.track; + } } }