Skip to content

Commit b22a1b9

Browse files
authored
Merge pull request #261 from Azure-Samples/chwhilar/fix-app-pinLogic
Fix app's pinning logic
2 parents ef14700 + bdc3949 commit b22a1b9

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

@@ -2110,13 +2113,14 @@ export default class CallCard extends React.Component {
21102113
</div>
21112114
<div>
21122115
{this.state.allRemoteParticipantStreams.map((streamTuple) => (
2116+
streamTuple.participant.state === 'Connected' &&
21132117
<div key={utils.getIdentifierText(streamTuple.participant.identifier)}>
2114-
<input
2115-
type="checkbox"
2116-
checked={streamTuple.isPinned}
2117-
onChange={(e) => this.handleVideoPin(streamTuple, e)}
2118-
/>
2119-
{utils.getIdentifierText(streamTuple.participant.identifier)}
2118+
<input
2119+
type="checkbox"
2120+
checked={streamTuple.isPinned}
2121+
onChange={(e) => this.handleVideoPin(streamTuple, e)}
2122+
/>
2123+
{utils.getIdentifierText(streamTuple.participant.identifier)}
21202124
</div>
21212125
))}
21222126
</div>

0 commit comments

Comments
 (0)