audio_multi_radiobutton_NAFC_page: Make multiple radiobutton NAFC audio page

View source: R/test_elements.R

audio_multi_radiobutton_NAFC_pageR Documentation

Make multiple radiobutton NAFC audio page

Description

Creates a multiple radiobutton n-alternative forced choice page for a single audio file.

Usage

audio_multi_radiobutton_NAFC_page(
  label,
  prompts,
  choices,
  url,
  instruction = "",
  labels = NULL,
  type = tools::file_ext(url),
  trigger_button_text = "Continue",
  failed_validation_message = "Answer missing!",
  save_answer = TRUE,
  hide_response_ui = FALSE,
  random_order = FALSE,
  response_ui_id = "response_ui",
  on_complete = NULL,
  wait = TRUE,
  loop = FALSE,
  admin_ui = NULL,
  btn_play_prompt = if (!show_controls) "Click here to play",
  show_controls = FALSE,
  allow_download = FALSE
)

Arguments

label

(Character scalar) Label for the current page.

prompts

(Character vector) Prompts to be displayed over the response choices

choices

(Character vector) Choices for the participant. If unnamed, then these values will be used both for radiobutton IDs and for button labels. If named, then values will be used for button IDs and names will be used for button labels.

url

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").

labels

Optional vector of labels for the NAFC radiobutton choices. If not NULL, will overwrite the names of choices. This vector of labels can either be a character vector or a list of Shiny tag objects, e.g. as created by shiny::HTML().

type

Audio type (e.g. 'mp3'). Defaults to the provided file extension.

trigger_button_text

(Character scalar) Text for the trigger button.

failed_validation_message

(Character scalar) Text to be displayed when validation fails.

save_answer

(Boolean scalar) Whether or not to save the answer.

hide_response_ui

(Boolean scalar) Whether to begin with the response interface hidden (it can be subsequently made visible through Javascript, using the element ID as set in response_ui_id. See audio_NAFC_page for an example.).

random_order

(Boolean scalar) Whether the order of the items should be randomized.

response_ui_id

(Character scalar) HTML ID for the response user interface.

on_complete

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 test_options().

wait

Whether to wait for the audio to finish before displaying the response buttons.

loop

Whether the audio should loop.

admin_ui

Optional UI component for the admin panel.

show_controls

Whether or not to show audio controls to the participant, so that they can control audio playback.

allow_download

Whether the participant is given a button to download the audio file; only relevant if show_controls is TRUE.


KilianSander/groovescale documentation built on July 21, 2023, 11:04 p.m.