Help with recording audio?

PennController for IBEX Forums Support Help with recording audio?

Viewing 4 posts - 16 through 19 (of 19 total)
  • Author
    Posts
  • #10576
    Larissa_Cury
    Participant

    Hi, @Jeremy! Considering the error message, is is possible to put a trial before that?
    My idea was: If I cannot change the text, then I’ll display a warning to the kid “Please, wait your teacher”, so that the kid/participant calls the teacher, who will press S and then the message shows up. I tried to do it like this, but the order isn’t changing:

    
    // 👉  Experimental trial: 
    
    Template("new--Items_Wide.csv", row =>
      newTrial("listOfWords",
        fullscreen() //enable full screen
        ,
        newMediaRecorder("recorder", "audio").log().record()
        ,
        newTimer("recording", 3000).log().start()   // Start the timer now
        ,
        newText("words", row.Column1.split('_').join("<br>")) // separate each word with a <br> tag (new line)
            .cssContainer({
               padding: '0.5em',  // add some to not get too close to the border
              'text-align': 'center',   // trying to make the words center on fullscreen -- NOT WORKING :(
              "justify-content": 'center',
              "align-items": 'center' ,
              'font-size': '50px',
            })
            .print()
        ,
        newKey("NEXT", " ")
            .callback(  // use a callback to execute this in parallel to waiting for the timer
                getKey("NEXT").remove() // remove the NEXT button
                ,
                getText("words").text( row.Column2.split('_').join("<br>") ) // update the displayed list of words
            )
            .print()
            // do not wait for a click, otherwise the timer might elapse before the click
        ,
        getTimer("recording").wait() // wait for the timer to end
        ,
        getMediaRecorder("recorder").stop()
        ,
        getKey("NEXT").remove() // make sure to remove the button, in case the participant didn't get to the second list
        ,
        getText("words").remove()
        ,
        newText('time-is-up-msg', "Time is up!").print()
        ,
        newButton('btn--finish--game', 'Finish Game').print().wait()
      )
    );
     
    // 👉 Completion screen -- WAIT THE TEACHER ///////////////////////////////////////// HERE
    newTrial("completion_screen",
    // Exit fullscreen:
    
    exitFullscreen()
    ,
    // Print thank-you msg: 
    
        newText("thankyou-msg", "Good job, now wait your teacher!")
            .center()
            .print()
        ,
        newKey("NEXT", "S")
        // ,
        // newButton("void", "")
        //     .wait()
    );
    
    // 👉 Send results:
    
    SendResults();
    
    // 👉 Check if promise is fullfilled
    // 👉 Manually reject promise => insert dummy link 
    // 👉 Store audio locally
    
    newTrial(
        newFunction("check upload", ()=>PennController.uploadRecordingsError)
            .test.is()
            .success(
                newText("confirmation", "The recordings were sent to the server. ")
                    .print()
            )
            .failure(
                newText("error", "Click on the link below to store data 👇")
                    .color("red")
                    .print()
            )
        // ,
        // newText("download-manually-msg", DownloadRecordingButton("Click here to download an archive of your recordings.") )
        //     .print()
        // ,
        // newTimer("inifinite", 0)
        //     .wait()
    );
    
    
    #10577
    Larissa_Cury
    Participant

    I tried to add a sequence element, https://farm.pcibex.net/r/AqPhcF/ . I guess it worked! 🙂 Is there a better way, tho? I don’t think I can manipulate any of these messages, right?

    • This reply was modified 1 year, 7 months ago by Larissa_Cury.
    #10581
    Jeremy
    Keymaster

    [ EDIT : changed setConsent for consent ]

    Hi,

    You can use .consent on InitiateRecorder() to change the consent message:

    InitiateRecorder("https://myserver/uploadVoices/saveRecordings.php"
    ,
    "<b><center>RESEARCHER, click on the button below to <b style=color:red;>authorize</b> audio recording in the browser 👇</b></center>"
    ).label("first-trial")
    .consent("I Consent")
    

    Regarding the error message, you could use the hack described in this post to replace the message

    Jeremy

    • This reply was modified 1 year, 7 months ago by Jeremy. Reason: changed setConsent for consent
    #10590
    Larissa_Cury
    Participant

    Hi, Jeremy! Thank you very much!

Viewing 4 posts - 16 through 19 (of 19 total)
  • You must be logged in to reply to this topic.