diff --git a/src/store/conference.js b/src/store/conference.js index c5e4a88e..cdf1727c 100644 --- a/src/store/conference.js +++ b/src/store/conference.js @@ -221,7 +221,7 @@ export default { if(state.selectedParticipant == 'local' && !state.joinState === RequestState.succeeded){ state.selectedParticipant = null; } - else if(state.selectedParticipant == participant){ + else if(state.selectedParticipant == participant && !state.participants.includes(participant)){ state.selectedParticipant = 'local'; state.manualSelection = false; } diff --git a/src/store/index.js b/src/store/index.js index d3a545df..fe23605d 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -128,7 +128,7 @@ export const store = new Vuex.Store({ }).onConferenceParticipantLeft((participant)=>{ store.commit('conference/participantLeft', participant); store.commit('conference/removeRemoteMedia', participant.id); - store.commit('conference/setSelectedParticipant', 'local'); + store.commit('conference/setSelectedParticipant', participant.id); }).onConferenceEvent((event)=>{ store.commit('conference/event', event); }).onConferenceMessage((message)=>{ diff --git a/t/store/conference.js b/t/store/conference.js index ae0a3be7..20b6ca88 100644 --- a/t/store/conference.js +++ b/t/store/conference.js @@ -72,9 +72,10 @@ describe('Conference', function(){ }); - it('should store the local participant as selected', () => { + it('should store the local participant as selected if current selected participant leaves', () => { let state = { - selectedParticipant: '123456789' + selectedParticipant: '123456789', + participants: [] }; const participantId = '123456789'; @@ -93,4 +94,5 @@ describe('Conference', function(){ assert.equal(state.selectedParticipant, null); }); + });