Skip to content
Discussion options

You must be logged in to vote

Hi @Franck-El,

We use a Promise in order to guarantee that the audio buffer is loaded before the trial starts. The old version of the audio plugins required that users preload their audio files, which led to some confusion when folks didn't preload and were unsure why the audio wasn't playing. The Promise allows us to write the plugin in a way that we check that the audio has finished loading before trying to make use of it, and if it hasn't finished loading we can try to load it and wait.

If you look at the audio-button-response plugin as an example, you'll see that we put all of the code that needs to run after the audio is loaded into a function called setupTrial. This function is call…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@Franck-El
Comment options

Answer selected by Franck-El
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants