Audio won't play

PennController for IBEX Forums Support Audio won't play

Tagged: 

This topic contains 2 replies, has 2 voices, and was last updated by Avatar carlap 1 week, 3 days ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #5727
    Avatar
    carlap
    Participant

    Hi! I´m trying to design an experiment and when I put:

    newTrial(

    newAudio(“2fishRoundTank.mp3”)
    .play()
    )

    Nothing plays. I’ve tried reproducing the tutorial exactly and, while the audio plays when I run the “Try it” within the tutorial, if I copy the exact same text into my experiment (after syncing with the github repository) the audio won´t play. What can it be? Other elements work (for example, graphics and text) just not audio…

    Any ideas?

    Thanks!

    #5728
    Jeremy
    Jeremy
    Keymaster

    Hi,

    Most browsers will block audio/video autoplay on page load, and will require an interaction with the page before the script can trigger playback. If this is the very first trial of your experiment, just add newButton("Start").print().wait(), immediately before newAudio and it should work (also, you probably want to add something after play() because as it is coded now your trial ends as soon as the audio starts playing).

    Jeremy

    #5729
    Avatar
    carlap
    Participant

    Thanks! That was the solution!

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.