fixed object spreadin in TrackProvider

This commit is contained in:
J Taylor 2021-06-30 13:13:26 +01:00
parent a509c3b563
commit 262d93c86e
1 changed files with 7 additions and 9 deletions

View File

@ -219,21 +219,19 @@ export const TracksProvider = ({ children }) => {
const callParticipants = callObject.participants(); const callParticipants = callObject.participants();
const updates = ids.reduce((o, id) => { const updates = ids.reduce((o, id) => {
const { subscribed } = callParticipants?.[id]?.tracks?.audio; const { subscribed } = callParticipants?.[id]?.tracks?.audio;
const result = {}; const result = { ...o[id] };
if (!subscribed) { if (!subscribed) {
result[id] = { result.setSubscribedTracks = {
setSubscribedTracks: { audio: true,
audio: true, screenAudio: true,
screenAudio: true, screenVideo: true,
screenVideo: true,
},
}; };
} }
if (rtcpeers?.getCurrentType?.() === 'peer-to-peer') { if (rtcpeers?.getCurrentType?.() === 'peer-to-peer') {
result[id].setSubscribedTracks.video = true; result.setSubscribedTracks.video = true;
} }
return { ...o, ...result }; return { [id]: result };
}, {}); }, {});
callObject.updateParticipants(updates); callObject.updateParticipants(updates);
}, 100); }, 100);