fossasia / susi.ai

SUSI.AI Web Client https://susi.ai
GNU Lesser General Public License v2.1
2.05k stars 851 forks source link

Reimplement VoiceRecognition and VoicePlayer #2091

Open fragm3 opened 5 years ago

fragm3 commented 5 years ago

Actual Behaviour

Following up from PR: #2078, VoiceRecognition and VoicePlayer is not implemented using React states, which makes the Travis fail

Expected Behaviour

Implement it React way

Would you like to work on the issue?

Yes

fragm3 commented 5 years ago

@akshatnitd I looked into this issue, we have just one problem of Travis failing for these files

For VoicePlayer to work, we are using addEventListener for play for eg, whenever chat message bubble is created. If I shift to set State type, we could use set the state and based on the state set, we could call an action. Now the problem is invoking handler Event for VoicePlayer(to start or stop). If I invoke it in the render method, that is an anti-pattern, same using ref.

TDLR: Where should the event handler be invoked in our app, I could use redux to dispatch a play action.

Could you please throw in some light? @akshatnitd