Skip to content

Commit bdc3949

Browse files
committed
Fix app's pinning logic
1 parent 67ab825 commit bdc3949

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

Project/src/MakeCall/CallCard.js

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1390,11 +1390,14 @@ export default class CallCard extends React.Component {
13901390
}
13911391

13921392
handleVideoPin = (streamTuple, e) => {
1393-
// e.preventDefault();
13941393
const checked = e.target.checked;
13951394
const allRemoteParticipantStreams = this.state.allRemoteParticipantStreams;
13961395
// If there is already 2 streams pinned and the user is trying to pin another stream, return
13971396
if (allRemoteParticipantStreams.filter(streamTuple => streamTuple.isPinned).length >= 2 && checked) {
1397+
allRemoteParticipantStreams.find(v => v === streamTuple).isPinned = false;
1398+
this.setState({
1399+
allRemoteParticipantStreams: allRemoteParticipantStreams,
1400+
});
13981401
return;
13991402
}
14001403

@@ -2121,13 +2124,14 @@ export default class CallCard extends React.Component {
21212124
</div>
21222125
<div>
21232126
{this.state.allRemoteParticipantStreams.map((streamTuple) => (
2127+
streamTuple.participant.state === 'Connected' &&
21242128
<div key={utils.getIdentifierText(streamTuple.participant.identifier)}>
2125-
<input
2126-
type="checkbox"
2127-
checked={streamTuple.isPinned}
2128-
onChange={(e) => this.handleVideoPin(streamTuple, e)}
2129-
/>
2130-
{utils.getIdentifierText(streamTuple.participant.identifier)}
2129+
<input
2130+
type="checkbox"
2131+
checked={streamTuple.isPinned}
2132+
onChange={(e) => this.handleVideoPin(streamTuple, e)}
2133+
/>
2134+
{utils.getIdentifierText(streamTuple.participant.identifier)}
21312135
</div>
21322136
))}
21332137
</div>

0 commit comments

Comments
 (0)