Skip to content

audio-button-response: stopping audio early causes error #3553

@mmbcorley

Description

@mmbcorley
const adjust_volume = {
    type: jsPsychAudioButtonResponse,
    stimulus: audioStim,
    choices: volumeChoices,
    margin_vertical: "12px",
    response_ends_trial: true,
    trial_ends_after_audio: true,
    response_allowed_while_playing: true,
    prompt: S.volume_adjust_prompt
}

Allowing response_ends_trial and response_allowed_while_playing interrupts audio (as expected) but then throws an error:

Uncaught InvalidStateError: Failed to execute 'stop' on 'AudioScheduledSourceNode': cannot call stop without calling start first.
    at G.stop (AudioPlayer.ts:50:19)
    at p.end_trial (index.ts:118:29)
    at p.after_response (index.ts:118:29)
    at HTMLButtonElement.<anonymous> (index.ts:118:29)

This is code ported from v7 (audio-button-response v1.0.0) to v8 (audio-button-response v2.1.0): I don't recall having this issue earlier.

Chrome 137.0.7151.103 (Official Build)/Linux

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions