How to stop recording when a finger is released from a button
-
My application for iOS has recording function. Based on sample code, I implemented a following code. As you understand, recorder.stop() is executed after alert dialog is closed. I want to change this specification from current one to new one which records a voice while a button on UI is kept touching, and when user releases a finger from a button, recorde.stop() is executed. How should I implement this? I don’t want to use an alert dialog.
recorder = sound.Recorder('speech.m4a') recorder.record() # Continue recording until the 'Finish' button is tapped: dialogs.alert('Recording...','','Finish',hide_cancel_button=True) recorder.stop()
-
you should use a custom ui.View, which lets you define
touch_began
andtouch_ended
which you can use to kick off actions when touch begins, and anther action when it ends.
-
@JonB Thank you so much! I’m gonna try!