Browse Source

Reorder blocks to match the normal flow of state changes

After being initialized the speaking value will be first modified when
the participant starts speaking, and then once the participant stops
speaking.

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
pull/10201/head
Daniel Calviño Sánchez 2 years ago
parent
commit
5fb9c977f9
  1. 10
      src/store/participantsStore.js

10
src/store/participantsStore.js

@ -369,13 +369,13 @@ const mutations = {
const currentTimestamp = Date.now()
const currentSpeakingState = state.speaking[token][sessionId].speaking
// when speaking has stopped, update the total talking time
if (currentSpeakingState && !speaking) {
state.speaking[token][sessionId].speaking = false
state.speaking[token][sessionId].totalCountedTime += (currentTimestamp - state.speaking[token][sessionId].lastTimestamp)
} else if (!currentSpeakingState && speaking) {
if (!currentSpeakingState && speaking) {
state.speaking[token][sessionId].speaking = true
state.speaking[token][sessionId].lastTimestamp = currentTimestamp
} else if (currentSpeakingState && !speaking) {
// when speaking has stopped, update the total talking time
state.speaking[token][sessionId].speaking = false
state.speaking[token][sessionId].totalCountedTime += (currentTimestamp - state.speaking[token][sessionId].lastTimestamp)
}
},

Loading…
Cancel
Save