omz:forum

    • Register
    • Login
    • Search
    • Recent
    • Popular

    Welcome!

    This is the community forum for my apps Pythonista and Editorial.

    For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.


    How to stop recording when a finger is released from a button

    Pythonista
    2
    3
    1875
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • yoyo
      yoyo last edited by yoyo

      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()
      
      1 Reply Last reply Reply Quote 0
      • JonB
        JonB last edited by

        you should use a custom ui.View, which lets you define touch_began and touch_ended which you can use to kick off actions when touch begins, and anther action when it ends.

        yoyo 1 Reply Last reply Reply Quote 0
        • yoyo
          yoyo @JonB last edited by

          @JonB Thank you so much! I’m gonna try!

          1 Reply Last reply Reply Quote 0
          • First post
            Last post
          Powered by NodeBB Forums | Contributors