User clicks a button → The voice recording process starts.
User clicks the button again → the voice recording process stops and the audio file is sent to my backend.
After the user has clicked the button to stop the recording process, while the whole workflow is doing its thing, the button turns a different color (blue).
I need the user to not be able to click on the button until it’s time to record their voice again!
So basically, how do I prevent the user from being able to click the button a 2nd time while the workflow is not done processing yet?
How about creating two variables: one (“is_disabled”) is bound to the disabled property of the button, the other (“is_recording”) is a condition to decide what to do in the workflow.
User clicks the button to start recording: workflow first sets is_recording=True (make sure that it’s a toggle!). Then, add a true/false-split that has as a condition the variable is_recording. If is_recording=True → change variable is_disabled =True. For is_recording=False branch, add the processing part. In the end, make sure to set is_disabled=False.
You indeed should have a variable. For example in my WeWeb – Audio Recorder Component – Broberto I have a state that exposes the current state, so that people can base their logic on that.