mirror of
https://github.com/nextcloud/talk-android
synced 2025-07-19 18:55:05 +01:00
Create ParticipantDisplayItem on media event if it does not exist yet
Instead of creating a new ParticipantDisplayItem from scratch, which resets the full grid, now the existing one is updated; a new one is created only if no item existed already for the session and video stream type of the media event. Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
This commit is contained in:
parent
dc53023572
commit
29d0574667
@ -2225,17 +2225,10 @@ public class CallActivity extends CallBaseActivity {
|
|||||||
|
|
||||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||||
public void onMessageEvent(MediaStreamEvent mediaStreamEvent) {
|
public void onMessageEvent(MediaStreamEvent mediaStreamEvent) {
|
||||||
if (mediaStreamEvent.getMediaStream() != null) {
|
String participantDisplayItemId = mediaStreamEvent.getSession() + "-" + mediaStreamEvent.getVideoStreamType();
|
||||||
boolean hasAtLeastOneVideoStream = mediaStreamEvent.getMediaStream().videoTracks != null
|
if (participantDisplayItems.get(participantDisplayItemId) == null) {
|
||||||
&& mediaStreamEvent.getMediaStream().videoTracks.size() > 0;
|
// Initial setup, ignore media related properties as they will be set after it.
|
||||||
|
// userId is unknown from the event, but it will be got based on the session id.
|
||||||
setupVideoStreamForLayout(
|
|
||||||
mediaStreamEvent.getMediaStream(),
|
|
||||||
mediaStreamEvent.getSession(),
|
|
||||||
null,
|
|
||||||
hasAtLeastOneVideoStream,
|
|
||||||
mediaStreamEvent.getVideoStreamType());
|
|
||||||
} else {
|
|
||||||
setupVideoStreamForLayout(
|
setupVideoStreamForLayout(
|
||||||
null,
|
null,
|
||||||
mediaStreamEvent.getSession(),
|
mediaStreamEvent.getSession(),
|
||||||
@ -2243,6 +2236,17 @@ public class CallActivity extends CallBaseActivity {
|
|||||||
false,
|
false,
|
||||||
mediaStreamEvent.getVideoStreamType());
|
mediaStreamEvent.getVideoStreamType());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boolean hasAtLeastOneVideoStream = false;
|
||||||
|
if (mediaStreamEvent.getMediaStream() != null) {
|
||||||
|
hasAtLeastOneVideoStream = mediaStreamEvent.getMediaStream().videoTracks != null
|
||||||
|
&& mediaStreamEvent.getMediaStream().videoTracks.size() > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
ParticipantDisplayItem participantDisplayItem = participantDisplayItems.get(participantDisplayItemId);
|
||||||
|
participantDisplayItem.setMediaStream(mediaStreamEvent.getMediaStream());
|
||||||
|
participantDisplayItem.setStreamEnabled(hasAtLeastOneVideoStream);
|
||||||
|
participantsAdapter.notifyDataSetChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
Reference in New Issue
Block a user