Creates an n-alternative forced choice page with an audio prompt.
audio_NAFC_page( label, prompt, choices, url, labels = NULL, type = tools::file_ext(url), save_answer = TRUE, on_complete = NULL, arrange_choices_vertically = length(choices) > 2L, wait = TRUE, loop = FALSE, admin_ui = NULL, btn_play_prompt = if (!show_controls) "Click here to play", show_controls = FALSE, allow_download = FALSE, button_style = "", autoplay = "autoplay" )
Label for the current page (character scalar).
Prompt to be displayed above the response choices.
Can be either a character scalar (e.g. "What is 2 + 2?")
or an object of class "shiny.tag", e.g.
shiny::tags$p("What is 2 + 2?").
Character vector of choices for the participant. If unnamed, then these values will be used both for button IDs and for button labels. If named, then values will be used for button IDs and names will be used for button labels.
URL to the audio Can be an absolute URL (e.g. "http://mysite.com/audio.mp3") or a URL relative to the /www directory (e.g. "audio.mp3").
Optional vector of labels for the NAFC choices.
NULL, will overwrite the names of
This vector of labels can either be a character vector
or a list of Shiny tag objects, e.g. as created by
Audio type (e.g. 'mp3'). Defaults to the provided file extension.
Whether or not to save the answer.
Optional function to execute on leaving the page
(after successful validation).
The argument list should include
and any of:
state, the participant's state object;
answer, the participant's most recent answer;
input, the current page's Shiny input object;
session, the current Shiny session object;
opt, the test's option list as created by
Whether to arrange the response buttons vertically (the default) as opposed to horizontally.
Whether to wait for the audio to finish before displaying the response buttons.
Whether the audio should loop.
Optional UI component for the admin panel.
Text to display as a prompt for starting the audio. Ordinarily the participant will not see this, but it might appear if the internet connection is poor, or if the participant refreshes the page. Only used if show_controls is FALSE.
Whether or not to show audio controls to the participant, so that they can control audio playback.
Whether the participant is given a button to download the audio file; only relevant if show_controls is TRUE.
Button CSS style information (character scalar).
Whether the audio should start playing immediately default is "autoplay"